如何匹配评论但不匹配url? C# 正则表达式
How to match comments but not url? c# regex
如何匹配页面源代码中以符号“//”开头但跳过也有“//”(如“https://test.test.test/testing”的网址)?
我现在的代码是:
Regex regex = new Regex(@"\/\/(.*?$)", RegexOptions.Multiline);
MatchCollection matchCollection1 = regex.Matches(pageSource);
string allMatches = string.Join(";", from Match match1 in matchCollection1 select match1.Groups[1].Value);
添加不存在的“:”符号并设置多行选项
[^:]\/\/(.*?$)/gm
如何匹配页面源代码中以符号“//”开头但跳过也有“//”(如“https://test.test.test/testing”的网址)?
我现在的代码是:
Regex regex = new Regex(@"\/\/(.*?$)", RegexOptions.Multiline);
MatchCollection matchCollection1 = regex.Matches(pageSource);
string allMatches = string.Join(";", from Match match1 in matchCollection1 select match1.Groups[1].Value);
添加不存在的“:”符号并设置多行选项
[^:]\/\/(.*?$)/gm