diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-07 19:45:17 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-07 19:45:17 (GMT) |
commit | 6276b32799d9396bb32dbbcbed61b3045ce166ec (patch) | |
tree | 1326560e2f5259de7448acfde14951cc7c3a1772 /Lib/re.py | |
parent | ea07bd2f8121f85e789e7eba581f638a6b1bfa37 (diff) | |
parent | 84df7fe6a2ff20663a194d3758295bee9b1436ef (diff) | |
download | cpython-6276b32799d9396bb32dbbcbed61b3045ce166ec.zip cpython-6276b32799d9396bb32dbbcbed61b3045ce166ec.tar.gz cpython-6276b32799d9396bb32dbbcbed61b3045ce166ec.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): |