Jon Skeet <sk***@pobox.co m> wrote in message news:<MP******* *************** **@news.microso ft.com>...
^(.*escaped.*ho und.*)|(.*hound .*escaped.*)$
That doesn't work (it doesn't match "Test with escaped then hound in
it") and I don't quite understand why. Any chance you could enlighten
me?
Possible bug in the .net regex engine? It parsed correctly using a java
applet I found at
http://www.cis.upenn.edu/~matuszek/G...ex-tester.html
Also in the .net regex engine the following regex seems to parse correctly
^(.+escaped.*ho und.*)|(.*hound .*escaped.*)$
The regex probably doesn't really have the meaning you thought it had
though. Misplaced paranthesises causes the regex to match on either
^(.*escaped.*ho und.*) or (.*hound.*escap ed.*)$. Placing the whole matched
string in group 0. Group 1 or 2 will also contain the full string while
the other group will be null since only one of the two paths can be
followed.
^(.*escaped.*ho und.*|.*hound.* escaped.*)$ would make the regexp a little
less complex although this expression also seems to fail in .net regex
engine.
The most practical regex if you want to use ^,$ to match the
whole row is probably
^.*(escaped.*ho und|hound.*esca ped).*$
It places the whole matched row in group 0 and the "escaped.....ho und" in
group 1. This regex does work in the .net regex engine.
/Marcus