[docs] [issue14155] Deja vu in re's documentation

py.user report at bugs.python.org
Wed Feb 29 23:06:44 CET 2012


py.user <port139 at yandex.ru> added the comment:

the multiline mode affects on regex.match()

>>> p = re.compile(r'^a')
>>> p.match('abc\nabc')
<_sre.SRE_Match object at 0xb749bf38>
>>> p.match('abc\nabc').span()
(0, 1)
>>> p.match('abc\nabc', 4)
>>> 
>>> p = re.compile(r'^a', re.M)
>>> p.match('abc\nabc', 4)
<_sre.SRE_Match object at 0xb749bf38>
>>> p.match('abc\nabc', 4).span()
(4, 5)
>>>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14155>
_______________________________________


More information about the docs mailing list