Loading ...
Sorry, an error occurred while loading the content.

23706Re: \W and underscore

Expand Messages
  • flo.gehrke
    Mar 16, 2013
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, "John Shotsky" <jshotsky@...> wrote:
      >
      > This also complicates the use of \b for word boundaries,
      > because \b DOES treat this character as a word boundary.

      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.

      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.

      Flo
    • Show all 15 messages in this topic