Next | Regular Expression Mastery | 47 |
|D|o|n|'|t| |t|o|u|c|h| |t|h|a|t|!|
\b: (`word boundary')
It succeeds when the previous character is a \w and the next is not (or vice versa)
|D o n|'|t| |t o u c h| |t h a t|!
\B is the opposite:
It succeeds when the previous and next characters are both \w, or neither is \w
D|o|n ' t t|o|u|c|h t|h|a|t !|
Neither one will advance the cursor: They are assertions.
Both pretend that string is bounded by \W characters.
Next | Copyright © 2002 M. J. Dominus |