A
andrew cooke
This is a bit embarassing, but I seem to be misunderstanding how \b
works in regexps.
Please can someone explain why the following fails:
from re import compile
p = compile(r'\bword\b')
m = p.match(' word ')
assert m
My understanding is that \b matches a space at the start or end of a
word, and that "word" is a word - http://docs.python.org/library/re.html
What am I missing here? I suspect I am doing something very stupid.
Thanks,
Andrew
works in regexps.
Please can someone explain why the following fails:
from re import compile
p = compile(r'\bword\b')
m = p.match(' word ')
assert m
My understanding is that \b matches a space at the start or end of a
word, and that "word" is a word - http://docs.python.org/library/re.html
What am I missing here? I suspect I am doing something very stupid.
Thanks,
Andrew