On Jun 14, [EMAIL PROTECTED] said:

>$field = "Search, This is part of the code.";

I have marked the word boundaries (the places in your string that are
matched by \b) with # signs:

#Search#, #This# #is# #part# #of# #the# #code#.

A word boundary is defined as the position in a string where a word
character is NOT adjacent to ANOTHER word character.

>This code removes the comma. But I am puzzeled. I thought that the first line
>    $word =~ s/[,\]\)\}]\b//;
>would delete the comma.

No, because in order for a comma to be followed by a word boundary, it
would have to be followed by a word character.

>Yet it was the second line that did it.
>        $word =~ s/\b[,\]\)\}]//;

Right, because the comma IS preceded by a word boundary, because the
string starts with "Search," and the word boundary is between the 'h' and
the ','.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
CPAN ID: PINYAN    [Need a programmer?  If you like my work, let me know.]
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


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