diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2000-06-30 00:27:46 (GMT) |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2000-06-30 00:27:46 (GMT) |
commit | 01016fe972a90eb57bafeb1f4a73f334c201c3c2 (patch) | |
tree | 14f34bb2cea2e9f688fba020dfd00adb8c8aaa96 /Lib/sre.py | |
parent | 5d6ae76c0925b9f0fce059f5372f633532535b67 (diff) | |
download | cpython-01016fe972a90eb57bafeb1f4a73f334c201c3c2.zip cpython-01016fe972a90eb57bafeb1f4a73f334c201c3c2.tar.gz cpython-01016fe972a90eb57bafeb1f4a73f334c201c3c2.tar.bz2 |
- fixed split behaviour on empty matches
- fixed compiler problems when using locale/unicode flags
- fixed group/octal code parsing in sub/subn templates
Diffstat (limited to 'Lib/sre.py')
-rw-r--r-- | Lib/sre.py | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -109,16 +109,13 @@ def _subn(pattern, template, string, count=0): m = c.search() if not m: break - j = m.start() - if j > i: - append(string[i:j]) + b, e = m.span() + if i < b: + append(string[i:b]) append(filter(m)) - i = m.end() - if i <= j: - break + i = e n = n + 1 - if i < len(string): - append(string[i:]) + append(string[i:]) return string[:0].join(s), n def _split(pattern, string, maxsplit=0): @@ -128,7 +125,7 @@ def _split(pattern, string, maxsplit=0): append = s.append extend = s.extend c = pattern.scanner(string) - g = c.groups + g = pattern.groups while not maxsplit or n < maxsplit: m = c.search() if not m: |