private static void getPathAndFilename(String logFolder)
{
string img = "C:\\Users\\jiawang\\Perforce\\EASAP\\jiawang_EASHDPDESK257_6678\nucleus\\SANDBOX\\henryzhu\\ProductAPIValidator\\ProductAPIValidator\\bin\\Debug\\log_info.log";
string regex2 = @"^(?<fpath>([a-zA-Z]:\\)([\s\.\-\w]+\\)*)(?<fname>[\w]+.[\w]+)";
System.Text.RegularExpressions.Match result = System.Text.RegularExpressions.Regex.Match(img, regex2);
if (result.Success)
{
Console.WriteLine("[Full]:" + result.Value);
Console.WriteLine("[Part1]:" + result.Result("${fpath}"));
Console.WriteLine("[Part2]:" + result.Result("${fname}"));
}
Console.ReadLine();
}
时间: 2024-10-11 02:54:54