]>
Commit | Line | Data |
---|---|---|
69623c0d DD |
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 | |
7f0d9e61 | 6 | # delimiter. |
92040cbc | 7 | # 2.8.2 Regular Expression General Requirement |
69623c0d DD |
8 | 2|4|bb*|abbbc| |
9 | 2|2|bb*|ababbbc| | |
10 | 7|9|A#*::|A:A#:qA::qA#::qA##::q| | |
11 | 1|5|A#*::|A##::A#::qA::qA#:q| | |
92040cbc UD |
12 | # 2.8.3.1.2 BRE Special Characters |
13 | # GA108 | |
69623c0d DD |
14 | 2|2|\.|a.c| |
15 | 2|2|\[|a[c| | |
16 | 2|2|\\|a\c| | |
17 | 2|2|\*|a*c| | |
18 | 2|2|\^|a^c| | |
19 | 2|2|\$|a$c| | |
20 | 7|11|X\*Y\*8|Y*8X*8X*Y*8| | |
92040cbc | 21 | # GA109 |
69623c0d DD |
22 | 2|2|[.]|a.c| |
23 | 2|2|[[]|a[c| | |
24 | -1|-1|[[]|ac| | |
25 | 2|2|[\]|a\c| | |
26 | 1|1|[\a]|abc| | |
27 | 2|2|[\.]|a\.c| | |
28 | 2|2|[\.]|a.\c| | |
29 | 2|2|[*]|a*c| | |
30 | 2|2|[$]|a$c| | |
31 | 2|2|[X*Y8]|7*8YX| | |
92040cbc | 32 | # GA110 |
69623c0d DD |
33 | 2|2|*|a*c| |
34 | 3|4|*a|*b*a*c| | |
35 | 1|5|**9=|***9=9| | |
92040cbc | 36 | # GA111 |
69623c0d DD |
37 | 1|1|^*|*bc| |
38 | -1|-1|^*|a*c| | |
39 | -1|-1|^*|^*ab| | |
40 | 1|5|^**9=|***9=| | |
41 | -1|-1|^*5<*9|5<9*5<*9| | |
92040cbc | 42 | # GA112 |
69623c0d DD |
43 | 2|3|\(*b\)|a*b| |
44 | -1|-1|\(*b\)|ac| | |
45 | 1|6|A\(**9\)=|A***9=79| | |
92040cbc | 46 | # GA113(1) |
69623c0d DD |
47 | 1|3|\(^*ab\)|*ab| |
48 | -1|-1|\(^*ab\)|^*ab| | |
49 | -1|-1|\(^*b\)|a*b| | |
50 | -1|-1|\(^*b\)|^*b| | |
648c1337 | 51 | ### GA113(2) GNU regex implements GA113(1) |
69623c0d DD |
52 | ##-1|-1|\(^*ab\)|*ab| |
53 | ##-1|-1|\(^*ab\)|^*ab| | |
54 | ##1|1|\(^*b\)|b| | |
55 | ##1|3|\(^*b\)|^^b| | |
92040cbc | 56 | # GA114 |
69623c0d DD |
57 | 1|3|a^b|a^b| |
58 | 1|3|a\^b|a^b| | |
59 | 1|1|^^|^bc| | |
60 | 2|2|\^|a^c| | |
61 | 1|1|[c^b]|^abc| | |
62 | 1|1|[\^ab]|^ab| | |
63 | 2|2|[\^ab]|c\d| | |
64 | -1|-1|[^^]|^| | |
65 | 1|3|\(a^b\)|a^b| | |
66 | 1|3|\(a\^b\)|a^b| | |
67 | 2|2|\(\^\)|a^b| | |
92040cbc | 68 | # GA115 |
69623c0d DD |
69 | 3|3|$$|ab$| |
70 | -1|-1|$$|$ab| | |
71 | 2|3|$c|a$c| | |
72 | 2|2|[$]|a$c| | |
73 | 1|2|\$a|$a| | |
74 | 3|3|\$$|ab$| | |
75 | 2|6|A\([34]$[34]\)B|XA4$3BY| | |
c0016081 | 76 | # 2.8.3.1.3 Periods in BREs |
92040cbc | 77 | # GA116 |
69623c0d DD |
78 | 1|1|.|abc| |
79 | -1|-1|.ab|abc| | |
80 | 1|3|ab.|abc| | |
81 | 1|3|a.b|a,b| | |
82 | -1|-1|.......|PqRs6| | |
83 | 1|7|.......|PqRs6T8| | |
92040cbc UD |
84 | # 2.8.3.2 RE Bracket Expression |
85 | # GA118 | |
69623c0d DD |
86 | 2|2|[abc]|xbyz| |
87 | -1|-1|[abc]|xyz| | |
88 | 2|2|[abc]|xbay| | |
92040cbc | 89 | # GA119 |
69623c0d DD |
90 | 2|2|[^a]|abc| |
91 | 4|4|[^]cd]|cd]ef| | |
92 | 2|2|[^abc]|axyz| | |
93 | -1|-1|[^abc]|abc| | |
94 | 3|3|[^[.a.]b]|abc| | |
95 | 3|3|[^[=a=]b]|abc| | |
96 | 2|2|[^-ac]|abcde-| | |
97 | 2|2|[^ac-]|abcde-| | |
98 | 3|3|[^a-b]|abcde| | |
99 | 3|3|[^a-bd-e]|dec| | |
100 | 2|2|[^---]|-ab| | |
101 | 16|16|[^a-zA-Z0-9]|pqrstVWXYZ23579#| | |
92040cbc | 102 | # GA120(1) |
69623c0d DD |
103 | 3|3|[]a]|cd]ef| |
104 | 1|1|[]-a]|a_b| | |
105 | 3|3|[][.-.]-0]|ab0-]| | |
106 | 1|1|[]^a-z]|string| | |
92040cbc | 107 | # GA120(2) |
69623c0d DD |
108 | 4|4|[^]cd]|cd]ef| |
109 | 0|0|[^]]*|]]]]]]]]X| | |
110 | 0|0|[^]]*|]]]]]]]]| | |
111 | 9|9|[^]]\{1,\}|]]]]]]]]X| | |
112 | -1|-1|[^]]\{1,\}|]]]]]]]]| | |
92040cbc | 113 | # GA120(3) |
69623c0d DD |
114 | 3|3|[c[.].]d]|ab]cd| |
115 | 2|8|[a-z]*[[.].]][A-Z]*|Abcd]DEFg| | |
92040cbc | 116 | # GA121 |
69623c0d DD |
117 | 2|2|[[.a.]b]|Abc| |
118 | 1|1|[[.a.]b]|aBc| | |
119 | -1|-1|[[.a.]b]|ABc| | |
120 | 3|3|[^[.a.]b]|abc| | |
121 | 3|3|[][.-.]-0]|ab0-]| | |
122 | 3|3|[A-[.].]c]|ab]!| | |
92040cbc | 123 | # GA122 |
69623c0d DD |
124 | -2|-2|[[.ch.]]|abc| |
125 | -2|-2|[[.ab.][.CD.][.EF.]]|yZabCDEFQ9| | |
92040cbc | 126 | # GA125 |
69623c0d DD |
127 | 2|2|[[=a=]b]|Abc| |
128 | 1|1|[[=a=]b]|aBc| | |
129 | -1|-1|[[=a=]b]|ABc| | |
130 | 3|3|[^[=a=]b]|abc| | |
92040cbc | 131 | # GA126 |
813ec65a | 132 | #W the expected result for [[:alnum:]]* is 2-7 which is wrong |
69623c0d DD |
133 | 0|0|[[:alnum:]]*| aB28gH| |
134 | 2|7|[[:alnum:]][[:alnum:]]*| aB28gH| | |
813ec65a | 135 | #W the expected result for [^[:alnum:]]* is 2-5 which is wrong |
69623c0d DD |
136 | 0|0|[^[:alnum:]]*|2 ,\7fa| |
137 | 2|5|[^[:alnum:]][^[:alnum:]]*|2 ,\7fa| | |
813ec65a | 138 | #W the expected result for [[:alpha:]]* is 2-5 which is wrong |
69623c0d DD |
139 | 0|0|[[:alpha:]]*| aBgH2| |
140 | 2|5|[[:alpha:]][[:alpha:]]*| aBgH2| | |
141 | 1|6|[^[:alpha:]]*|2 8,\7fa| | |
142 | 1|2|[[:blank:]]*| \r\7f| | |
143 | 1|8|[^[:blank:]]*|aB28gH,\7f | | |
144 | 1|2|[[:cntrl:]]*| \7f | | |
145 | 1|8|[^[:cntrl:]]*|aB2 8gh,| | |
813ec65a | 146 | #W the expected result for [[:digit:]]* is 2-3 which is wrong |
69623c0d DD |
147 | 0|0|[[:digit:]]*|a28| |
148 | 2|3|[[:digit:]][[:digit:]]*|a28| | |
149 | 1|8|[^[:digit:]]*|aB gH,\7f| | |
150 | 1|7|[[:graph:]]*|aB28gH, | | |
151 | 1|3|[^[:graph:]]*| \7f,| | |
152 | 1|2|[[:lower:]]*|agB| | |
153 | 1|8|[^[:lower:]]*|B2 8H,\7fa| | |
154 | 1|8|[[:print:]]*|aB2 8gH, | | |
155 | 1|2|[^[:print:]]*| \7f | | |
813ec65a | 156 | #W the expected result for [[:punct:]]* is 2-2 which is wrong |
69623c0d DD |
157 | 0|0|[[:punct:]]*|a,2| |
158 | 2|3|[[:punct:]][[:punct:]]*|a,,2| | |
159 | 1|9|[^[:punct:]]*|aB2 8gH\7f| | |
160 | 1|3|[[:space:]]*| \r\7f| | |
813ec65a | 161 | #W the expected result for [^[:space:]]* is 2-9 which is wrong |
69623c0d DD |
162 | 0|0|[^[:space:]]*| aB28gH,\7f | |
163 | 2|9|[^[:space:]][^[:space:]]*| aB28gH,\7f | | |
813ec65a | 164 | #W the expected result for [[:upper:]]* is 2-3 which is wrong |
69623c0d DD |
165 | 0|0|[[:upper:]]*|aBH2| |
166 | 2|3|[[:upper:]][[:upper:]]*|aBH2| | |
167 | 1|8|[^[:upper:]]*|a2 8g,\7fB| | |
813ec65a | 168 | #W the expected result for [[:xdigit:]]* is 2-5 which is wrong |
69623c0d DD |
169 | 0|0|[[:xdigit:]]*|gaB28h| |
170 | 2|5|[[:xdigit:]][[:xdigit:]]*|gaB28h| | |
813ec65a | 171 | #W the expected result for [^[:xdigit:]]* is 2-7 which is wrong |
69623c0d | 172 | 2|7|[^[:xdigit:]][^[:xdigit:]]*|a gH,\7f2| |
92040cbc | 173 | # GA127 |
69623c0d DD |
174 | -2|-2|[b-a]|abc| |
175 | 1|1|[a-c]|bbccde| | |
176 | 2|2|[a-b]|-bc| | |
177 | 3|3|[a-z0-9]|AB0| | |
178 | 3|3|[^a-b]|abcde| | |
179 | 3|3|[^a-bd-e]|dec| | |
180 | 1|1|[]-a]|a_b| | |
181 | 2|2|[+--]|a,b| | |
182 | 2|2|[--/]|a.b| | |
183 | 2|2|[^---]|-ab| | |
184 | 3|3|[][.-.]-0]|ab0-]| | |
185 | 3|3|[A-[.].]c]|ab]!| | |
186 | 2|6|bc[d-w]xy|abchxyz| | |
92040cbc | 187 | # GA129 |
69623c0d DD |
188 | 1|1|[a-cd-f]|dbccde| |
189 | -1|-1|[a-ce-f]|dBCCdE| | |
190 | 2|4|b[n-zA-M]Y|absY9Z| | |
191 | 2|4|b[n-zA-M]Y|abGY9Z| | |
92040cbc | 192 | # GA130 |
69623c0d DD |
193 | 3|3|[-xy]|ac-| |
194 | 2|4|c[-xy]D|ac-D+| | |
195 | 2|2|[--/]|a.b| | |
196 | 2|4|c[--/]D|ac.D+b| | |
197 | 2|2|[^-ac]|abcde-| | |
198 | 1|3|a[^-ac]c|abcde-| | |
199 | 3|3|[xy-]|zc-| | |
200 | 2|4|c[xy-]7|zc-786| | |
201 | 2|2|[^ac-]|abcde-| | |
202 | 2|4|a[^ac-]c|5abcde-| | |
203 | 2|2|[+--]|a,b| | |
204 | 2|4|a[+--]B|Xa,By| | |
205 | 2|2|[^---]|-ab| | |
206 | 4|6|X[^---]Y|X-YXaYXbY| | |
92040cbc UD |
207 | # 2.8.3.3 BREs Matching Multiple Characters |
208 | # GA131 | |
69623c0d DD |
209 | 3|4|cd|abcdeabcde| |
210 | 1|2|ag*b|abcde| | |
211 | -1|-1|[a-c][e-f]|abcdef| | |
212 | 3|4|[a-c][e-f]|acbedf| | |
213 | 4|8|abc*XYZ|890abXYZ#*| | |
214 | 4|9|abc*XYZ|890abcXYZ#*| | |
215 | 4|15|abc*XYZ|890abcccccccXYZ#*| | |
216 | -1|-1|abc*XYZ|890abc*XYZ#*| | |
92040cbc | 217 | # GA132 |
69623c0d DD |
218 | 2|4|\(*bc\)|a*bc| |
219 | 1|2|\(ab\)|abcde| | |
220 | 1|10|\(a\(b\(c\(d\(e\(f\(g\)h\(i\(j\)\)\)\)\)\)\)\)|abcdefghijk| | |
221 | 3|8|43\(2\(6\)*0\)AB|654320ABCD| | |
222 | 3|9|43\(2\(7\)*0\)AB|6543270ABCD| | |
223 | 3|12|43\(2\(7\)*0\)AB|6543277770ABCD| | |
92040cbc | 224 | # GA133 |
69623c0d DD |
225 | 1|10|\(a\(b\(c\(d\(e\(f\(g\)h\(i\(j\)\)\)\)\)\)\)\)|abcdefghijk| |
226 | -1|-1|\(a\(b\(c\(d\(e\(f\(g\)h\(i\(k\)\)\)\)\)\)\)\)|abcdefghijk| | |
92040cbc | 227 | # GA134 |
69623c0d DD |
228 | 2|4|\(bb*\)|abbbc| |
229 | 2|2|\(bb*\)|ababbbc| | |
230 | 1|6|a\(.*b\)|ababbbc| | |
231 | 1|2|a\(b*\)|ababbbc| | |
232 | 1|20|a\(.*b\)c|axcaxbbbcsxbbbbbbbbc| | |
92040cbc | 233 | # GA135 |
69623c0d | 234 | 1|7|\(a\(b\(c\(d\(e\)\)\)\)\)\4|abcdededede| |
97fd3a30 UD |
235 | #W POSIX does not really specify whether a\(b\)*c\1 matches acb. |
236 | #W back references are supposed to expand to the last match, but what | |
237 | #W if there never was a match as in this case? | |
69623c0d DD |
238 | -1|-1|a\(b\)*c\1|acb| |
239 | 1|11|\(a\(b\(c\(d\(e\(f\(g\)h\(i\(j\)\)\)\)\)\)\)\)\9|abcdefghijjk| | |
92040cbc | 240 | # GA136 |
97fd3a30 UD |
241 | #W These two tests have the same problem as the test in GA135. No match |
242 | #W of a subexpression, why should the back reference be usable? | |
243 | #W 1 2 a\(b\)*c\1 acb | |
69623c0d DD |
244 | #W 4 7 a\(b\(c\(d\(f\)*\)\)\)\4|xYzabcdePQRST |
245 | -1|-1|a\(b\)*c\1|acb| | |
246 | -1|-1|a\(b\(c\(d\(f\)*\)\)\)\4|xYzabcdePQRST| | |
92040cbc | 247 | # GA137 |
69623c0d DD |
248 | -2|-2|\(a\(b\)\)\3|foo| |
249 | -2|-2|\(a\(b\)\)\(a\(b\)\)\5|foo| | |
92040cbc | 250 | # GA138 |
69623c0d DD |
251 | 1|2|ag*b|abcde| |
252 | 1|10|a.*b|abababvbabc| | |
253 | 2|5|b*c|abbbcdeabbbbbbcde| | |
254 | 2|5|bbb*c|abbbcdeabbbbbbcde| | |
255 | 1|5|a\(b\)*c\1|abbcbbb| | |
256 | -1|-1|a\(b\)*c\1|abbdbd| | |
257 | 0|0|\([a-c]*\)\1|abcacdef| | |
258 | 1|6|\([a-c]*\)\1|abcabcabcd| | |
259 | 1|2|a^*b|ab| | |
260 | 1|5|a^*b|a^^^b| | |
92040cbc | 261 | # GA139 |
69623c0d DD |
262 | 1|2|a\{2\}|aaaa| |
263 | 1|7|\([a-c]*\)\{0,\}|aabcaab| | |
264 | 1|2|\(a\)\1\{1,2\}|aabc| | |
265 | 1|3|\(a\)\1\{1,2\}|aaaabc| | |
813ec65a | 266 | #W the expression \(\(a\)\1\)\{1,2\} is ill-formed, using \2 |
69623c0d | 267 | 1|4|\(\(a\)\2\)\{1,2\}|aaaabc| |
92040cbc | 268 | # GA140 |
69623c0d DD |
269 | 1|2|a\{2\}|aaaa| |
270 | -1|-1|a\{2\}|abcd| | |
271 | 0|0|a\{0\}|aaaa| | |
272 | 1|64|a\{64\}|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| | |
92040cbc | 273 | # GA141 |
69623c0d | 274 | 1|7|\([a-c]*\)\{0,\}|aabcaab| |
813ec65a | 275 | #W the expected result for \([a-c]*\)\{2,\} is failure which isn't correct |
69623c0d DD |
276 | 1|3|\([a-c]*\)\{2,\}|abcdefg| |
277 | 1|3|\([a-c]*\)\{1,\}|abcdefg| | |
278 | -1|-1|a\{64,\}|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| | |
92040cbc | 279 | # GA142 |
69623c0d DD |
280 | 1|3|a\{2,3\}|aaaa| |
281 | -1|-1|a\{2,3\}|abcd| | |
282 | 0|0|\([a-c]*\)\{0,0\}|foo| | |
283 | 1|63|a\{1,63\}|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| | |
c0016081 | 284 | # 2.8.3.4 BRE Precedence |
92040cbc | 285 | # GA143 |
18e3dc56 | 286 | #W There are numerous bugs in the original version. |
69623c0d DD |
287 | 2|19|\^\[[[.].]]\\(\\1\\)\*\\{1,2\\}\$|a^[]\(\1\)*\{1,2\}$b| |
288 | 1|6|[[=*=]][[=\=]][[=]=]][[===]][[...]][[:punct:]]|*\]=.;| | |
289 | 1|6|[$\(*\)^]*|$\()*^| | |
290 | 1|1|[\1]|1| | |
291 | 1|1|[\{1,2\}]|{| | |
813ec65a | 292 | #W the expected result for \(*\)*\1* is 2-2 which isn't correct |
69623c0d DD |
293 | 0|0|\(*\)*\1*|a*b*11| |
294 | 2|3|\(*\)*\1*b|a*b*11| | |
813ec65a | 295 | #W the expected result for \(a\(b\{1,2\}\)\{1,2\}\) is 1-5 which isn't correct |
69623c0d DD |
296 | 1|3|\(a\(b\{1,2\}\)\{1,2\}\)|abbab| |
297 | 1|5|\(a\(b\{1,2\}\)\)\{1,2\}|abbab| | |
298 | 1|1|^\(^\(^a$\)$\)$|a| | |
299 | 1|2|\(a\)\1$|aa| | |
300 | 1|3|ab*|abb| | |
301 | 1|4|ab\{2,4\}|abbbc| | |
92040cbc UD |
302 | # 2.8.3.5 BRE Expression Anchoring |
303 | # GA144 | |
69623c0d DD |
304 | 1|1|^a|abc| |
305 | -1|-1|^b|abc| | |
306 | -1|-1|^[a-zA-Z]|99Nine| | |
307 | 1|4|^[a-zA-Z]*|Nine99| | |
92040cbc | 308 | # GA145(1) |
69623c0d DD |
309 | 1|2|\(^a\)\1|aabc| |
310 | -1|-1|\(^a\)\1|^a^abc| | |
311 | 1|2|\(^^a\)|^a| | |
312 | 1|1|\(^^\)|^^| | |
313 | 1|3|\(^abc\)|abcdef| | |
314 | -1|-1|\(^def\)|abcdef| | |
648c1337 | 315 | ### GA145(2) GNU regex implements GA145(1) |
69623c0d DD |
316 | ##-1|-1|\(^a\)\1|aabc| |
317 | ##1|4|\(^a\)\1|^a^abc| | |
318 | ##-1|-1|\(^^a\)|^a| | |
319 | ##1|2|\(^^\)|^^| | |
92040cbc | 320 | # GA146 |
69623c0d DD |
321 | 3|3|a$|cba| |
322 | -1|-1|a$|abc| | |
323 | 5|7|[a-z]*$|99ZZxyz| | |
813ec65a | 324 | #W the expected result for [a-z]*$ is failure which isn't correct |
69623c0d DD |
325 | 10|9|[a-z]*$|99ZZxyz99| |
326 | 3|3|$$|ab$| | |
327 | -1|-1|$$|$ab| | |
328 | 3|3|\$$|ab$| | |
92040cbc | 329 | # GA147(1) |
69623c0d DD |
330 | -1|-1|\(a$\)\1|bcaa| |
331 | -1|-1|\(a$\)\1|ba$| | |
332 | -1|-1|\(ab$\)|ab$| | |
333 | 1|2|\(ab$\)|ab| | |
334 | 4|6|\(def$\)|abcdef| | |
335 | -1|-1|\(abc$\)|abcdef| | |
648c1337 | 336 | ### GA147(2) GNU regex implements GA147(1) |
69623c0d DD |
337 | ##-1|-1|\(a$\)\1|bcaa| |
338 | ##2|5|\(a$\)\1|ba$a$| | |
339 | ##-1|-1|\(ab$\)|ab| | |
340 | ##1|3|\(ab$\)|ab$| | |
92040cbc | 341 | # GA148 |
69623c0d DD |
342 | 0|0|^$|| |
343 | 1|3|^abc$|abc| | |
344 | -1|-1|^xyz$|^xyz^| | |
345 | -1|-1|^234$|^234$| | |
346 | 1|9|^[a-zA-Z0-9]*$|2aA3bB9zZ| | |
347 | -1|-1|^[a-z0-9]*$|2aA3b#B9zZ| |