我的正则表达式的使用方法:
//匹配路径
string regexStrPath = "/b[a-z]://[^/:*?"<>|/r/n]*";
//匹配时间、大小和文件名
string regexStrInfo = "(?<time>/d/d-/d/d-/d/d/s+/d/d/:/d/d)/s+(?<size>[/d|,]+)/s+(?<name>[/S|/.]+)";
MatchCollection mcPath = Regex.Match(yourString, regexStrPath, RegexOptions.IgnoreCase);//忽略大小写
foreach(Match m in mcPath)
{
string path = m.Value; //路径
}
MatchCollcetion mcInfo = Regex.Match(yourString, regexStrInfo, RegexOptions.IgnoreCase);
foreach(Match m in mcInfo)
{
string name = m.Group["name"].Value;
string size = m.Group["size"].Value;
string time = m.Group["time"].Value;
}