1# Future self: the delimiter is an ASCII vertical bar, which is also a
2# REGEX special character, but hadn't already been used.  Nearly every
3# other plain ASCII character had been used by a test.  Characters
4# outside the plain ASCII range have a risk of being mangled by modern
5# editors.  So, avoid using | in a test, or if needed, select a new
6# delimeter.
7# 2.8.2  Regular Expression General Requirement
82|4|bb*|abbbc|
92|2|bb*|ababbbc|
107|9|A#*::|A:A#:qA::qA#::qA##::q|
111|5|A#*::|A##::A#::qA::qA#:q|
12# 2.8.3.1.2  BRE Special Characters
13# GA108
142|2|\.|a.c|
152|2|\[|a[c|
162|2|\\|a\c|
172|2|\*|a*c|
182|2|\^|a^c|
192|2|\$|a$c|
207|11|X\*Y\*8|Y*8X*8X*Y*8|
21# GA109
222|2|[.]|a.c|
232|2|[[]|a[c|
24-1|-1|[[]|ac|
252|2|[\]|a\c|
261|1|[\a]|abc|
272|2|[\.]|a\.c|
282|2|[\.]|a.\c|
292|2|[*]|a*c|
302|2|[$]|a$c|
312|2|[X*Y8]|7*8YX|
32# GA110
332|2|*|a*c|
343|4|*a|*b*a*c|
351|5|**9=|***9=9|
36# GA111
371|1|^*|*bc|
38-1|-1|^*|a*c|
39-1|-1|^*|^*ab|
401|5|^**9=|***9=|
41-1|-1|^*5<*9|5<9*5<*9|
42# GA112
432|3|\(*b\)|a*b|
44-1|-1|\(*b\)|ac|
451|6|A\(**9\)=|A***9=79|
46# GA113(1)
471|3|\(^*ab\)|*ab|
48-1|-1|\(^*ab\)|^*ab|
49-1|-1|\(^*b\)|a*b|
50-1|-1|\(^*b\)|^*b|
51### GA113(2)			GNU regex implements GA113(1)
52##-1|-1|\(^*ab\)|*ab|
53##-1|-1|\(^*ab\)|^*ab|
54##1|1|\(^*b\)|b|
55##1|3|\(^*b\)|^^b|
56# GA114
571|3|a^b|a^b|
581|3|a\^b|a^b|
591|1|^^|^bc|
602|2|\^|a^c|
611|1|[c^b]|^abc|
621|1|[\^ab]|^ab|
632|2|[\^ab]|c\d|
64-1|-1|[^^]|^|
651|3|\(a^b\)|a^b|
661|3|\(a\^b\)|a^b|
672|2|\(\^\)|a^b|
68# GA115
693|3|$$|ab$|
70-1|-1|$$|$ab|
712|3|$c|a$c|
722|2|[$]|a$c|
731|2|\$a|$a|
743|3|\$$|ab$|
752|6|A\([34]$[34]\)B|XA4$3BY|
76# 2.8.3.1.3  Periods in BREs
77# GA116
781|1|.|abc|
79-1|-1|.ab|abc|
801|3|ab.|abc|
811|3|a.b|a,b|
82-1|-1|.......|PqRs6|
831|7|.......|PqRs6T8|
84# 2.8.3.2  RE Bracket Expression
85# GA118
862|2|[abc]|xbyz|
87-1|-1|[abc]|xyz|
882|2|[abc]|xbay|
89# GA119
902|2|[^a]|abc|
914|4|[^]cd]|cd]ef|
922|2|[^abc]|axyz|
93-1|-1|[^abc]|abc|
943|3|[^[.a.]b]|abc|
953|3|[^[=a=]b]|abc|
962|2|[^-ac]|abcde-|
972|2|[^ac-]|abcde-|
983|3|[^a-b]|abcde|
993|3|[^a-bd-e]|dec|
1002|2|[^---]|-ab|
10116|16|[^a-zA-Z0-9]|pqrstVWXYZ23579#|
102# GA120(1)
1033|3|[]a]|cd]ef|
1041|1|[]-a]|a_b|
1053|3|[][.-.]-0]|ab0-]|
1061|1|[]^a-z]|string|
107# GA120(2)
1084|4|[^]cd]|cd]ef|
1090|0|[^]]*|]]]]]]]]X|
1100|0|[^]]*|]]]]]]]]|
1119|9|[^]]\{1,\}|]]]]]]]]X|
112-1|-1|[^]]\{1,\}|]]]]]]]]|
113# GA120(3)
1143|3|[c[.].]d]|ab]cd|
1152|8|[a-z]*[[.].]][A-Z]*|Abcd]DEFg|
116# GA121
1172|2|[[.a.]b]|Abc|
1181|1|[[.a.]b]|aBc|
119-1|-1|[[.a.]b]|ABc|
1203|3|[^[.a.]b]|abc|
1213|3|[][.-.]-0]|ab0-]|
1223|3|[A-[.].]c]|ab]!|
123# GA122
124-2|-2|[[.ch.]]|abc|
125-2|-2|[[.ab.][.CD.][.EF.]]|yZabCDEFQ9|
126# GA125
1272|2|[[=a=]b]|Abc|
1281|1|[[=a=]b]|aBc|
129-1|-1|[[=a=]b]|ABc|
1303|3|[^[=a=]b]|abc|
131# GA126
132#W the expected result for [[:alnum:]]* is 2-7 which is wrong
1330|0|[[:alnum:]]*| aB28gH|
1342|7|[[:alnum:]][[:alnum:]]*| aB28gH|
135#W the expected result for [^[:alnum:]]* is 2-5 which is wrong
1360|0|[^[:alnum:]]*|2 	,a|
1372|5|[^[:alnum:]][^[:alnum:]]*|2 	,a|
138#W the expected result for [[:alpha:]]* is 2-5 which is wrong
1390|0|[[:alpha:]]*| aBgH2|
1402|5|[[:alpha:]][[:alpha:]]*| aBgH2|
1411|6|[^[:alpha:]]*|2 	8,a|
1421|2|[[:blank:]]*|
143|
1441|8|[^[:blank:]]*|aB28gH, |
1451|2|[[:cntrl:]]*|	 |
1461|8|[^[:cntrl:]]*|aB2 8gh,|
147#W the expected result for [[:digit:]]* is 2-3 which is wrong
1480|0|[[:digit:]]*|a28|
1492|3|[[:digit:]][[:digit:]]*|a28|
1501|8|[^[:digit:]]*|aB 	gH,|
1511|7|[[:graph:]]*|aB28gH, |
1521|3|[^[:graph:]]*| 	,|
1531|2|[[:lower:]]*|agB|
1541|8|[^[:lower:]]*|B2 	8H,a|
1551|8|[[:print:]]*|aB2 8gH,	|
1561|2|[^[:print:]]*|	 |
157#W the expected result for [[:punct:]]* is 2-2 which is wrong
1580|0|[[:punct:]]*|a,2|
1592|3|[[:punct:]][[:punct:]]*|a,,2|
1601|9|[^[:punct:]]*|aB2 	8gH|
1611|3|[[:space:]]*|
162|
163#W the expected result for [^[:space:]]* is 2-9 which is wrong
1640|0|[^[:space:]]*| aB28gH,	|
1652|9|[^[:space:]][^[:space:]]*| aB28gH,	|
166#W the expected result for [[:upper:]]* is 2-3 which is wrong
1670|0|[[:upper:]]*|aBH2|
1682|3|[[:upper:]][[:upper:]]*|aBH2|
1691|8|[^[:upper:]]*|a2 	8g,B|
170#W the expected result for [[:xdigit:]]* is 2-5 which is wrong
1710|0|[[:xdigit:]]*|gaB28h|
1722|5|[[:xdigit:]][[:xdigit:]]*|gaB28h|
173#W the expected result for [^[:xdigit:]]* is 2-7 which is wrong
1742|7|[^[:xdigit:]][^[:xdigit:]]*|a 	gH,2|
175# GA127
176-2|-2|[b-a]|abc|
1771|1|[a-c]|bbccde|
1782|2|[a-b]|-bc|
1793|3|[a-z0-9]|AB0|
1803|3|[^a-b]|abcde|
1813|3|[^a-bd-e]|dec|
1821|1|[]-a]|a_b|
1832|2|[+--]|a,b|
1842|2|[--/]|a.b|
1852|2|[^---]|-ab|
1863|3|[][.-.]-0]|ab0-]|
1873|3|[A-[.].]c]|ab]!|
1882|6|bc[d-w]xy|abchxyz|
189# GA129
1901|1|[a-cd-f]|dbccde|
191-1|-1|[a-ce-f]|dBCCdE|
1922|4|b[n-zA-M]Y|absY9Z|
1932|4|b[n-zA-M]Y|abGY9Z|
194# GA130
1953|3|[-xy]|ac-|
1962|4|c[-xy]D|ac-D+|
1972|2|[--/]|a.b|
1982|4|c[--/]D|ac.D+b|
1992|2|[^-ac]|abcde-|
2001|3|a[^-ac]c|abcde-|
2013|3|[xy-]|zc-|
2022|4|c[xy-]7|zc-786|
2032|2|[^ac-]|abcde-|
2042|4|a[^ac-]c|5abcde-|
2052|2|[+--]|a,b|
2062|4|a[+--]B|Xa,By|
2072|2|[^---]|-ab|
2084|6|X[^---]Y|X-YXaYXbY|
209# 2.8.3.3  BREs Matching Multiple Characters
210# GA131
2113|4|cd|abcdeabcde|
2121|2|ag*b|abcde|
213-1|-1|[a-c][e-f]|abcdef|
2143|4|[a-c][e-f]|acbedf|
2154|8|abc*XYZ|890abXYZ#*|
2164|9|abc*XYZ|890abcXYZ#*|
2174|15|abc*XYZ|890abcccccccXYZ#*|
218-1|-1|abc*XYZ|890abc*XYZ#*|
219# GA132
2202|4|\(*bc\)|a*bc|
2211|2|\(ab\)|abcde|
2221|10|\(a\(b\(c\(d\(e\(f\(g\)h\(i\(j\)\)\)\)\)\)\)\)|abcdefghijk|
2233|8|43\(2\(6\)*0\)AB|654320ABCD|
2243|9|43\(2\(7\)*0\)AB|6543270ABCD|
2253|12|43\(2\(7\)*0\)AB|6543277770ABCD|
226# GA133
2271|10|\(a\(b\(c\(d\(e\(f\(g\)h\(i\(j\)\)\)\)\)\)\)\)|abcdefghijk|
228-1|-1|\(a\(b\(c\(d\(e\(f\(g\)h\(i\(k\)\)\)\)\)\)\)\)|abcdefghijk|
229# GA134
2302|4|\(bb*\)|abbbc|
2312|2|\(bb*\)|ababbbc|
2321|6|a\(.*b\)|ababbbc|
2331|2|a\(b*\)|ababbbc|
2341|20|a\(.*b\)c|axcaxbbbcsxbbbbbbbbc|
235# GA135
2361|7|\(a\(b\(c\(d\(e\)\)\)\)\)\4|abcdededede|
237#W POSIX does not really specify whether a\(b\)*c\1 matches acb.
238#W back references are supposed to expand to the last match, but what
239#W if there never was a match as in this case?
240-1|-1|a\(b\)*c\1|acb|
2411|11|\(a\(b\(c\(d\(e\(f\(g\)h\(i\(j\)\)\)\)\)\)\)\)\9|abcdefghijjk|
242# GA136
243#W These two tests have the same problem as the test in GA135.  No match
244#W of a subexpression, why should the back reference be usable?
245#W 1 2 a\(b\)*c\1 acb
246#W 4 7 a\(b\(c\(d\(f\)*\)\)\)\4|xYzabcdePQRST
247-1|-1|a\(b\)*c\1|acb|
248-1|-1|a\(b\(c\(d\(f\)*\)\)\)\4|xYzabcdePQRST|
249# GA137
250-2|-2|\(a\(b\)\)\3|foo|
251-2|-2|\(a\(b\)\)\(a\(b\)\)\5|foo|
252# GA138
2531|2|ag*b|abcde|
2541|10|a.*b|abababvbabc|
2552|5|b*c|abbbcdeabbbbbbcde|
2562|5|bbb*c|abbbcdeabbbbbbcde|
2571|5|a\(b\)*c\1|abbcbbb|
258-1|-1|a\(b\)*c\1|abbdbd|
2590|0|\([a-c]*\)\1|abcacdef|
2601|6|\([a-c]*\)\1|abcabcabcd|
2611|2|a^*b|ab|
2621|5|a^*b|a^^^b|
263# GA139
2641|2|a\{2\}|aaaa|
2651|7|\([a-c]*\)\{0,\}|aabcaab|
2661|2|\(a\)\1\{1,2\}|aabc|
2671|3|\(a\)\1\{1,2\}|aaaabc|
268#W the expression \(\(a\)\1\)\{1,2\} is ill-formed, using \2
2691|4|\(\(a\)\2\)\{1,2\}|aaaabc|
270# GA140
2711|2|a\{2\}|aaaa|
272-1|-1|a\{2\}|abcd|
2730|0|a\{0\}|aaaa|
2741|64|a\{64\}|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
275# GA141
2761|7|\([a-c]*\)\{0,\}|aabcaab|
277#W the expected result for \([a-c]*\)\{2,\} is failure which isn't correct
2781|3|\([a-c]*\)\{2,\}|abcdefg|
2791|3|\([a-c]*\)\{1,\}|abcdefg|
280-1|-1|a\{64,\}|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
281# GA142
2821|3|a\{2,3\}|aaaa|
283-1|-1|a\{2,3\}|abcd|
2840|0|\([a-c]*\)\{0,0\}|foo|
2851|63|a\{1,63\}|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
286# 2.8.3.4  BRE Precedence
287# GA143
288#W There are numerous bugs in the original version.
2892|19|\^\[[[.].]]\\(\\1\\)\*\\{1,2\\}\$|a^[]\(\1\)*\{1,2\}$b|
2901|6|[[=*=]][[=\=]][[=]=]][[===]][[...]][[:punct:]]|*\]=.;|
2911|6|[$\(*\)^]*|$\()*^|
2921|1|[\1]|1|
2931|1|[\{1,2\}]|{|
294#W the expected result for \(*\)*\1* is 2-2 which isn't correct
2950|0|\(*\)*\1*|a*b*11|
2962|3|\(*\)*\1*b|a*b*11|
297#W the expected result for \(a\(b\{1,2\}\)\{1,2\}\) is 1-5 which isn't correct
2981|3|\(a\(b\{1,2\}\)\{1,2\}\)|abbab|
2991|5|\(a\(b\{1,2\}\)\)\{1,2\}|abbab|
3001|1|^\(^\(^a$\)$\)$|a|
3011|2|\(a\)\1$|aa|
3021|3|ab*|abb|
3031|4|ab\{2,4\}|abbbc|
304# 2.8.3.5  BRE Expression Anchoring
305# GA144
3061|1|^a|abc|
307-1|-1|^b|abc|
308-1|-1|^[a-zA-Z]|99Nine|
3091|4|^[a-zA-Z]*|Nine99|
310# GA145(1)
3111|2|\(^a\)\1|aabc|
312-1|-1|\(^a\)\1|^a^abc|
3131|2|\(^^a\)|^a|
3141|1|\(^^\)|^^|
3151|3|\(^abc\)|abcdef|
316-1|-1|\(^def\)|abcdef|
317### GA145(2)			GNU regex implements GA145(1)
318##-1|-1|\(^a\)\1|aabc|
319##1|4|\(^a\)\1|^a^abc|
320##-1|-1|\(^^a\)|^a|
321##1|2|\(^^\)|^^|
322# GA146
3233|3|a$|cba|
324-1|-1|a$|abc|
3255|7|[a-z]*$|99ZZxyz|
326#W the expected result for [a-z]*$ is failure which isn't correct
32710|9|[a-z]*$|99ZZxyz99|
3283|3|$$|ab$|
329-1|-1|$$|$ab|
3303|3|\$$|ab$|
331# GA147(1)
332-1|-1|\(a$\)\1|bcaa|
333-1|-1|\(a$\)\1|ba$|
334-1|-1|\(ab$\)|ab$|
3351|2|\(ab$\)|ab|
3364|6|\(def$\)|abcdef|
337-1|-1|\(abc$\)|abcdef|
338### GA147(2)			GNU regex implements GA147(1)
339##-1|-1|\(a$\)\1|bcaa|
340##2|5|\(a$\)\1|ba$a$|
341##-1|-1|\(ab$\)|ab|
342##1|3|\(ab$\)|ab$|
343# GA148
3440|0|^$||
3451|3|^abc$|abc|
346-1|-1|^xyz$|^xyz^|
347-1|-1|^234$|^234$|
3481|9|^[a-zA-Z0-9]*$|2aA3bB9zZ|
349-1|-1|^[a-z0-9]*$|2aA3b#B9zZ|
350