logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: [Boston.pm] '/' =~ m"\/\b"; (bug?): msg#00031

Subject: Re: [Boston.pm] '/' =~ m"\/\b"; (bug?)
On Wed, Nov 15, 2006 at 02:05:47PM -0800, Carl Eklof wrote:
> Hi Guys n Gals,
> 
> I have found some seemingly strange behavior that may
> be of interest to this list.
> 
> My assumption was that the \b pattern in a regex would
> always match the beginning and end of a string (as
> documented in the perlre page).

That is not what the documentation says:

    A word boundary ("\b") is a spot between two characters that has a
    "\w" on one side of it and a "\W" on the other side of it (in either
    order), counting the imaginary characters off the beginning and end
    of the string as matching a "\W".

\b matches between a word character and a non-word character, or between a
word character and the start or end of a string.  If the first character in
the string is a non-word character, then \b will not match at the beginning
of the string.  This is the expected behavior.

Ronald



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>