I try to test regular expression $ anchor using .net framework, the result is unexpected. The $ anchor only return the last one. I note the multiline switch is important, and I already used it here. Can anyone tell the reason. Following is my test code
Thanks Fred
string sourceText =
@"ab<br />
ab<br />
ab";
//var m = Regex.Match(sourceText, "^a", RegexOptions.Multiline); //this return 3 match
var m = Regex.Match(sourceText, "b$", RegexOptions.Multiline); //this return only one match
while (m.Success)
{
Console.Write(m.Value);
m = m.NextMatch();
}