I want to count links which are having special symbol (underscore) . I have written regex its working fine in an online editor/php editor, but not working in C# code:
<
(?<Tag_Name>(a)|img)\b
[^>]*?
\b(?<URL_Type>(?(2)href|src))
\s*=\s*
(?:"(?<URL>(?:\\.|[^\\"_#?&]++)*(?:_|(?<Query>[#?&]))(?:\\.|[^"\\]++)*)"
| '(?<URL>(?:\\.|[^\\'_#?&]++)*(?:_|(?<Query>[#?&]))(?:\\.|[^'\\]++)*)')
but in C# code its giving compilation error
MatchCollection underscoreLinks = Regex.Matches(strIn, "<(?<Tag_Name>(a)|img)\b[^>]*?\b(?<URL_Type>(?(2)href|src)) \s*=\s*(?:"(?<URL>(?:\\.|[^\\"_#?&]++)*(?:_|(?<Query>[#?&]))(?:\\.|[^"\\]++)*)"| '(?<URL>(?:\\.|[^\\'_#?&]++)*(?:_|(?<Query>[#?&]))(?:\\.|[^'\\]++)*)')", RegexOptions.IgnoreCase | RegexOptions.Multiline);