summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-07-15 18:45:20 (GMT)
committerGuido van Rossum <guido@python.org>1997-07-15 18:45:20 (GMT)
commit16bd0ff16a324648faa0b9e38e233c18bf59633a (patch)
tree1d200e8c7a4bb7ef6197040d57bdf38b6e6646bf /Lib/test
parent337c6d41d4715a24d4082a5ac313c53ebcae7c25 (diff)
downloadcpython-16bd0ff16a324648faa0b9e38e233c18bf59633a.zip
cpython-16bd0ff16a324648faa0b9e38e233c18bf59633a.tar.gz
cpython-16bd0ff16a324648faa0b9e38e233c18bf59633a.tar.bz2
Merged my changes in, and added all converted Perl tests.
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/re_tests.py308
1 files changed, 284 insertions, 24 deletions
diff --git a/Lib/test/re_tests.py b/Lib/test/re_tests.py
index d3b3927..27b9230 100755
--- a/Lib/test/re_tests.py
+++ b/Lib/test/re_tests.py
@@ -20,7 +20,7 @@ benchmarks = [
('.*Python', 'Python'), # Bad text literal
('.*Python.*', 'Python'), # Worse text literal
('.*(Python)', 'Python'), # Bad text literal with grouping
-
+
('(Python|Perl|Tcl', 'Perl'), # Alternation
('(Python|Perl|Tcl)', 'Perl'), # Grouped alternation
('(Python)\\1', 'PythonPython'), # Backreference
@@ -38,8 +38,10 @@ benchmarks = [
# 3: a string that will be eval()'ed to produce a test string.
# This is an arbitrary Python expression; the available
# variables are "found" (the whole match), and "g1", "g2", ...
-# up to "g10" contain the contents of each group, or the
-# string 'None' if the group wasn't given a value.
+# up to "g99" contain the contents of each group, or the
+# string 'None' if the group wasn't given a value, or the
+# string 'Error' if the group index was out of range;
+# also "groups", the return value of m.group() (a tuple).
# 4: The expected result of evaluating the expression.
# If the two don't match, an error is reported.
#
@@ -80,11 +82,7 @@ tests = [
('a[b-d]e', 'abd', FAIL),
('a[b-d]e', 'ace', SUCCEED, 'found', 'ace'),
('a[b-d]', 'aac', SUCCEED, 'found', 'ac'),
-
-# In 're', the way to put a '-' in a set is to escape it: '[\-]'
-# ('a[-b]', 'a-', SUCCEED, 'found', 'a-'),
-
- ('a[-b]', 'a-', SYNTAX_ERROR),
+ ('a[-b]', 'a-', SUCCEED, 'found', 'a-'),
('a[\\-b]', 'a-', SUCCEED, 'found', 'a-'),
('a[b-]', 'a-', SYNTAX_ERROR),
('a[]b', '-', SYNTAX_ERROR),
@@ -93,17 +91,14 @@ tests = [
('abc)', '-', SYNTAX_ERROR),
('(abc', '-', SYNTAX_ERROR),
('a]', 'a]', SUCCEED, 'found', 'a]'),
-
-# In 're', the way to put a ']' in a set is to escape it: '[\]]'
-# ('a[]]b', 'a]b', SUCCEED, 'found', 'a]b'),
-
+ ('a[]]b', 'a]b', SUCCEED, 'found', 'a]b'),
('a[\]]b', 'a]b', SUCCEED, 'found', 'a]b'),
('a[^bc]d', 'aed', SUCCEED, 'found', 'aed'),
('a[^bc]d', 'abd', FAIL),
- ('a[^\\-b]c', 'adc', SUCCEED, 'found', 'adc'),
- ('a[^\\-b]c', 'a-c', FAIL),
- ('a[^\\]b]c', 'a]c', FAIL),
- ('a[^\\]b]c', 'adc', SUCCEED, 'found', 'adc'),
+ ('a[^-b]c', 'adc', SUCCEED, 'found', 'adc'),
+ ('a[^-b]c', 'a-c', FAIL),
+ ('a[^]b]c', 'a]c', FAIL),
+ ('a[^]b]c', 'adc', SUCCEED, 'found', 'adc'),
('\\ba\\b', 'a-', SUCCEED, '"-"', '-'),
('\\ba\\b', '-a', SUCCEED, '"-"', '-'),
('\\ba\\b', '-a-', SUCCEED, '"-"', '-'),
@@ -114,10 +109,7 @@ tests = [
('ab|cd', 'abcd', SUCCEED, 'found', 'ab'),
('()ef', 'def', SUCCEED, 'found+"-"+g1', 'ef-'),
('$b', 'b', FAIL),
-
-# This is an error in 1.5
-# ('a(b', 'a(b', SUCCEED, 'found+"-"+g1', 'a(b-None'),
-
+ ('a\\(b', 'a(b', SUCCEED, 'found+"-"+g1', 'a(b-Error'),
('a\\(*b', 'ab', SUCCEED, 'found', 'ab'),
('a\\(*b', 'a((b', SUCCEED, 'found', 'a((b'),
('a\\\\b', 'a\\b', SUCCEED, 'found', 'a\\b'),
@@ -138,8 +130,7 @@ tests = [
('ab*', 'xayabbbz', SUCCEED, 'found', 'a'),
('(ab|cd)e', 'abcde', SUCCEED, 'found+"-"+g1', 'cde-cd'),
('[abhgefdc]ij', 'hij', SUCCEED, 'found', 'hij'),
- ('^(ab|cd)e', 'abcde', FAIL,
- 'xg1y', 'xy'),
+ ('^(ab|cd)e', 'abcde', FAIL, 'xg1y', 'xy'),
('(abc|)ef', 'abcdef', SUCCEED, 'found+"-"+g1', 'ef-'),
('(a|b)c*d', 'abcd', SUCCEED, 'found+"-"+g1', 'bcd-b'),
('(ab|ab*)bc', 'abc', SUCCEED, 'found+"-"+g1', 'abc-a'),
@@ -205,6 +196,275 @@ tests = [
('\\1', 'a', SYNTAX_ERROR),
('\\09', chr(0) + '9', SUCCEED, 'found', chr(0) + '9'),
('\\141', 'a', SUCCEED, 'found', 'a'),
- ('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', SUCCEED, 'found+"-"+g11', 'abcdefghijklk9-k')
+ ('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', SUCCEED, 'found+"-"+g11', 'abcdefghijklk9-k'),
- ]
+ # All tests from Perl
+
+ ('abc', 'abc', SUCCEED, 'found', 'abc'),
+ ('abc', 'xbc', FAIL),
+ ('abc', 'axc', FAIL),
+ ('abc', 'abx', FAIL),
+ ('abc', 'xabcy', SUCCEED, 'found', 'abc'),
+ ('abc', 'ababc', SUCCEED, 'found', 'abc'),
+ ('ab*c', 'abc', SUCCEED, 'found', 'abc'),
+ ('ab*bc', 'abc', SUCCEED, 'found', 'abc'),
+ ('ab*bc', 'abbc', SUCCEED, 'found', 'abbc'),
+ ('ab*bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
+ ('ab{0,}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
+ ('ab+bc', 'abbc', SUCCEED, 'found', 'abbc'),
+ ('ab+bc', 'abc', FAIL),
+ ('ab+bc', 'abq', FAIL),
+ ('ab{1,}bc', 'abq', FAIL),
+ ('ab+bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
+ ('ab{1,}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
+ ('ab{1,3}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
+ ('ab{3,4}bc', 'abbbbc', SUCCEED, 'found', 'abbbbc'),
+ ('ab{4,5}bc', 'abbbbc', FAIL),
+ ('ab?bc', 'abbc', SUCCEED, 'found', 'abbc'),
+ ('ab?bc', 'abc', SUCCEED, 'found', 'abc'),
+ ('ab{0,1}bc', 'abc', SUCCEED, 'found', 'abc'),
+ ('ab?bc', 'abbbbc', FAIL),
+ ('ab?c', 'abc', SUCCEED, 'found', 'abc'),
+ ('ab{0,1}c', 'abc', SUCCEED, 'found', 'abc'),
+ ('^abc$', 'abc', SUCCEED, 'found', 'abc'),
+ ('^abc$', 'abcc', FAIL),
+ ('^abc', 'abcc', SUCCEED, 'found', 'abc'),
+ ('^abc$', 'aabc', FAIL),
+ ('abc$', 'aabc', SUCCEED, 'found', 'abc'),
+ ('^', 'abc', SUCCEED, 'found', ''),
+ ('$', 'abc', SUCCEED, 'found', ''),
+ ('a.c', 'abc', SUCCEED, 'found', 'abc'),
+ ('a.c', 'axc', SUCCEED, 'found', 'axc'),
+ ('a.*c', 'axyzc', SUCCEED, 'found', 'axyzc'),
+ ('a.*c', 'axyzd', FAIL),
+ ('a[bc]d', 'abc', FAIL),
+ ('a[bc]d', 'abd', SUCCEED, 'found', 'abd'),
+ ('a[b-d]e', 'abd', FAIL),
+ ('a[b-d]e', 'ace', SUCCEED, 'found', 'ace'),
+ ('a[b-d]', 'aac', SUCCEED, 'found', 'ac'),
+ ('a[-b]', 'a-', SUCCEED, 'found', 'a-'),
+ ('a[b-]', 'a-', SUCCEED, 'found', 'a-'),
+ ('a[b-a]', '-', SYNTAX_ERROR),
+ ('a[]b', '-', SYNTAX_ERROR),
+ ('a[', '-', SYNTAX_ERROR),
+ ('a]', 'a]', SUCCEED, 'found', 'a]'),
+ ('a[]]b', 'a]b', SUCCEED, 'found', 'a]b'),
+ ('a[^bc]d', 'aed', SUCCEED, 'found', 'aed'),
+ ('a[^bc]d', 'abd', FAIL),
+ ('a[^-b]c', 'adc', SUCCEED, 'found', 'adc'),
+ ('a[^-b]c', 'a-c', FAIL),
+ ('a[^]b]c', 'a]c', FAIL),
+ ('a[^]b]c', 'adc', SUCCEED, 'found', 'adc'),
+ ('ab|cd', 'abc', SUCCEED, 'found', 'ab'),
+ ('ab|cd', 'abcd', SUCCEED, 'found', 'ab'),
+ ('()ef', 'def', SUCCEED, 'found+"-"+g1', 'ef-'),
+ ('*a', '-', SYNTAX_ERROR),
+ ('(*)b', '-', SYNTAX_ERROR),
+ ('$b', 'b', FAIL),
+ ('a\\', '-', SYNTAX_ERROR),
+ ('a\\(b', 'a(b', SUCCEED, 'found+"-"+g1', 'a(b-'),
+ ('a\\(*b', 'ab', SUCCEED, 'found', 'ab'),
+ ('a\\(*b', 'a((b', SUCCEED, 'found', 'a((b'),
+ ('a\\\\b', 'a\\b', SUCCEED, 'found', 'a\\b'),
+ ('abc)', '-', SYNTAX_ERROR),
+ ('(abc', '-', SYNTAX_ERROR),
+ ('((a))', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'a-a-a'),
+ ('(a)b(c)', 'abc', SUCCEED, 'found+"-"+g1+"-"+g2', 'abc-a-c'),
+ ('a+b+c', 'aabbabc', SUCCEED, 'found', 'abc'),
+ ('a{1,}b{1,}c', 'aabbabc', SUCCEED, 'found', 'abc'),
+ #('a**', '-', SYNTAX_ERROR),
+ ('a.+?c', 'abcabc', SUCCEED, 'found', 'abc'),
+ ('(a+|b)*', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
+ ('(a+|b){0,}', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
+ ('(a+|b)+', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
+ ('(a+|b){1,}', 'ab', SUCCEED, 'found+"-"+g1', 'ab-b'),
+ ('(a+|b)?', 'ab', SUCCEED, 'found+"-"+g1', 'a-a'),
+ ('(a+|b){0,1}', 'ab', SUCCEED, 'found+"-"+g1', 'a-a'),
+ (')(', '-', SYNTAX_ERROR),
+ ('[^ab]*', 'cde', SUCCEED, 'found', 'cde'),
+ ('abc', '', FAIL),
+ ('a*', '', SUCCEED, 'found', ''),
+ ('([abc])*d', 'abbbcd', SUCCEED, 'found+"-"+g1', 'abbbcd-c'),
+ ('([abc])*bcd', 'abcd', SUCCEED, 'found+"-"+g1', 'abcd-a'),
+ ('a|b|c|d|e', 'e', SUCCEED, 'found', 'e'),
+ ('(a|b|c|d|e)f', 'ef', SUCCEED, 'found+"-"+g1', 'ef-e'),
+ ('abcd*efg', 'abcdefg', SUCCEED, 'found', 'abcdefg'),
+ ('ab*', 'xabyabbbz', SUCCEED, 'found', 'ab'),
+ ('ab*', 'xayabbbz', SUCCEED, 'found', 'a'),
+ ('(ab|cd)e', 'abcde', SUCCEED, 'found+"-"+g1', 'cde-cd'),
+ ('[abhgefdc]ij', 'hij', SUCCEED, 'found', 'hij'),
+ ('^(ab|cd)e', 'abcde', FAIL),
+ ('(abc|)ef', 'abcdef', SUCCEED, 'found+"-"+g1', 'ef-'),
+ ('(a|b)c*d', 'abcd', SUCCEED, 'found+"-"+g1', 'bcd-b'),
+ ('(ab|ab*)bc', 'abc', SUCCEED, 'found+"-"+g1', 'abc-a'),
+ ('a([bc]*)c*', 'abc', SUCCEED, 'found+"-"+g1', 'abc-bc'),
+ ('a([bc]*)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'),
+ ('a([bc]+)(c*d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-bc-d'),
+ ('a([bc]*)(c+d)', 'abcd', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcd-b-cd'),
+ ('a[bcd]*dcdcde', 'adcdcde', SUCCEED, 'found', 'adcdcde'),
+ ('a[bcd]+dcdcde', 'adcdcde', FAIL),
+ ('(ab|a)b*c', 'abc', SUCCEED, 'found+"-"+g1', 'abc-ab'),
+ ('((a)(b)c)(d)', 'abcd', SUCCEED, 'g1+"-"+g2+"-"+g3+"-"+g4', 'abc-a-b-d'),
+ ('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', SUCCEED, 'found', 'alpha'),
+ ('^a(bc+|b[eh])g|.h$', 'abh', SUCCEED, 'found+"-"+g1', 'bh-'),
+ ('(bc+d$|ef*g.|h?i(j|k))', 'effgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-'),
+ ('(bc+d$|ef*g.|h?i(j|k))', 'ij', SUCCEED, 'found+"-"+g1+"-"+g2', 'ij-ij-j'),
+ ('(bc+d$|ef*g.|h?i(j|k))', 'effg', FAIL),
+ ('(bc+d$|ef*g.|h?i(j|k))', 'bcdd', FAIL),
+ ('(bc+d$|ef*g.|h?i(j|k))', 'reffgz', SUCCEED, 'found+"-"+g1+"-"+g2', 'effgz-effgz-'),
+ ('((((((((((a))))))))))', 'a', SUCCEED, 'g10', 'a'),
+ ('((((((((((a))))))))))\\10', 'aa', SUCCEED, 'found', 'aa'),
+ ('((((((((((a))))))))))\\41', 'aa', FAIL),
+ ('((((((((((a))))))))))\\41', 'a!', SUCCEED, 'found', 'a!'),
+ ('(((((((((a)))))))))', 'a', SUCCEED, 'found', 'a'),
+ ('multiple words of text', 'uh-uh', FAIL),
+ ('multiple words', 'multiple words, yeah', SUCCEED, 'found', 'multiple words'),
+ ('(.*)c(.*)', 'abcde', SUCCEED, 'found+"-"+g1+"-"+g2', 'abcde-ab-de'),
+ ('\\((.*), (.*)\\)', '(a, b)', SUCCEED, '(g2, g1)', '(b, a)'),
+ ('[k]', 'ab', FAIL),
+ ##('abcd', 'abcd', SUCCEED, 'found+"-"+\\found+"-"+\\\\found', 'abcd-$&-\\abcd'),
+ ##('a(bc)d', 'abcd', SUCCEED, 'g1+"-"+\\g1+"-"+\\\\g1', 'bc-$1-\\bc'),
+ ('a[-]?c', 'ac', SUCCEED, 'found', 'ac'),
+ ('(abc)\\1', 'abcabc', SUCCEED, 'g1', 'abc'),
+ ('([a-c]*)\\1', 'abcabc', SUCCEED, 'g1', 'abc'),
+ ('(?i)abc', 'ABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)abc', 'XBC', FAIL),
+ ('(?i)abc', 'AXC', FAIL),
+ ('(?i)abc', 'ABX', FAIL),
+ ('(?i)abc', 'XABCY', SUCCEED, 'found', 'ABC'),
+ ('(?i)abc', 'ABABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)ab*c', 'ABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)ab*bc', 'ABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)ab*bc', 'ABBC', SUCCEED, 'found', 'ABBC'),
+ ('(?i)ab*?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
+ ('(?i)ab{0,}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
+ ('(?i)ab+?bc', 'ABBC', SUCCEED, 'found', 'ABBC'),
+ ('(?i)ab+bc', 'ABC', FAIL),
+ ('(?i)ab+bc', 'ABQ', FAIL),
+ ('(?i)ab{1,}bc', 'ABQ', FAIL),
+ ('(?i)ab+bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
+ ('(?i)ab{1,}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
+ ('(?i)ab{1,3}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
+ ('(?i)ab{3,4}?bc', 'ABBBBC', SUCCEED, 'found', 'ABBBBC'),
+ ('(?i)ab{4,5}?bc', 'ABBBBC', FAIL),
+ ('(?i)ab??bc', 'ABBC', SUCCEED, 'found', 'ABBC'),
+ ('(?i)ab??bc', 'ABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)ab{0,1}?bc', 'ABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)ab??bc', 'ABBBBC', FAIL),
+ ('(?i)ab??c', 'ABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)ab{0,1}?c', 'ABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)^abc$', 'ABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)^abc$', 'ABCC', FAIL),
+ ('(?i)^abc', 'ABCC', SUCCEED, 'found', 'ABC'),
+ ('(?i)^abc$', 'AABC', FAIL),
+ ('(?i)abc$', 'AABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)^', 'ABC', SUCCEED, 'found', ''),
+ ('(?i)$', 'ABC', SUCCEED, 'found', ''),
+ ('(?i)a.c', 'ABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)a.c', 'AXC', SUCCEED, 'found', 'AXC'),
+ ('(?i)a.*?c', 'AXYZC', SUCCEED, 'found', 'AXYZC'),
+ ('(?i)a.*c', 'AXYZD', FAIL),
+ ('(?i)a[bc]d', 'ABC', FAIL),
+ ('(?i)a[bc]d', 'ABD', SUCCEED, 'found', 'ABD'),
+ ('(?i)a[b-d]e', 'ABD', FAIL),
+ ('(?i)a[b-d]e', 'ACE', SUCCEED, 'found', 'ACE'),
+ ('(?i)a[b-d]', 'AAC', SUCCEED, 'found', 'AC'),
+ ('(?i)a[-b]', 'A-', SUCCEED, 'found', 'A-'),
+ ('(?i)a[b-]', 'A-', SUCCEED, 'found', 'A-'),
+ ('(?i)a[b-a]', '-', SYNTAX_ERROR),
+ ('(?i)a[]b', '-', SYNTAX_ERROR),
+ ('(?i)a[', '-', SYNTAX_ERROR),
+ ('(?i)a]', 'A]', SUCCEED, 'found', 'A]'),
+ ('(?i)a[]]b', 'A]B', SUCCEED, 'found', 'A]B'),
+ ('(?i)a[^bc]d', 'AED', SUCCEED, 'found', 'AED'),
+ ('(?i)a[^bc]d', 'ABD', FAIL),
+ ('(?i)a[^-b]c', 'ADC', SUCCEED, 'found', 'ADC'),
+ ('(?i)a[^-b]c', 'A-C', FAIL),
+ ('(?i)a[^]b]c', 'A]C', FAIL),
+ ('(?i)a[^]b]c', 'ADC', SUCCEED, 'found', 'ADC'),
+ ('(?i)ab|cd', 'ABC', SUCCEED, 'found', 'AB'),
+ ('(?i)ab|cd', 'ABCD', SUCCEED, 'found', 'AB'),
+ ('(?i)()ef', 'DEF', SUCCEED, 'found+"-"+g1', 'EF-'),
+ ('(?i)*a', '-', SYNTAX_ERROR),
+ ('(?i)(*)b', '-', SYNTAX_ERROR),
+ ('(?i)$b', 'B', FAIL),
+ ('(?i)a\\', '-', SYNTAX_ERROR),
+ ('(?i)a\\(b', 'A(B', SUCCEED, 'found+"-"+g1', 'A(B-'),
+ ('(?i)a\\(*b', 'AB', SUCCEED, 'found', 'AB'),
+ ('(?i)a\\(*b', 'A((B', SUCCEED, 'found', 'A((B'),
+ ('(?i)a\\\\b', 'A\\B', SUCCEED, 'found', 'A\\B'),
+ ('(?i)abc)', '-', SYNTAX_ERROR),
+ ('(?i)(abc', '-', SYNTAX_ERROR),
+ ('(?i)((a))', 'ABC', SUCCEED, 'found+"-"+g1+"-"+g2', 'A-A-A'),
+ ('(?i)(a)b(c)', 'ABC', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABC-A-C'),
+ ('(?i)a+b+c', 'AABBABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)a{1,}b{1,}c', 'AABBABC', SUCCEED, 'found', 'ABC'),
+ #('(?i)a**', '-', SYNTAX_ERROR),
+ ('(?i)a.+?c', 'ABCABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)a.*?c', 'ABCABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)a.{0,5}?c', 'ABCABC', SUCCEED, 'found', 'ABC'),
+ ('(?i)(a+|b)*', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'),
+ ('(?i)(a+|b){0,}', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'),
+ ('(?i)(a+|b)+', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'),
+ ('(?i)(a+|b){1,}', 'AB', SUCCEED, 'found+"-"+g1', 'AB-B'),
+ ('(?i)(a+|b)?', 'AB', SUCCEED, 'found+"-"+g1', 'A-A'),
+ ('(?i)(a+|b){0,1}', 'AB', SUCCEED, 'found+"-"+g1', 'A-A'),
+ ('(?i)(a+|b){0,1}?', 'AB', SUCCEED, 'found+"-"+g1', '-'),
+ ('(?i))(', '-', SYNTAX_ERROR),
+ ('(?i)[^ab]*', 'CDE', SUCCEED, 'found', 'CDE'),
+ ('(?i)abc', '', FAIL),
+ ('(?i)a*', '', SUCCEED, 'found', ''),
+ ('(?i)([abc])*d', 'ABBBCD', SUCCEED, 'found+"-"+g1', 'ABBBCD-C'),
+ ('(?i)([abc])*bcd', 'ABCD', SUCCEED, 'found+"-"+g1', 'ABCD-A'),
+ ('(?i)a|b|c|d|e', 'E', SUCCEED, 'found', 'E'),
+ ('(?i)(a|b|c|d|e)f', 'EF', SUCCEED, 'found+"-"+g1', 'EF-E'),
+ ('(?i)abcd*efg', 'ABCDEFG', SUCCEED, 'found', 'ABCDEFG'),
+ ('(?i)ab*', 'XABYABBBZ', SUCCEED, 'found', 'AB'),
+ ('(?i)ab*', 'XAYABBBZ', SUCCEED, 'found', 'A'),
+ ('(?i)(ab|cd)e', 'ABCDE', SUCCEED, 'found+"-"+g1', 'CDE-CD'),
+ ('(?i)[abhgefdc]ij', 'HIJ', SUCCEED, 'found', 'HIJ'),
+ ('(?i)^(ab|cd)e', 'ABCDE', FAIL),
+ ('(?i)(abc|)ef', 'ABCDEF', SUCCEED, 'found+"-"+g1', 'EF-'),
+ ('(?i)(a|b)c*d', 'ABCD', SUCCEED, 'found+"-"+g1', 'BCD-B'),
+ ('(?i)(ab|ab*)bc', 'ABC', SUCCEED, 'found+"-"+g1', 'ABC-A'),
+ ('(?i)a([bc]*)c*', 'ABC', SUCCEED, 'found+"-"+g1', 'ABC-BC'),
+ ('(?i)a([bc]*)(c*d)', 'ABCD', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCD-BC-D'),
+ ('(?i)a([bc]+)(c*d)', 'ABCD', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCD-BC-D'),
+ ('(?i)a([bc]*)(c+d)', 'ABCD', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCD-B-CD'),
+ ('(?i)a[bcd]*dcdcde', 'ADCDCDE', SUCCEED, 'found', 'ADCDCDE'),
+ ('(?i)a[bcd]+dcdcde', 'ADCDCDE', FAIL),
+ ('(?i)(ab|a)b*c', 'ABC', SUCCEED, 'found+"-"+g1', 'ABC-AB'),
+ ('(?i)((a)(b)c)(d)', 'ABCD', SUCCEED, 'g1+"-"+g2+"-"+g3+"-"+g4', 'ABC-A-B-D'),
+ ('(?i)[a-zA-Z_][a-zA-Z0-9_]*', 'ALPHA', SUCCEED, 'found', 'ALPHA'),
+ ('(?i)^a(bc+|b[eh])g|.h$', 'ABH', SUCCEED, 'found+"-"+g1', 'BH-'),
+ ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'EFFGZ', SUCCEED, 'found+"-"+g1+"-"+g2', 'EFFGZ-EFFGZ-'),
+ ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'IJ', SUCCEED, 'found+"-"+g1+"-"+g2', 'IJ-IJ-J'),
+ ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'EFFG', FAIL),
+ ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'BCDD', FAIL),
+ ('(?i)(bc+d$|ef*g.|h?i(j|k))', 'REFFGZ', SUCCEED, 'found+"-"+g1+"-"+g2', 'EFFGZ-EFFGZ-'),
+ ('(?i)((((((((((a))))))))))', 'A', SUCCEED, 'g10', 'A'),
+ ('(?i)((((((((((a))))))))))\\10', 'AA', SUCCEED, 'found', 'AA'),
+ ('(?i)((((((((((a))))))))))\\41', 'AA', FAIL),
+ ('(?i)((((((((((a))))))))))\\41', 'A!', SUCCEED, 'found', 'A!'),
+ ('(?i)(((((((((a)))))))))', 'A', SUCCEED, 'found', 'A'),
+ ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))', 'A', SUCCEED, 'g1', 'A'),
+ ('(?i)(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))', 'C', SUCCEED, 'g1', 'C'),
+ ('(?i)multiple words of text', 'UH-UH', FAIL),
+ ('(?i)multiple words', 'MULTIPLE WORDS, YEAH', SUCCEED, 'found', 'MULTIPLE WORDS'),
+ ('(?i)(.*)c(.*)', 'ABCDE', SUCCEED, 'found+"-"+g1+"-"+g2', 'ABCDE-AB-DE'),
+ ('(?i)\\((.*), (.*)\\)', '(A, B)', SUCCEED, '(g2, g1)', '(B, A)'),
+ ('(?i)[k]', 'AB', FAIL),
+ ##('(?i)abcd', 'ABCD', SUCCEED, 'found+"-"+\\found+"-"+\\\\found', 'ABCD-$&-\\ABCD'),
+ ##('(?i)a(bc)d', 'ABCD', SUCCEED, 'g1+"-"+\\g1+"-"+\\\\g1', 'BC-$1-\\BC'),
+ ('(?i)a[-]?c', 'AC', SUCCEED, 'found', 'AC'),
+ ('(?i)(abc)\\1', 'ABCABC', SUCCEED, 'g1', 'ABC'),
+ ('(?i)([a-c]*)\\1', 'ABCABC', SUCCEED, 'g1', 'ABC'),
+ ('a(?!b).', 'abad', SUCCEED, 'found', 'ad'),
+ ('a(?=d).', 'abad', SUCCEED, 'found', 'ad'),
+ ('a(?=c|d).', 'abad', SUCCEED, 'found', 'ad'),
+ ('a(?:b|c|d)(.)', 'ace', SUCCEED, 'g1', 'e'),
+ ('a(?:b|c|d)*(.)', 'ace', SUCCEED, 'g1', 'e'),
+ ('a(?:b|c|d)+?(.)', 'ace', SUCCEED, 'g1', 'e'),
+ ('a(?:b|(c|e){1,2}?|d)+?(.)', 'ace', SUCCEED, 'g1g2', 'ce'),
+ ('^(.+)?B', 'AB', SUCCEED, 'g1', 'A'),
+]