Jayakumar Rajagopal wrote:
in regexp, I feel \s and \b behaves same.
\s matches whitespace. \b matches a "word boundary", which is
the border between a word character and a non-word character.
These are never the same, since \s matches a character, and \b
matches *between* characters...
% perl -le 'print "-x" =~ /-\bx/'
1
For an example of both: in the string "Foo Bar", \s matches the
space but \b matches before the beginning, after the end, and before
and after the space. (But not the space itself.)
[F] [o] [o] [ ] [B] [a] [r]
^ :: matches \s
^ ^ ^ ^ :: all match \b
% perl -le 'for ("Foo Bar") { print pos while /\b/g }'
0
3
4
7
--
Steve
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>