>>>>> "JWK" == John W Krahn <jwkr...@shaw.ca> writes:

  JWK> 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.

  JWK> Quite.

  >> /\b/ matches any (zero-length) point in a string between a
  >> word and a non-word character,

  JWK> Correct.

  >> or between a word character and the
  >> beginning or end of the string,

  JWK> Incorrect.  It matches *only* between \w and \W characters.

sorry to correct that, but rob is right. i knew \b worked with string
ends but i didn't realize it assumed they were non-word (\W) chars. a
little test shows this:

perl -le 'print "yes" if "a" =~ /^\b/'
yes
perl -le 'print "yes" if "!" =~ /^\b/'

the second has no output. so you can consider the ends of a string to be
\W chars for \b.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to