我要把下面路径中的 "log_error.log" 这段字符串匹配出来 正则怎么写
C:\Users***\Perforce\EASAP\jiawang_EASHDPDESK257_6678\nucleus\SANDBOX\henryzhu\ProductAPIValidator\ProductAPIValidator\bin\Debug\log_error.log
c# 正则匹配 特殊字符串
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- Go 旅城通票 2016-09-26 03:49关注
string s=@"C:\Users***\Perforce\EASAP\jiawang_EASHDPDESK257_6678\nucleus\SANDBOX\henryzhu\ProductAPIValidator\ProductAPIValidator\bin\Debug\log_error.log"; string []arr=s.Split('\\');//arr[arr.Length-1]就是
正则用这个
Regex r = new Regex(@"\\([^\\]+)$"); string s = @"C:\Users***\Perforce\EASAP\jiawang_EASHDPDESK257_6678\nucleus\SANDBOX\henryzhu\ProductAPIValidator\ProductAPIValidator\bin\Debug\log_error.log"; Match match = r.Match(s); Response.Write(match.Groups[1].Value); Response.End();
解决 无用评论 打赏 举报