[Mono-dev] Regex.Match(string, int, int) behaves differently than Microsoft's implementation

Tom Philpot tom.philpot at logos.com
Mon Mar 22 14:52:36 EDT 2010

So we've reported this bug here: https://bugzilla.novell.com/show_bug.cgi?id=474154

Text of the bug report is as follows:
Certain regular expressions will behave differently on Mono when calling
Regex.Match(string, int, int). In particular the expression

new Regex("^quick$").Match("The quick brown fox jumps over the lazy dog.", 4,

evaluates to true in Microsoft's implementation, but false in Mono. It appears
that in Microsoft's implementation, the results of the method are comparable to
calling string.Substring() on the string being passed in, except that indexes
are still reported in terms of the original string.

As a side note, the expression

new Regex("^quick").Match("The quick brown fox jumps over the lazy dog.",

evaluates to false both in Microsoft's implementation and in Mono. Any fix to
the former should not break the latter.
Before I went digging into the bug, I thought I'd ask if any of the devs had a quick fix.


More information about the Mono-devel-list mailing list