While trying to learn a little more about regular expressions, a tutorial suggested that you can use the
to match a word boundary. However, the following snippet in the Python interpreter does not work as expected:
>>> x = 'one two three'
>>> y = re.search("two", x)
It should have been a match object if anything was matched, but it is None
.
Is the
expression not supported in Python or am I using it wrong?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…