听说这里的正则高手特多,特来问一简单问题
- HTML code
[color=#FF0000]xxx = true; // Remove old files[/color]// 5 minutes execution timeafdsfs // Uncomment this one to fake upload time// asdfaf // Uncomment this one to fake upload timefda // Uncomment this one to fake upload time333
我想删除 有//的行 ,//有可能不是在开头 。参见红色部分,如果 //在表达式的后面,是不删除的。
正则应该如何写
[解决办法]
- C# code
string r = Regex.Replace(s, @"(?m)^\s*//.*$", "");
[解决办法]
[解决办法]
str=Regex.Replace(str,"(?m)^\\s*//.*","");