annotate Lib/test/re_tests.py @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents fa7874ec6a71
children 1a2f8dde81ec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5794
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
1 #!/usr/bin/env python
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
2 # -*- mode: python -*-
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
3
7852
f34a658e7c15 AMK's latest
Guido van Rossum <guido@python.org>
parents: 6777
diff changeset
4 # Re test suite and benchmark suite v1.5
5774
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
5
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 # The 3 possible outcomes for each pattern
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 [SUCCEED, FAIL, SYNTAX_ERROR] = range(3)
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
8
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 # Benchmark suite (needs expansion)
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 #
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 # The benchmark suite does not test correctness, just speed. The
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
12 # first element of each tuple is the regex pattern; the second is a
5774
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 # string to match it against. The benchmarking code will embed the
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
14 # second string inside several sizes of padding, to test how regex
5774
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 # matching performs on large strings.
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
16
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 benchmarks = [
14316
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
18
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
19 # test common prefix
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
20 ('Python|Perl', 'Perl'), # Alternation
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
21 ('(Python|Perl)', 'Perl'), # Grouped alternation
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
22
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
23 ('Python|Perl|Tcl', 'Perl'), # Alternation
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
24 ('(Python|Perl|Tcl)', 'Perl'), # Grouped alternation
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
25
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
26 ('(Python)\\1', 'PythonPython'), # Backreference
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
27 ('([0a-z][a-z0-9]*,)+', 'a5,b7,c9,'), # Disable the fastmap optimization
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
28 ('([a-z][a-z0-9]*,)+', 'a5,b7,c9,'), # A few sets
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
29
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
30 ('Python', 'Python'), # Simple text literal
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
31 ('.*Python', 'Python'), # Bad text literal
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
32 ('.*Python.*', 'Python'), # Worse text literal
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
33 ('.*(Python)', 'Python'), # Bad text literal with grouping
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
34
5774
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
35 ]
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
36
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
37 # Test suite (for verifying correctness)
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 #
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
39 # The test suite is a list of 5- or 3-tuples. The 5 parts of a
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
40 # complete tuple are:
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 # element 0: a string containing the pattern
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
42 # 1: the string to match against the pattern
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
43 # 2: the expected result (SUCCEED, FAIL, SYNTAX_ERROR)
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
44 # 3: a string that will be eval()'ed to produce a test string.
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 # This is an arbitrary Python expression; the available
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
46 # variables are "found" (the whole match), and "g1", "g2", ...
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
47 # up to "g99" contain the contents of each group, or the
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
48 # string 'None' if the group wasn't given a value, or the
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
49 # string 'Error' if the group index was out of range;
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
50 # also "groups", the return value of m.group() (a tuple).
5774
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
51 # 4: The expected result of evaluating the expression.
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
52 # If the two don't match, an error is reported.
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
53 #
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
54 # If the regex isn't expected to work, the latter two elements can be omitted.
3ef2563e83ee test suite for re.py
Guido van Rossum <guido@python.org>
parents:
diff changeset
55
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
56 tests = [
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
57 # Test ?P< and ?P= extensions
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
58 ('(?P<foo_123', '', SYNTAX_ERROR), # Unterminated group identifier
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
59 ('(?P<1>a)', '', SYNTAX_ERROR), # Begins with a digit
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
60 ('(?P<!>a)', '', SYNTAX_ERROR), # Begins with an illegal char
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
61 ('(?P<foo!>a)', '', SYNTAX_ERROR), # Begins with an illegal char
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
62
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
63 # Same tests, for the ?P= form
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
64 ('(?P<foo_123>a)(?P=foo_123', 'aa', SYNTAX_ERROR),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
65 ('(?P<foo_123>a)(?P=1)', 'aa', SYNTAX_ERROR),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
66 ('(?P<foo_123>a)(?P=!)', 'aa', SYNTAX_ERROR),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
67 ('(?P<foo_123>a)(?P=foo_124', 'aa', SYNTAX_ERROR), # Backref to undefined group
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
68
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
69 ('(?P<foo_123>a)', 'a', SUCCEED, 'g1', 'a'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
70 ('(?P<foo_123>a)(?P=foo_123)', 'aa', SUCCEED, 'g1', 'a'),
7852
f34a658e7c15 AMK's latest
Guido van Rossum <guido@python.org>
parents: 6777
diff changeset
71
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
72 # Test octal escapes
7852
f34a658e7c15 AMK's latest
Guido van Rossum <guido@python.org>
parents: 6777
diff changeset
73 ('\\1', 'a', SYNTAX_ERROR), # Backreference
f34a658e7c15 AMK's latest
Guido van Rossum <guido@python.org>
parents: 6777
diff changeset
74 ('[\\1]', '\1', SUCCEED, 'found', '\1'), # Character
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
75 ('\\09', chr(0) + '9', SUCCEED, 'found', chr(0) + '9'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
76 ('\\141', 'a', SUCCEED, 'found', 'a'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
77 ('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', SUCCEED, 'found+"-"+g11', 'abcdefghijklk9-k'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
78
7852
f34a658e7c15 AMK's latest
Guido van Rossum <guido@python.org>
parents: 6777
diff changeset
79 # Test \0 is handled everywhere
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
80 (r'\0', '\0', SUCCEED, 'found', '\0'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
81 (r'[\0a]', '\0', SUCCEED, 'found', '\0'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
82 (r'[a\0]', '\0', SUCCEED, 'found', '\0'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
83 (r'[^a\0]', '\0', FAIL),
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
84
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
85 # Test various letter escapes
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
86 (r'\a[\b]\f\n\r\t\v', '\a\b\f\n\r\t\v', SUCCEED, 'found', '\a\b\f\n\r\t\v'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
87 (r'[\a][\b][\f][\n][\r][\t][\v]', '\a\b\f\n\r\t\v', SUCCEED, 'found', '\a\b\f\n\r\t\v'),
14316
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
88 # NOTE: not an error under PCRE/PRE:
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
89 # (r'\u', '', SYNTAX_ERROR), # A Perl escape
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
90 (r'\c\e\g\h\i\j\k\m\o\p\q\y\z', 'ceghijkmopqyz', SUCCEED, 'found', 'ceghijkmopqyz'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
91 (r'\xff', '\377', SUCCEED, 'found', chr(255)),
14316
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
92 # new \x semantics
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
93 (r'\x00ffffffffffffff', '\377', FAIL, 'found', chr(255)),
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
94 (r'\x00f', '\017', FAIL, 'found', chr(15)),
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
95 (r'\x00fe', '\376', FAIL, 'found', chr(254)),
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
96 # (r'\x00ffffffffffffff', '\377', SUCCEED, 'found', chr(255)),
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
97 # (r'\x00f', '\017', SUCCEED, 'found', chr(15)),
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
98 # (r'\x00fe', '\376', SUCCEED, 'found', chr(254)),
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
99
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
100 (r"^\w+=(\\[\000-\277]|[^\n\\])*", "SRC=eval.c g.c blah blah blah \\\\\n\tapes.c",
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
101 SUCCEED, 'found', "SRC=eval.c g.c blah blah blah \\\\"),
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
102
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
103 # Test that . only matches \n in DOTALL mode
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
104 ('a.b', 'acb', SUCCEED, 'found', 'acb'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
105 ('a.b', 'a\nb', FAIL),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
106 ('a.*b', 'acc\nccb', FAIL),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
107 ('a.{4,5}b', 'acc\nccb', FAIL),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
108 ('a.b', 'a\rb', SUCCEED, 'found', 'a\rb'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
109 ('a.b(?s)', 'a\nb', SUCCEED, 'found', 'a\nb'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
110 ('a.*(?s)b', 'acc\nccb', SUCCEED, 'found', 'acc\nccb'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
111 ('(?s)a.{4,5}b', 'acc\nccb', SUCCEED, 'found', 'acc\nccb'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
112 ('(?s)a.b', 'a\nb', SUCCEED, 'found', 'a\nb'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
113
7852
f34a658e7c15 AMK's latest
Guido van Rossum <guido@python.org>
parents: 6777
diff changeset
114 (')', '', SYNTAX_ERROR), # Unmatched right bracket
f34a658e7c15 AMK's latest
Guido van Rossum <guido@python.org>
parents: 6777
diff changeset
115 ('', '', SUCCEED, 'found', ''), # Empty pattern
5794
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
116 ('abc', 'abc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
117 ('abc', 'xbc', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
118 ('abc', 'axc', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
119 ('abc', 'abx', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
120 ('abc', 'xabcy', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
121 ('abc', 'ababc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
122 ('ab*c', 'abc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
123 ('ab*bc', 'abc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
124 ('ab*bc', 'abbc', SUCCEED, 'found', 'abbc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
125 ('ab*bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
126 ('ab+bc', 'abbc', SUCCEED, 'found', 'abbc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
127 ('ab+bc', 'abc', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
128 ('ab+bc', 'abq', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
129 ('ab+bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
130 ('ab?bc', 'abbc', SUCCEED, 'found', 'abbc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
131 ('ab?bc', 'abc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
132 ('ab?bc', 'abbbbc', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
133 ('ab?c', 'abc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
134 ('^abc$', 'abc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
135 ('^abc$', 'abcc', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
136 ('^abc', 'abcc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
137 ('^abc$', 'aabc', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
138 ('abc$', 'aabc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
139 ('^', 'abc', SUCCEED, 'found+"-"', '-'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
140 ('$', 'abc', SUCCEED, 'found+"-"', '-'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
141 ('a.c', 'abc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
142 ('a.c', 'axc', SUCCEED, 'found', 'axc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
143 ('a.*c', 'axyzc', SUCCEED, 'found', 'axyzc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
144 ('a.*c', 'axyzd', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
145 ('a[bc]d', 'abc', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
146 ('a[bc]d', 'abd', SUCCEED, 'found', 'abd'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
147 ('a[b-d]e', 'abd', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
148 ('a[b-d]e', 'ace', SUCCEED, 'found', 'ace'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
149 ('a[b-d]', 'aac', SUCCEED, 'found', 'ac'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
150 ('a[-b]', 'a-', SUCCEED, 'found', 'a-'),
5794
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
151 ('a[\\-b]', 'a-', SUCCEED, 'found', 'a-'),
14316
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
152 # NOTE: not an error under PCRE/PRE:
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
153 # ('a[b-]', 'a-', SYNTAX_ERROR),
5794
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
154 ('a[]b', '-', SYNTAX_ERROR),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
155 ('a[', '-', SYNTAX_ERROR),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
156 ('a\\', '-', SYNTAX_ERROR),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
157 ('abc)', '-', SYNTAX_ERROR),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
158 ('(abc', '-', SYNTAX_ERROR),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
159 ('a]', 'a]', SUCCEED, 'found', 'a]'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
160 ('a[]]b', 'a]b', SUCCEED, 'found', 'a]b'),
5794
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
161 ('a[\]]b', 'a]b', SUCCEED, 'found', 'a]b'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
162 ('a[^bc]d', 'aed', SUCCEED, 'found', 'aed'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
163 ('a[^bc]d', 'abd', FAIL),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
164 ('a[^-b]c', 'adc', SUCCEED, 'found', 'adc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
165 ('a[^-b]c', 'a-c', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
166 ('a[^]b]c', 'a]c', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
167 ('a[^]b]c', 'adc', SUCCEED, 'found', 'adc'),
5794
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
168 ('\\ba\\b', 'a-', SUCCEED, '"-"', '-'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
169 ('\\ba\\b', '-a', SUCCEED, '"-"', '-'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
170 ('\\ba\\b', '-a-', SUCCEED, '"-"', '-'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
171 ('\\by\\b', 'xy', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
172 ('\\by\\b', 'yz', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
173 ('\\by\\b', 'xyz', FAIL),
6067
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
174 ('x\\b', 'xyz', FAIL),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
175 ('x\\B', 'xyz', SUCCEED, '"-"', '-'),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
176 ('\\Bz', 'xyz', SUCCEED, '"-"', '-'),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
177 ('z\\B', 'xyz', FAIL),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
178 ('\\Bx', 'xyz', FAIL),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
179 ('\\Ba\\B', 'a-', FAIL, '"-"', '-'),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
180 ('\\Ba\\B', '-a', FAIL, '"-"', '-'),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
181 ('\\Ba\\B', '-a-', FAIL, '"-"', '-'),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
182 ('\\By\\B', 'xy', FAIL),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
183 ('\\By\\B', 'yz', FAIL),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
184 ('\\By\\b', 'xy', SUCCEED, '"-"', '-'),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
185 ('\\by\\B', 'yz', SUCCEED, '"-"', '-'),
3d3fa877387a Added tests for \b, \B (AMK).
Guido van Rossum <guido@python.org>
parents: 6004
diff changeset
186 ('\\By\\B', 'xyz', SUCCEED, '"-"', '-'),
5794
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
187 ('ab|cd', 'abc', SUCCEED, 'found', 'ab'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
188 ('ab|cd', 'abcd', SUCCEED, 'found', 'ab'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
189 ('()ef', 'def', SUCCEED, 'found+"-"+g1', 'ef-'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
190 ('$b', 'b', FAIL),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
191 ('a\\(b', 'a(b', SUCCEED, 'found+"-"+g1', 'a(b-Error'),
5794
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
192 ('a\\(*b', 'ab', SUCCEED, 'found', 'ab'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
193 ('a\\(*b', 'a((b', SUCCEED, 'found', 'a((b'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
194 ('a\\\\b', 'a\\b', SUCCEED, 'found', 'a\\b'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
195 ('((a))', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'a-a-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
196 ('(a)b(c)', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'abc-a-c'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
197 ('a+b+c', 'aabbabc', SUCCEED, 'found', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
198 ('(a+|b)*', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
199 ('(a+|b)+', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
200 ('(a+|b)?', 'ab', SUCCEED, 'found+"-"+g1', 'a-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
201 (')(', '-', SYNTAX_ERROR),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
202 ('[^ab]*', 'cde', SUCCEED, 'found', 'cde'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
203 ('abc', '', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
204 ('a*', '', SUCCEED, 'found', ''),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
205 ('a|b|c|d|e', 'e', SUCCEED, 'found', 'e'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
206 ('(a|b|c|d|e)f', 'ef', SUCCEED, 'found+"-"+g1', 'ef-e'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
207 ('abcd*efg', 'abcdefg', SUCCEED, 'found', 'abcdefg'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
208 ('ab*', 'xabyabbbz', SUCCEED, 'found', 'ab'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
209 ('ab*', 'xayabbbz', SUCCEED, 'found', 'a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
210 ('(ab|cd)e', 'abcde', SUCCEED, 'found+"-"+g1', 'cde-cd'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
211 ('[abhgefdc]ij', 'hij', SUCCEED, 'found', 'hij'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
212 ('^(ab|cd)e', 'abcde', FAIL, 'xg1y', 'xy'),
5794
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
213 ('(abc|)ef', 'abcdef', SUCCEED, 'found+"-"+g1', 'ef-'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
214 ('(a|b)c*d', 'abcd', SUCCEED, 'found+"-"+g1', 'bcd-b'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
215 ('(ab|ab*)bc', 'abc', SUCCEED, 'found+"-"+g1', 'abc-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
216 ('a([bc]*)c*', 'abc', SUCCEED, 'found+"-"+g1', 'abc-bc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
217 ('a([bc]*)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
218 ('a([bc]+)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
219 ('a([bc]*)(c+d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-b-cd'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
220 ('a[bcd]*dcdcde', 'adcdcde', SUCCEED, 'found', 'adcdcde'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
221 ('a[bcd]+dcdcde', 'adcdcde', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
222 ('(ab|a)b*c', 'abc', SUCCEED, 'found+"-"+g1', 'abc-ab'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
223 ('((a)(b)c)(d)', 'abcd', SUCCEED, 'g1+"-"+g2+"-"+g3+"-"+g4', 'abc-a-b-d'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
224 ('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', SUCCEED, 'found', 'alpha'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
225 ('^a(bc+|b[eh])g|.h$', 'abh', SUCCEED, 'found+"-"+g1', 'bh-None'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
226 ('(bc+d$|ef*g.|h?i(j|k))', 'effgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
227 ('(bc+d$|ef*g.|h?i(j|k))', 'ij', SUCCEED, 'found+"-"+g1+"-"+g2', 'ij-ij-j'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
228 ('(bc+d$|ef*g.|h?i(j|k))', 'effg', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
229 ('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
230 ('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
231 ('(((((((((a)))))))))', 'a', SUCCEED, 'found', 'a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
232 ('multiple words of text', 'uh-uh', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
233 ('multiple words', 'multiple words, yeah', SUCCEED, 'found', 'multiple words'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
234 ('(.*)c(.*)', 'abcde', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcde-ab-de'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
235 ('\\((.*), (.*)\\)', '(a, b)', SUCCEED, 'g2+"-"+g1', 'b-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
236 ('[k]', 'ab', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
237 ('a[-]?c', 'ac', SUCCEED, 'found', 'ac'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
238 ('(abc)\\1', 'abcabc', SUCCEED, 'g1', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
239 ('([a-c]*)\\1', 'abcabc', SUCCEED, 'g1', 'abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
240 ('^(.+)?B', 'AB', SUCCEED, 'g1', 'A'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
241 ('(a+).\\1$', 'aaaaa', SUCCEED, 'found+"-"+g1', 'aaaaa-aa'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
242 ('^(a+).\\1$', 'aaaa', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
243 ('(abc)\\1', 'abcabc', SUCCEED, 'found+"-"+g1', 'abcabc-abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
244 ('([a-c]+)\\1', 'abcabc', SUCCEED, 'found+"-"+g1', 'abcabc-abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
245 ('(a)\\1', 'aa', SUCCEED, 'found+"-"+g1', 'aa-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
246 ('(a+)\\1', 'aa', SUCCEED, 'found+"-"+g1', 'aa-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
247 ('(a+)+\\1', 'aa', SUCCEED, 'found+"-"+g1', 'aa-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
248 ('(a).+\\1', 'aba', SUCCEED, 'found+"-"+g1', 'aba-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
249 ('(a)ba*\\1', 'aba', SUCCEED, 'found+"-"+g1', 'aba-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
250 ('(aa|a)a\\1$', 'aaa', SUCCEED, 'found+"-"+g1', 'aaa-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
251 ('(a|aa)a\\1$', 'aaa', SUCCEED, 'found+"-"+g1', 'aaa-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
252 ('(a+)a\\1$', 'aaa', SUCCEED, 'found+"-"+g1', 'aaa-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
253 ('([abc]*)\\1', 'abcabc', SUCCEED, 'found+"-"+g1', 'abcabc-abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
254 ('(a)(b)c|ab', 'ab', SUCCEED, 'found+"-"+g1+"-"+g2', 'ab-None-None'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
255 ('(a)+x', 'aaax', SUCCEED, 'found+"-"+g1', 'aaax-a'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
256 ('([ac])+x', 'aacx', SUCCEED, 'found+"-"+g1', 'aacx-c'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
257 ('([^/]*/)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', SUCCEED, 'found+"-"+g1', 'd:msgs/tdir/sub1/-tdir/'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
258 ('([^.]*)\\.([^:]*):[T ]+(.*)', 'track1.title:TBlah blah blah', SUCCEED, 'found+"-"+g1+"-"+g2+"-"+g3', 'track1.title:TBlah blah blah-track1-title-Blah blah blah'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
259 ('([^N]*N)+', 'abNNxyzN', SUCCEED, 'found+"-"+g1', 'abNNxyzN-xyzN'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
260 ('([^N]*N)+', 'abNNxyz', SUCCEED, 'found+"-"+g1', 'abNN-N'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
261 ('([abc]*)x', 'abcx', SUCCEED, 'found+"-"+g1', 'abcx-abc'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
262 ('([abc]*)x', 'abc', FAIL),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
263 ('([xyz]*)x', 'abcx', SUCCEED, 'found+"-"+g1', 'x-'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
264 ('(a)+b|aac', 'aac', SUCCEED, 'found+"-"+g1', 'aac-None'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
265
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
266 # Test symbolic groups
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
267
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
268 ('(?P<i d>aaa)a', 'aaaa', SYNTAX_ERROR),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
269 ('(?P<id>aaa)a', 'aaaa', SUCCEED, 'found+"-"+id', 'aaaa-aaa'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
270 ('(?P<id>aa)(?P=id)', 'aaaa', SUCCEED, 'found+"-"+id', 'aaaa-aa'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
271 ('(?P<id>aa)(?P=xd)', 'aaaa', SYNTAX_ERROR),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
272
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
273 # Test octal escapes/memory references
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
274
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
275 ('\\1', 'a', SYNTAX_ERROR),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
276 ('\\09', chr(0) + '9', SUCCEED, 'found', chr(0) + '9'),
d79c4fbb1982 Jeffrey's version
Guido van Rossum <guido@python.org>
parents: 5792
diff changeset
277 ('\\141', 'a', SUCCEED, 'found', 'a'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
278 ('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', SUCCEED, 'found+"-"+g11', 'abcdefghijklk9-k'),
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
279
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
280 # All tests from Perl
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
281
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
282 ('abc', 'abc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
283 ('abc', 'xbc', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
284 ('abc', 'axc', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
285 ('abc', 'abx', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
286 ('abc', 'xabcy', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
287 ('abc', 'ababc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
288 ('ab*c', 'abc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
289 ('ab*bc', 'abc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
290 ('ab*bc', 'abbc', SUCCEED, 'found', 'abbc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
291 ('ab*bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
292 ('ab{0,}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
293 ('ab+bc', 'abbc', SUCCEED, 'found', 'abbc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
294 ('ab+bc', 'abc', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
295 ('ab+bc', 'abq', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
296 ('ab{1,}bc', 'abq', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
297 ('ab+bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
298 ('ab{1,}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
299 ('ab{1,3}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
300 ('ab{3,4}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
301 ('ab{4,5}bc', 'abbbbc', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
302 ('ab?bc', 'abbc', SUCCEED, 'found', 'abbc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
303 ('ab?bc', 'abc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
304 ('ab{0,1}bc', 'abc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
305 ('ab?bc', 'abbbbc', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
306 ('ab?c', 'abc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
307 ('ab{0,1}c', 'abc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
308 ('^abc$', 'abc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
309 ('^abc$', 'abcc', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
310 ('^abc', 'abcc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
311 ('^abc$', 'aabc', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
312 ('abc$', 'aabc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
313 ('^', 'abc', SUCCEED, 'found', ''),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
314 ('$', 'abc', SUCCEED, 'found', ''),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
315 ('a.c', 'abc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
316 ('a.c', 'axc', SUCCEED, 'found', 'axc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
317 ('a.*c', 'axyzc', SUCCEED, 'found', 'axyzc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
318 ('a.*c', 'axyzd', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
319 ('a[bc]d', 'abc', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
320 ('a[bc]d', 'abd', SUCCEED, 'found', 'abd'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
321 ('a[b-d]e', 'abd', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
322 ('a[b-d]e', 'ace', SUCCEED, 'found', 'ace'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
323 ('a[b-d]', 'aac', SUCCEED, 'found', 'ac'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
324 ('a[-b]', 'a-', SUCCEED, 'found', 'a-'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
325 ('a[b-]', 'a-', SUCCEED, 'found', 'a-'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
326 ('a[b-a]', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
327 ('a[]b', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
328 ('a[', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
329 ('a]', 'a]', SUCCEED, 'found', 'a]'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
330 ('a[]]b', 'a]b', SUCCEED, 'found', 'a]b'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
331 ('a[^bc]d', 'aed', SUCCEED, 'found', 'aed'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
332 ('a[^bc]d', 'abd', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
333 ('a[^-b]c', 'adc', SUCCEED, 'found', 'adc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
334 ('a[^-b]c', 'a-c', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
335 ('a[^]b]c', 'a]c', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
336 ('a[^]b]c', 'adc', SUCCEED, 'found', 'adc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
337 ('ab|cd', 'abc', SUCCEED, 'found', 'ab'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
338 ('ab|cd', 'abcd', SUCCEED, 'found', 'ab'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
339 ('()ef', 'def', SUCCEED, 'found+"-"+g1', 'ef-'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
340 ('*a', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
341 ('(*)b', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
342 ('$b', 'b', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
343 ('a\\', '-', SYNTAX_ERROR),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
344 ('a\\(b', 'a(b', SUCCEED, 'found+"-"+g1', 'a(b-Error'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
345 ('a\\(*b', 'ab', SUCCEED, 'found', 'ab'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
346 ('a\\(*b', 'a((b', SUCCEED, 'found', 'a((b'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
347 ('a\\\\b', 'a\\b', SUCCEED, 'found', 'a\\b'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
348 ('abc)', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
349 ('(abc', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
350 ('((a))', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'a-a-a'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
351 ('(a)b(c)', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'abc-a-c'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
352 ('a+b+c', 'aabbabc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
353 ('a{1,}b{1,}c', 'aabbabc', SUCCEED, 'found', 'abc'),
5822
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
354 ('a**', '-', SYNTAX_ERROR),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
355 ('a.+?c', 'abcabc', SUCCEED, 'found', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
356 ('(a+|b)*', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
357 ('(a+|b){0,}', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
358 ('(a+|b)+', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
359 ('(a+|b){1,}', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
360 ('(a+|b)?', 'ab', SUCCEED, 'found+"-"+g1', 'a-a'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
361 ('(a+|b){0,1}', 'ab', SUCCEED, 'found+"-"+g1', 'a-a'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
362 (')(', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
363 ('[^ab]*', 'cde', SUCCEED, 'found', 'cde'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
364 ('abc', '', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
365 ('a*', '', SUCCEED, 'found', ''),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
366 ('([abc])*d', 'abbbcd', SUCCEED, 'found+"-"+g1', 'abbbcd-c'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
367 ('([abc])*bcd', 'abcd', SUCCEED, 'found+"-"+g1', 'abcd-a'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
368 ('a|b|c|d|e', 'e', SUCCEED, 'found', 'e'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
369 ('(a|b|c|d|e)f', 'ef', SUCCEED, 'found+"-"+g1', 'ef-e'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
370 ('abcd*efg', 'abcdefg', SUCCEED, 'found', 'abcdefg'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
371 ('ab*', 'xabyabbbz', SUCCEED, 'found', 'ab'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
372 ('ab*', 'xayabbbz', SUCCEED, 'found', 'a'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
373 ('(ab|cd)e', 'abcde', SUCCEED, 'found+"-"+g1', 'cde-cd'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
374 ('[abhgefdc]ij', 'hij', SUCCEED, 'found', 'hij'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
375 ('^(ab|cd)e', 'abcde', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
376 ('(abc|)ef', 'abcdef', SUCCEED, 'found+"-"+g1', 'ef-'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
377 ('(a|b)c*d', 'abcd', SUCCEED, 'found+"-"+g1', 'bcd-b'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
378 ('(ab|ab*)bc', 'abc', SUCCEED, 'found+"-"+g1', 'abc-a'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
379 ('a([bc]*)c*', 'abc', SUCCEED, 'found+"-"+g1', 'abc-bc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
380 ('a([bc]*)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
381 ('a([bc]+)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
382 ('a([bc]*)(c+d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-b-cd'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
383 ('a[bcd]*dcdcde', 'adcdcde', SUCCEED, 'found', 'adcdcde'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
384 ('a[bcd]+dcdcde', 'adcdcde', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
385 ('(ab|a)b*c', 'abc', SUCCEED, 'found+"-"+g1', 'abc-ab'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
386 ('((a)(b)c)(d)', 'abcd', SUCCEED, 'g1+"-"+g2+"-"+g3+"-"+g4', 'abc-a-b-d'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
387 ('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', SUCCEED, 'found', 'alpha'),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
388 ('^a(bc+|b[eh])g|.h$', 'abh', SUCCEED, 'found+"-"+g1', 'bh-None'),
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
389 ('(bc+d$|ef*g.|h?i(j|k))', 'effgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
390 ('(bc+d$|ef*g.|h?i(j|k))', 'ij', SUCCEED, 'found+"-"+g1+"-"+g2', 'ij-ij-j'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
391 ('(bc+d$|ef*g.|h?i(j|k))', 'effg', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
392 ('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', FAIL),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
393 ('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
394 ('((((((((((a))))))))))', 'a', SUCCEED, 'g10', 'a'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
395 ('((((((((((a))))))))))\\10', 'aa', SUCCEED, 'found', 'aa'),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
396 # Python does not have the same rules for \\41 so this is a syntax error
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
397 # ('((((((((((a))))))))))\\41', 'aa', FAIL),
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
398 # ('((((((((((a))))))))))\\41', 'a!', SUCCEED, 'found', 'a!'),
5822
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
399 ('((((((((((a))))))))))\\41', '', SYNTAX_ERROR),
6004
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
400 ('(?i)((((((((((a))))))))))\\41', '', SYNTAX_ERROR),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
401 ('(((((((((a)))))))))', 'a', SUCCEED, 'found', 'a'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
402 ('multiple words of text', 'uh-uh', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
403 ('multiple words', 'multiple words, yeah', SUCCEED, 'found', 'multiple words'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
404 ('(.*)c(.*)', 'abcde', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcde-ab-de'),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
405 ('\\((.*), (.*)\\)', '(a, b)', SUCCEED, 'g2+"-"+g1', 'b-a'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
406 ('[k]', 'ab', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
407 ('a[-]?c', 'ac', SUCCEED, 'found', 'ac'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
408 ('(abc)\\1', 'abcabc', SUCCEED, 'g1', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
409 ('([a-c]*)\\1', 'abcabc', SUCCEED, 'g1', 'abc'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
410 ('(?i)abc', 'ABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
411 ('(?i)abc', 'XBC', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
412 ('(?i)abc', 'AXC', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
413 ('(?i)abc', 'ABX', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
414 ('(?i)abc', 'XABCY', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
415 ('(?i)abc', 'ABABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
416 ('(?i)ab*c', 'ABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
417 ('(?i)ab*bc', 'ABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
418 ('(?i)ab*bc', 'ABBC', SUCCEED, 'found', 'ABBC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
419 ('(?i)ab*?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
420 ('(?i)ab{0,}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
421 ('(?i)ab+?bc', 'ABBC', SUCCEED, 'found', 'ABBC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
422 ('(?i)ab+bc', 'ABC', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
423 ('(?i)ab+bc', 'ABQ', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
424 ('(?i)ab{1,}bc', 'ABQ', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
425 ('(?i)ab+bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
426 ('(?i)ab{1,}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
427 ('(?i)ab{1,3}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
428 ('(?i)ab{3,4}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
429 ('(?i)ab{4,5}?bc', 'ABBBBC', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
430 ('(?i)ab??bc', 'ABBC', SUCCEED, 'found', 'ABBC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
431 ('(?i)ab??bc', 'ABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
432 ('(?i)ab{0,1}?bc', 'ABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
433 ('(?i)ab??bc', 'ABBBBC', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
434 ('(?i)ab??c', 'ABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
435 ('(?i)ab{0,1}?c', 'ABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
436 ('(?i)^abc$', 'ABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
437 ('(?i)^abc$', 'ABCC', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
438 ('(?i)^abc', 'ABCC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
439 ('(?i)^abc$', 'AABC', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
440 ('(?i)abc$', 'AABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
441 ('(?i)^', 'ABC', SUCCEED, 'found', ''),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
442 ('(?i)$', 'ABC', SUCCEED, 'found', ''),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
443 ('(?i)a.c', 'ABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
444 ('(?i)a.c', 'AXC', SUCCEED, 'found', 'AXC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
445 ('(?i)a.*?c', 'AXYZC', SUCCEED, 'found', 'AXYZC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
446 ('(?i)a.*c', 'AXYZD', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
447 ('(?i)a[bc]d', 'ABC', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
448 ('(?i)a[bc]d', 'ABD', SUCCEED, 'found', 'ABD'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
449 ('(?i)a[b-d]e', 'ABD', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
450 ('(?i)a[b-d]e', 'ACE', SUCCEED, 'found', 'ACE'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
451 ('(?i)a[b-d]', 'AAC', SUCCEED, 'found', 'AC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
452 ('(?i)a[-b]', 'A-', SUCCEED, 'found', 'A-'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
453 ('(?i)a[b-]', 'A-', SUCCEED, 'found', 'A-'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
454 ('(?i)a[b-a]', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
455 ('(?i)a[]b', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
456 ('(?i)a[', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
457 ('(?i)a]', 'A]', SUCCEED, 'found', 'A]'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
458 ('(?i)a[]]b', 'A]B', SUCCEED, 'found', 'A]B'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
459 ('(?i)a[^bc]d', 'AED', SUCCEED, 'found', 'AED'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
460 ('(?i)a[^bc]d', 'ABD', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
461 ('(?i)a[^-b]c', 'ADC', SUCCEED, 'found', 'ADC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
462 ('(?i)a[^-b]c', 'A-C', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
463 ('(?i)a[^]b]c', 'A]C', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
464 ('(?i)a[^]b]c', 'ADC', SUCCEED, 'found', 'ADC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
465 ('(?i)ab|cd', 'ABC', SUCCEED, 'found', 'AB'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
466 ('(?i)ab|cd', 'ABCD', SUCCEED, 'found', 'AB'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
467 ('(?i)()ef', 'DEF', SUCCEED, 'found+"-"+g1', 'EF-'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
468 ('(?i)*a', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
469 ('(?i)(*)b', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
470 ('(?i)$b', 'B', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
471 ('(?i)a\\', '-', SYNTAX_ERROR),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
472 ('(?i)a\\(b', 'A(B', SUCCEED, 'found+"-"+g1', 'A(B-Error'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
473 ('(?i)a\\(*b', 'AB', SUCCEED, 'found', 'AB'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
474 ('(?i)a\\(*b', 'A((B', SUCCEED, 'found', 'A((B'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
475 ('(?i)a\\\\b', 'A\\B', SUCCEED, 'found', 'A\\B'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
476 ('(?i)abc)', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
477 ('(?i)(abc', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
478 ('(?i)((a))', 'ABC', SUCCEED, 'found+"-"+g1+"-"+g2', 'A-A-A'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
479 ('(?i)(a)b(c)', 'ABC', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABC-A-C'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
480 ('(?i)a+b+c', 'AABBABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
481 ('(?i)a{1,}b{1,}c', 'AABBABC', SUCCEED, 'found', 'ABC'),
5822
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
482 ('(?i)a**', '-', SYNTAX_ERROR),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
483 ('(?i)a.+?c', 'ABCABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
484 ('(?i)a.*?c', 'ABCABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
485 ('(?i)a.{0,5}?c', 'ABCABC', SUCCEED, 'found', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
486 ('(?i)(a+|b)*', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
487 ('(?i)(a+|b){0,}', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
488 ('(?i)(a+|b)+', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
489 ('(?i)(a+|b){1,}', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
490 ('(?i)(a+|b)?', 'AB', SUCCEED, 'found+"-"+g1', 'A-A'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
491 ('(?i)(a+|b){0,1}', 'AB', SUCCEED, 'found+"-"+g1', 'A-A'),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
492 ('(?i)(a+|b){0,1}?', 'AB', SUCCEED, 'found+"-"+g1', '-None'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
493 ('(?i))(', '-', SYNTAX_ERROR),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
494 ('(?i)[^ab]*', 'CDE', SUCCEED, 'found', 'CDE'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
495 ('(?i)abc', '', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
496 ('(?i)a*', '', SUCCEED, 'found', ''),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
497 ('(?i)([abc])*d', 'ABBBCD', SUCCEED, 'found+"-"+g1', 'ABBBCD-C'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
498 ('(?i)([abc])*bcd', 'ABCD', SUCCEED, 'found+"-"+g1', 'ABCD-A'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
499 ('(?i)a|b|c|d|e', 'E', SUCCEED, 'found', 'E'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
500 ('(?i)(a|b|c|d|e)f', 'EF', SUCCEED, 'found+"-"+g1', 'EF-E'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
501 ('(?i)abcd*efg', 'ABCDEFG', SUCCEED, 'found', 'ABCDEFG'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
502 ('(?i)ab*', 'XABYABBBZ', SUCCEED, 'found', 'AB'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
503 ('(?i)ab*', 'XAYABBBZ', SUCCEED, 'found', 'A'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
504 ('(?i)(ab|cd)e', 'ABCDE', SUCCEED, 'found+"-"+g1', 'CDE-CD'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
505 ('(?i)[abhgefdc]ij', 'HIJ', SUCCEED, 'found', 'HIJ'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
506 ('(?i)^(ab|cd)e', 'ABCDE', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
507 ('(?i)(abc|)ef', 'ABCDEF', SUCCEED, 'found+"-"+g1', 'EF-'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
508 ('(?i)(a|b)c*d', 'ABCD', SUCCEED, 'found+"-"+g1', 'BCD-B'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
509 ('(?i)(ab|ab*)bc', 'ABC', SUCCEED, 'found+"-"+g1', 'ABC-A'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
510 ('(?i)a([bc]*)c*', 'ABC', SUCCEED, 'found+"-"+g1', 'ABC-BC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
511 ('(?i)a([bc]*)(c*d)', 'ABCD', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCD-BC-D'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
512 ('(?i)a([bc]+)(c*d)', 'ABCD', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCD-BC-D'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
513 ('(?i)a([bc]*)(c+d)', 'ABCD', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCD-B-CD'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
514 ('(?i)a[bcd]*dcdcde', 'ADCDCDE', SUCCEED, 'found', 'ADCDCDE'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
515 ('(?i)a[bcd]+dcdcde', 'ADCDCDE', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
516 ('(?i)(ab|a)b*c', 'ABC', SUCCEED, 'found+"-"+g1', 'ABC-AB'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
517 ('(?i)((a)(b)c)(d)', 'ABCD', SUCCEED, 'g1+"-"+g2+"-"+g3+"-"+g4', 'ABC-A-B-D'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
518 ('(?i)[a-zA-Z_][a-zA-Z0-9_]*', 'ALPHA', SUCCEED, 'found', 'ALPHA'),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
519 ('(?i)^a(bc+|b[eh])g|.h$', 'ABH', SUCCEED, 'found+"-"+g1', 'BH-None'),
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
520 ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'EFFGZ', SUCCEED, 'found+"-"+g1+"-"+g2', 'EFFGZ-EFFGZ-None'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
521 ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'IJ', SUCCEED, 'found+"-"+g1+"-"+g2', 'IJ-IJ-J'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
522 ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'EFFG', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
523 ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'BCDD', FAIL),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
524 ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'REFFGZ', SUCCEED, 'found+"-"+g1+"-"+g2', 'EFFGZ-EFFGZ-None'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
525 ('(?i)((((((((((a))))))))))', 'A', SUCCEED, 'g10', 'A'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
526 ('(?i)((((((((((a))))))))))\\10', 'AA', SUCCEED, 'found', 'AA'),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
527 #('(?i)((((((((((a))))))))))\\41', 'AA', FAIL),
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
528 #('(?i)((((((((((a))))))))))\\41', 'A!', SUCCEED, 'found', 'A!'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
529 ('(?i)(((((((((a)))))))))', 'A', SUCCEED, 'found', 'A'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
530 ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))', 'A', SUCCEED, 'g1', 'A'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
531 ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))', 'C', SUCCEED, 'g1', 'C'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
532 ('(?i)multiple words of text', 'UH-UH', FAIL),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
533 ('(?i)multiple words', 'MULTIPLE WORDS, YEAH', SUCCEED, 'found', 'MULTIPLE WORDS'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
534 ('(?i)(.*)c(.*)', 'ABCDE', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCDE-AB-DE'),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
535 ('(?i)\\((.*), (.*)\\)', '(A, B)', SUCCEED, 'g2+"-"+g1', 'B-A'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
536 ('(?i)[k]', 'AB', FAIL),
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
537 # ('(?i)abcd', 'ABCD', SUCCEED, 'found+"-"+\\found+"-"+\\\\found', 'ABCD-$&-\\ABCD'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
538 # ('(?i)a(bc)d', 'ABCD', SUCCEED, 'g1+"-"+\\g1+"-"+\\\\g1', 'BC-$1-\\BC'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
539 ('(?i)a[-]?c', 'AC', SUCCEED, 'found', 'AC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
540 ('(?i)(abc)\\1', 'ABCABC', SUCCEED, 'g1', 'ABC'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
541 ('(?i)([a-c]*)\\1', 'ABCABC', SUCCEED, 'g1', 'ABC'),
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
542 ('a(?!b).', 'abad', SUCCEED, 'found', 'ad'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
543 ('a(?=d).', 'abad', SUCCEED, 'found', 'ad'),
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
544 ('a(?=c|d).', 'abad', SUCCEED, 'found', 'ad'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
545 ('a(?:b|c|d)(.)', 'ace', SUCCEED, 'g1', 'e'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
546 ('a(?:b|c|d)*(.)', 'ace', SUCCEED, 'g1', 'e'),
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
547 ('a(?:b|c|d)+?(.)', 'ace', SUCCEED, 'g1', 'e'),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
548 ('a(?:b|(c|e){1,2}?|d)+?(.)', 'ace', SUCCEED, 'g1 + g2', 'ce'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
549 ('^(.+)?B', 'AB', SUCCEED, 'g1', 'A'),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
550
27859
e7cd0861c273 SF patch #682432, add lookbehind tests
Neal Norwitz <nnorwitz@gmail.com>
parents: 26074
diff changeset
551 # lookbehind: split by : but not if it is escaped by -.
e7cd0861c273 SF patch #682432, add lookbehind tests
Neal Norwitz <nnorwitz@gmail.com>
parents: 26074
diff changeset
552 ('(?<!-):(.*?)(?<!-):', 'a:bc-:de:f', SUCCEED, 'g1', 'bc-:de' ),
e7cd0861c273 SF patch #682432, add lookbehind tests
Neal Norwitz <nnorwitz@gmail.com>
parents: 26074
diff changeset
553 # escaping with \ as we know it
e7cd0861c273 SF patch #682432, add lookbehind tests
Neal Norwitz <nnorwitz@gmail.com>
parents: 26074
diff changeset
554 ('(?<!\\\):(.*?)(?<!\\\):', 'a:bc\\:de:f', SUCCEED, 'g1', 'bc\\:de' ),
e7cd0861c273 SF patch #682432, add lookbehind tests
Neal Norwitz <nnorwitz@gmail.com>
parents: 26074
diff changeset
555 # terminating with ' and escaping with ? as in edifact
27963
226463445697 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 27859
diff changeset
556 ("(?<!\\?)'(.*?)(?<!\\?)'", "a'bc?'de'f", SUCCEED, 'g1', "bc?'de" ),
27859
e7cd0861c273 SF patch #682432, add lookbehind tests
Neal Norwitz <nnorwitz@gmail.com>
parents: 26074
diff changeset
557
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
558 # Comments using the (?#...) syntax
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
559
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
560 ('w(?# comment', 'w', SYNTAX_ERROR),
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
561 ('w(?# comment 1)xy(?# comment 2)z', 'wxyz', SUCCEED, 'found', 'wxyz'),
5822
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
562
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
563 # Check odd placement of embedded pattern modifiers
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
564
14316
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
565 # not an error under PCRE/PRE:
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
566 ('w(?i)', 'W', SUCCEED, 'found', 'W'),
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
567 # ('w(?i)', 'W', SYNTAX_ERROR),
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
568
5822
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
569 # Comments using the x embedded pattern modifier
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
570
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
571 ("""(?x)w# comment 1
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
572 x y
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
573 # comment 2
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
574 z""", 'wxyz', SUCCEED, 'found', 'wxyz'),
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
575
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
576 # using the m embedded pattern modifier
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
577
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
578 ('^abc', """jkl
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
579 abc
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
580 xyz""", FAIL),
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
581 ('(?m)^abc', """jkl
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
582 abc
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
583 xyz""", SUCCEED, 'found', 'abc'),
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
584
5822
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
585 ('(?m)abc$', """jkl
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
586 xyzabc
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
587 123""", SUCCEED, 'found', 'abc'),
13896
e2ea00620ed6 -- whitespace cleanup (real changes coming in next checkin)
Fredrik Lundh <fredrik@pythonware.com>
parents: 7852
diff changeset
588
5805
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
589 # using the s embedded pattern modifier
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
590
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
591 ('a.b', 'a\nb', FAIL),
518d4f0c8fcc Jeffrey's latest -- seems to solve most problems!
Guido van Rossum <guido@python.org>
parents: 5798
diff changeset
592 ('(?s)a.b', 'a\nb', SUCCEED, 'found', 'a\nb'),
5822
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
593
6004
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
594 # test \w, etc. both inside and outside character classes
5822
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
595
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
596 ('\\w+', '--ab_cd0123--', SUCCEED, 'found', 'ab_cd0123'),
6004
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
597 ('[\\w]+', '--ab_cd0123--', SUCCEED, 'found', 'ab_cd0123'),
5822
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
598 ('\\D+', '1234abc5678', SUCCEED, 'found', 'abc'),
6004
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
599 ('[\\D]+', '1234abc5678', SUCCEED, 'found', 'abc'),
5822
d3f2df8c2286 Several additions from Jeffrey.
Guido van Rossum <guido@python.org>
parents: 5805
diff changeset
600 ('[\\da-fA-F]+', '123abc', SUCCEED, 'found', '123abc'),
14316
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
601 # not an error under PCRE/PRE:
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
602 # ('[\\d-x]', '-', SYNTAX_ERROR),
6004
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
603 (r'([\s]*)([\S]*)([\s]*)', ' testing!1972', SUCCEED, 'g3+g2+g1', 'testing!1972 '),
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
604 (r'(\s*)(\S*)(\s*)', ' testing!1972', SUCCEED, 'g3+g2+g1', 'testing!1972 '),
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
605
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
606 (r'\xff', '\377', SUCCEED, 'found', chr(255)),
14316
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
607 # new \x semantics
15888
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
608 (r'\x00ff', '\377', FAIL),
14316
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
609 # (r'\x00ff', '\377', SUCCEED, 'found', chr(255)),
6004
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
610 (r'\t\n\v\r\f\a\g', '\t\n\v\r\f\ag', SUCCEED, 'found', '\t\n\v\r\f\ag'),
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
611 ('\t\n\v\r\f\a\g', '\t\n\v\r\f\ag', SUCCEED, 'found', '\t\n\v\r\f\ag'),
3f59b34eb90f 1.5a3 prerelease 1 from AMK
Guido van Rossum <guido@python.org>
parents: 5822
diff changeset
612 (r'\t\n\v\r\f\a', '\t\n\v\r\f\a', SUCCEED, 'found', chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7)),
6777
daa77d9af34c New re version from AMK
Guido van Rossum <guido@python.org>
parents: 6067
diff changeset
613 (r'[\t][\n][\v][\r][\f][\b]', '\t\n\v\r\f\b', SUCCEED, 'found', '\t\n\v\r\f\b'),
13897
0430a1309596 -- enabled some temporarily disabled RE tests
Fredrik Lundh <fredrik@pythonware.com>
parents: 13896
diff changeset
614
14316
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
615 #
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
616 # post-1.5.2 additions
13897
0430a1309596 -- enabled some temporarily disabled RE tests
Fredrik Lundh <fredrik@pythonware.com>
parents: 13896
diff changeset
617
0430a1309596 -- enabled some temporarily disabled RE tests
Fredrik Lundh <fredrik@pythonware.com>
parents: 13896
diff changeset
618 # xmllib problem
0430a1309596 -- enabled some temporarily disabled RE tests
Fredrik Lundh <fredrik@pythonware.com>
parents: 13896
diff changeset
619 (r'(([a-z]+):)?([a-z]+)$', 'smil', SUCCEED, 'g1+"-"+g2+"-"+g3', 'None-None-smil'),
15888
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
620 # bug 110866: reference to undefined group
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
621 (r'((.)\1+)', '', SYNTAX_ERROR),
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
622 # bug 111869: search (PRE/PCRE fails on this one, SRE doesn't)
14316
511123dd8424 closes bug #112468 (and all the other bugs that surfaced when
Fredrik Lundh <fredrik@pythonware.com>
parents: 13897
diff changeset
623 (r'.*d', 'abc\nabd', SUCCEED, 'found', 'abd'),
14999
1a3b5c8d6730 Recompile pattern if (?x) flag was found inside the pattern during the
Fredrik Lundh <fredrik@pythonware.com>
parents: 14992
diff changeset
624 # bug 112468: various expected syntax errors
15888
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
625 (r'(', '', SYNTAX_ERROR),
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
626 (r'[\41]', '!', SUCCEED, 'found', '!'),
15091
41c42b1bd582 Fixed too ambitious "nothing to repeat" check. Closes bug #114033.
Fredrik Lundh <fredrik@pythonware.com>
parents: 15083
diff changeset
627 # bug 114033: nothing to repeat
41c42b1bd582 Fixed too ambitious "nothing to repeat" check. Closes bug #114033.
Fredrik Lundh <fredrik@pythonware.com>
parents: 15083
diff changeset
628 (r'(x?)?', 'x', SUCCEED, 'found', 'x'),
14999
1a3b5c8d6730 Recompile pattern if (?x) flag was found inside the pattern during the
Fredrik Lundh <fredrik@pythonware.com>
parents: 14992
diff changeset
629 # bug 115040: rescan if flags are modified inside pattern
1a3b5c8d6730 Recompile pattern if (?x) flag was found inside the pattern during the
Fredrik Lundh <fredrik@pythonware.com>
parents: 14992
diff changeset
630 (r' (?x)foo ', 'foo', SUCCEED, 'found', 'foo'),
1a3b5c8d6730 Recompile pattern if (?x) flag was found inside the pattern during the
Fredrik Lundh <fredrik@pythonware.com>
parents: 14992
diff changeset
631 # bug 115618: negative lookahead
14992
4c4934ca8579 Fixed negative lookahead/lookbehind. Closes bug #115618.
Fredrik Lundh <fredrik@pythonware.com>
parents: 14797
diff changeset
632 (r'(?<!abc)(d.f)', 'abcdefdof', SUCCEED, 'found', 'dof'),
15083
02ad9cb52222 SRE didn't handle character category followed by hyphen inside a
Fredrik Lundh <fredrik@pythonware.com>
parents: 14999
diff changeset
633 # bug 116251: character class bug
02ad9cb52222 SRE didn't handle character category followed by hyphen inside a
Fredrik Lundh <fredrik@pythonware.com>
parents: 14999
diff changeset
634 (r'[\w-]+', 'laser_beam', SUCCEED, 'found', 'laser_beam'),
15888
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
635 # bug 123769+127259: non-greedy backtracking bug
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
636 (r'.*?\S *:', 'xx:', SUCCEED, 'found', 'xx:'),
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
637 (r'a[ ]*?\ (\d+).*', 'a 10', SUCCEED, 'found', 'a 10'),
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
638 (r'a[ ]*?\ (\d+).*', 'a 10', SUCCEED, 'found', 'a 10'),
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
639 # bug 127259: \Z shouldn't depend on multiline mode
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
640 (r'(?ms).*?x\s*\Z(.*)','xx\nx\n', SUCCEED, 'g1', ''),
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
641 # bug 128899: uppercase literals under the ignorecase flag
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
642 (r'(?i)M+', 'MMM', SUCCEED, 'found', 'MMM'),
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
643 (r'(?i)m+', 'MMM', SUCCEED, 'found', 'MMM'),
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
644 (r'(?i)[M]+', 'MMM', SUCCEED, 'found', 'MMM'),
b53206295bdf from the really-stupid-bug department: uppercase literals should match
Fredrik Lundh <fredrik@pythonware.com>
parents: 15091
diff changeset
645 (r'(?i)[m]+', 'MMM', SUCCEED, 'found', 'MMM'),
16665
de0e8752d5b7 detect attempts to repeat anchors (fixes bug #130748)
Fredrik Lundh <fredrik@pythonware.com>
parents: 15888
diff changeset
646 # bug 130748: ^* should be an error (nothing to repeat)
de0e8752d5b7 detect attempts to repeat anchors (fixes bug #130748)
Fredrik Lundh <fredrik@pythonware.com>
parents: 15888
diff changeset
647 (r'^*', '', SYNTAX_ERROR),
21319
4bcfb9dc57e0 bug #133283, #477728, #483789, #490573
Fredrik Lundh <fredrik@pythonware.com>
parents: 18369
diff changeset
648 # bug 133283: minimizing repeat problem
4bcfb9dc57e0 bug #133283, #477728, #483789, #490573
Fredrik Lundh <fredrik@pythonware.com>
parents: 18369
diff changeset
649 (r'"(?:\\"|[^"])*?"', r'"\""', SUCCEED, 'found', r'"\""'),
4bcfb9dc57e0 bug #133283, #477728, #483789, #490573
Fredrik Lundh <fredrik@pythonware.com>
parents: 18369
diff changeset
650 # bug 477728: minimizing repeat problem
4bcfb9dc57e0 bug #133283, #477728, #483789, #490573
Fredrik Lundh <fredrik@pythonware.com>
parents: 18369
diff changeset
651 (r'^.*?$', 'one\ntwo\nthree\n', FAIL),
4bcfb9dc57e0 bug #133283, #477728, #483789, #490573
Fredrik Lundh <fredrik@pythonware.com>
parents: 18369
diff changeset
652 # bug 483789: minimizing repeat problem
4bcfb9dc57e0 bug #133283, #477728, #483789, #490573
Fredrik Lundh <fredrik@pythonware.com>
parents: 18369
diff changeset
653 (r'a[^>]*?b', 'a>b', FAIL),
4bcfb9dc57e0 bug #133283, #477728, #483789, #490573
Fredrik Lundh <fredrik@pythonware.com>
parents: 18369
diff changeset
654 # bug 490573: minimizing repeat problem
4bcfb9dc57e0 bug #133283, #477728, #483789, #490573
Fredrik Lundh <fredrik@pythonware.com>
parents: 18369
diff changeset
655 (r'^a*?$', 'foo', FAIL),
26074
d2be796c4b81 Fixed bug #470582, using a modified version of patch #527371,
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 21319
diff changeset
656 # bug 470582: nested groups problem
d2be796c4b81 Fixed bug #470582, using a modified version of patch #527371,
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 21319
diff changeset
657 (r'^((a)c)?(ab)$', 'ab', SUCCEED, 'g1+"-"+g2+"-"+g3', 'None-None-ab'),
28704
fa7874ec6a71 More work on bug #672491 and patch #712900.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 28041
diff changeset
658 # another minimizing repeat problem (capturing groups in assertions)
fa7874ec6a71 More work on bug #672491 and patch #712900.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 28041
diff changeset
659 ('^([ab]*?)(?=(b)?)c', 'abc', SUCCEED, 'g1+"-"+g2', 'ab-None'),
fa7874ec6a71 More work on bug #672491 and patch #712900.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 28041
diff changeset
660 ('^([ab]*?)(?!(b))c', 'abc', SUCCEED, 'g1+"-"+g2', 'ab-None'),
fa7874ec6a71 More work on bug #672491 and patch #712900.
Gustavo Niemeyer <gustavo@niemeyer.net>
parents: 28041
diff changeset
661 ('^([ab]*?)(?<!(a))c', 'abc', SUCCEED, 'g1+"-"+g2', 'ab-None'),
5795
3d1d8055087f Merged my changes in, and added all converted Perl tests.
Guido van Rossum <guido@python.org>
parents: 5794
diff changeset
662 ]
17144
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
663
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
664 try:
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
665 u = eval("u'\N{LATIN CAPITAL LETTER A WITH DIAERESIS}'")
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
666 except SyntaxError:
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
667 pass
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
668 else:
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
669 tests.extend([
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
670 # bug 410271: \b broken under locales
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
671 (r'\b.\b', 'a', SUCCEED, 'found', 'a'),
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
672 (r'(?u)\b.\b', u, SUCCEED, 'found', u),
28041
1b6538aa0959 Fix from SF patch #633359 by Greg Chapman for SF bug #610299:
Guido van Rossum <guido@python.org>
parents: 27963
diff changeset
673 (r'(?u)\w', u, SUCCEED, 'found', u),
17144
bbf5ea2a22e5 sre 2.1b2 update:
Fredrik Lundh <fredrik@pythonware.com>
parents: 16665
diff changeset
674 ])