Wagner, David --- Senior Programmer Analyst --- CFS wrote:
-----Original Message-----
From: John W. Krahn [mailto:jwkr...@shaw.ca]
Sent: Tuesday, July 20, 2010 15:06
To: Perl Beginners
Subject: Re: Word boundaries
Rob Dixon wrote:
On 20/07/2010 16:22, Chandan Kumar wrote:
Small confusion about word boundaries. word boundaries matches
anything between non-word character and word character ,right.
Not quite.
Quite.
/\b/ matches any (zero-length) point in a string between a
word and a non-word character,
Correct.
or between a word character and the
beginning or end of the string,
Incorrect. It matches *only* between \w and \W characters.
But for the test you were doing, you could have added this:
(\b{0,1}\W\b) which would have gotten you the ? as the output, but
unsure that that is what you really wanted...
You can't use a modifier on a zero-width assertion, it makes no sense.
Modifiers are only used on patterns that actually match characters.
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/