23706Re: \W and underscore
- Mar 16, 2013--- In firstname.lastname@example.org, "John Shotsky" <jshotsky@...> wrote:
>This is misleading. A single character like the underscore can never be represent a word boundary. '\b' is an assertion that matches at a position where a non-word character is preceded resp. followed by a word character. Thus it signifies a position of zero length and no single character.
> This also complicates the use of \b for word boundaries,
> because \b DOES treat this character as a word boundary.
As discussed here, the underscore is defined as a normal word character. So '\bJohn' doesn't match the string 'aaa _John', for example, because 'John' is not preceded by a word boundary in this case.
- << Previous post in topic Next post in topic >>