I have the following very simple regular expression that matches the HTML tags in a string. I have a case insensitive parameter, so tag capitalization doesn't matter. However, when the "compiled" parameter is set, the "IgnoreCase" option seems to be ignored.
Code example:
string text = "<SPAN>blah</SPAN><span>blah</span>"; Regex expr1 = new Regex("</*span>", RegexOptions.IgnoreCase); Regex expr2 = new Regex("</*span>", RegexOptions.IgnoreCase & RegexOptions.Compiled); MatchCollection result1 = expr1 .Matches(text); //gives 4 matches- <SPAN>,</SPAN>,<span> & </span> MatchCollection result2 = expr2 .Matches(text); //only gives 2 matches- <span> & </span>
Has anyone understood what is going on here?
John source share