From: "Jayakumar Rajagopal" <[EMAIL PROTECTED]>
> hi friends,
> in regexp, I feel \s and \b behaves same.
> can someone send me a contradiction ?

$str = "This is a sentence. And this is another.";

@all_words = ($str =~ /\b(\w+)\b/g);
print join( ', ', @all_words), "\n";

@some_words = ($str =~ /\s(\w+)\s/g);
print join( ', ', @some_words), "\n";

Quite a big difference ain't it?

\b matches 0 characters just between a word and non-word character, 
while \s matches one space.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to