New submission from Devin Jeanpierre <jeanpierr...@gmail.com>: compiled regex objects' match method offers an optional "pos" parameter described to be roughly equivalent to slicing except for how it treats the "^" operation. See http://docs.python.org/library/re.html#re.RegexObject.search
However, the behavior of lookbehind assertions also differs: >>> re.compile("(?<=a)b").match("ab", 1) <_sre.SRE_Match object at 0x...> >>> re.compile("(?<=a)b").match("ab"[1:]) >>> This alone might be a documentation bug, but the behavior is also inconsistent with the behavior of lookahead assertions, which do *not* look past the endpos: >>> re.compile("a(?=b)").match("ab", 0, 1) >>> re.compile("a(?=b)").match("ab") <_sre.SRE_Match object at 0x...> >>> ---------- components: Regular Expressions messages: 153188 nosy: Devin Jeanpierre, ezio.melotti priority: normal severity: normal status: open title: Lookbehind assertions go behind the start position for the match type: behavior versions: Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13998> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com