[issue14460] In re's positive lookbehind assertion repetition works

Matthew Barnett report at bugs.python.org
Thu Jun 26 12:25:14 CEST 2014


Matthew Barnett added the comment:

Lookarounds can contain capture groups:

>>> import re
>>> re.search(r'a(?=(.))', 'ab').groups()
('b',)
>>> re.search(r'(?<=(.))b', 'ab').groups()
('a',)

so lookarounds that are optional or can have no repeats might have a use.

I'm not sure whether it's useful to repeat them more than once, but that's another matter.

I'd say that it's not a bug.

----------

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


More information about the Python-bugs-list mailing list