The following is a simple piece of code that demonstrates the apparently erroneous behavior of line-ending matching ("$") in .Net regular expressions. Am I missing something?
string input = "Hello\nWorld\n";
string regex = @"^Hello\n^World\n";
Match m = Regex.Match(input, regex, RegexOptions.Multiline | RegexOptions.CultureInvariant);
Console.WriteLine(m.Success);
source
share