C# 正则表达式匹配string字符串中的时间串(yyyyMMdd)
var time = "";
string pattern = @"_(?<time>20\d{6})";
var regResult = Regex.Match(fileName, pattern);
if (regResult.Success)
{
time = regResult.Groups["time"].ToString();
}
var uploadDate = DateTime.ParseExact(time, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);