diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-07 19:43:57 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-07 19:43:57 (GMT) |
commit | 84df7fe6a2ff20663a194d3758295bee9b1436ef (patch) | |
tree | 09b3010bf531895d3188e0ace94a2df035ec5e7d /Lib/re.py | |
parent | b556399fb500136ee4b3c562a72af062527bd20a (diff) | |
download | cpython-84df7fe6a2ff20663a194d3758295bee9b1436ef.zip cpython-84df7fe6a2ff20663a194d3758295bee9b1436ef.tar.gz cpython-84df7fe6a2ff20663a194d3758295bee9b1436ef.tar.bz2 |
Issues #814253, #9179: Group references and conditional group references now
work in lookbehind assertions in regular expressions.
Diffstat (limited to 'Lib/re.py')
-rw-r--r-- | Lib/re.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -352,10 +352,11 @@ class Scanner: s = sre_parse.Pattern() s.flags = flags for phrase, action in lexicon: + gid = s.opengroup() p.append(sre_parse.SubPattern(s, [ - (SUBPATTERN, (len(p)+1, sre_parse.parse(phrase, flags))), + (SUBPATTERN, (gid, sre_parse.parse(phrase, flags))), ])) - s.groups = len(p)+1 + s.closegroup(gid, p[-1]) p = sre_parse.SubPattern(s, [(BRANCH, (None, p))]) self.scanner = sre_compile.compile(p) def scan(self, string): |