diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-21 08:07:35 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-21 08:07:35 (GMT) |
commit | 4eea62fd2e40d928ff88facc796ebba3aac808a2 (patch) | |
tree | 009531c0bbb25bcd89564cd22bd6c0c6ed1d89cd /Lib/re.py | |
parent | df80706f141bf3de5326750e4646161355d65881 (diff) | |
download | cpython-4eea62fd2e40d928ff88facc796ebba3aac808a2.zip cpython-4eea62fd2e40d928ff88facc796ebba3aac808a2.tar.gz cpython-4eea62fd2e40d928ff88facc796ebba3aac808a2.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
@@ -351,10 +351,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): |