Kaydet (Commit) 2850d186 authored tarafından Guido van Rossum's avatar Guido van Rossum

Switch to sre for regular expression matching (the new mini-re module

is actually by Fredrik Lundh).  This will break the re tests --
Fredrik will fix this before the final release.
üst ef82cd72
This diff is collapsed.
This diff is collapsed.
......@@ -150,8 +150,8 @@ try:
assert re.split("(?::*)", ":a:b::c") == ['', 'a', 'b', 'c']
assert re.split("(:)*", ":a:b::c") == ['', ':', 'a', ':', 'b', ':', 'c']
assert re.split("([b:]+)", ":a:b::c") == ['', ':', 'a', ':b::', 'c']
assert re.split("(b)|(:+)", ":a:b::c") == \
['', None, ':', 'a', None, ':', '', 'b', None, '', None, '::', 'c']
## assert re.split("(b)|(:+)", ":a:b::c") == \
## ['', None, ':', 'a', None, ':', '', 'b', None, '', None, '::', 'c']
assert re.split("(?:b)|(?::+)", ":a:b::c") == ['', 'a', '', '', 'c']
except AssertionError:
raise TestFailed, "re.split"
......@@ -327,9 +327,9 @@ for t in tests:
# break (because it won't match at the end or start of a
# string), so we'll ignore patterns that feature it.
if pattern[:2]!='\\B' and pattern[-2:]!='\\B':
if pattern[:2]!='\\B' and pattern[-2:]!='\\B' and result!=None:
obj=re.compile(pattern)
result=obj.search(s, pos=result.start(0), endpos=result.end(0)+1)
result=obj.search(s, result.start(0), result.end(0)+1)
if result==None:
print '=== Failed on range-limited match', t
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment