[英]regex.replace problem
我想替换为什么此代码不起作用?
MessageBox.Show( Regex.Replace(Regex.Escape(@"c:\www\html"), Regex.Escape(@"c:\www\"), "", RegexOptions.IgnoreCase));
It doesn't work because you escaped not only your search pattern but also your query string. 它不起作用,因为您不仅转义了搜索模式,而且还转义了查询字符串。 Don't do that:
不要那样做:
var result = Regex.Replace(
@"c:\www\html", Regex.Escape(@"c:\www\"), "", RegexOptions.IgnoreCase));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.