:
: If I use
:
: Regex regex = new
: Regex(@"[...](?
: RegexOptions.ExplicitCapture);
:
: I will be able to parse out "100 main ST # C)
:
: But if I move "#" position in regular expression, I won't be able to
: parse out the same address anymore.
:
: Regex regex = new
: Regex(@"[...](?
: RegexOptions.ExplicitCapture);
The latter fails to match because there's no word boundary (\b) between
an octothorpe and a space. Remember, a word boundard occurs between a
\w and a \W or vice versa, but '#' and ' ' both match \W.
A start in the right direction is (line breaks inserted):
(?
(?
(?
Hope this helps,
Greg
No comments:
Post a Comment