10 ab*bc abbbbc y $& abbbbc
12 .{3,4} abbbbc y $& abbb
13 ab{0,}bc abbbbc y $& abbbbc
18 ab+bc abbbbc y $& abbbbc
19 ab{1,}bc abbbbc y $& abbbbc
20 ab{1,3}bc abbbbc y $& abbbbc
21 ab{3,4}bc abbbbc y $& abbbbc
22 ab{4,5}bc abbbbc n - -
25 ab{0,1}bc abc y $& abc
48 a[b-a] - c - /a[b-a]/: invalid [] range in regexp
49 a[]b - c - /a[]b/: unmatched [] in regexp
50 a[ - c - /a[/: unmatched [] in regexp
98 *a - c - /*a/: ?+*{} follows nothing in regexp
99 (*)b - c - /(*)b/: ?+*{} follows nothing in regexp
101 a\ - c - Search pattern not terminated
102 a\(b a(b y $&-$1 a(b-
106 abc) - c - /abc)/: unmatched () in regexp
107 (abc - c - /(abc/: unmatched () in regexp
108 ((a)) abc y $&-$1-$2 a-a-a
109 (a)b(c) abc y $&-$1-$2 abc-a-c
110 a+b+c aabbabc y $& abc
111 a{1,}b{1,}c aabbabc y $& abc
112 a** - c - /a**/: nested *?+ in regexp
113 a.+?c abcabc y $& abc
114 (a+|b)* ab y $&-$1 ab-b
115 (a+|b){0,} ab y $&-$1 ab-b
116 (a+|b)+ ab y $&-$1 ab-b
117 (a+|b){1,} ab y $&-$1 ab-b
118 (a+|b)? ab y $&-$1 a-a
119 (a+|b){0,1} ab y $&-$1 a-a
120 )( - c - /)(/: unmatched () in regexp
124 ([abc])*d abbbcd y $&-$1 abbbcd-c
125 ([abc])*bcd abcd y $&-$1 abcd-a
127 (a|b|c|d|e)f ef y $&-$1 ef-e
128 abcd*efg abcdefg y $& abcdefg
129 ab* xabyabbbz y $& ab
131 (ab|cd)e abcde y $&-$1 cde-cd
132 [abhgefdc]ij hij y $& hij
133 ^(ab|cd)e abcde n x$1y xy
134 (abc|)ef abcdef y $&-$1 ef-
135 (a|b)c*d abcd y $&-$1 bcd-b
136 (ab|ab*)bc abc y $&-$1 abc-a
137 a([bc]*)c* abc y $&-$1 abc-bc
138 a([bc]*)(c*d) abcd y $&-$1-$2 abcd-bc-d
139 a([bc]+)(c*d) abcd y $&-$1-$2 abcd-bc-d
140 a([bc]*)(c+d) abcd y $&-$1-$2 abcd-b-cd
141 a[bcd]*dcdcde adcdcde y $& adcdcde
142 a[bcd]+dcdcde adcdcde n - -
143 (ab|a)b*c abc y $&-$1 abc-ab
144 ((a)(b)c)(d) abcd y $1-$2-$3-$4 abc-a-b-d
145 [a-zA-Z_][a-zA-Z0-9_]* alpha y $& alpha
146 ^a(bc+|b[eh])g|.h$ abh y $&-$1 bh-
147 (bc+d$|ef*g.|h?i(j|k)) effgz y $&-$1-$2 effgz-effgz-
148 (bc+d$|ef*g.|h?i(j|k)) ij y $&-$1-$2 ij-ij-j
149 (bc+d$|ef*g.|h?i(j|k)) effg n - -
150 (bc+d$|ef*g.|h?i(j|k)) bcdd n - -
151 (bc+d$|ef*g.|h?i(j|k)) reffgz y $&-$1-$2 effgz-effgz-
152 ((((((((((a)))))))))) a y $10 a
153 ((((((((((a))))))))))\10 aa y $& aa
154 ((((((((((a))))))))))\41 aa n - -
155 ((((((((((a))))))))))\41 a! y $& a!
156 (((((((((a))))))))) a y $& a
157 multiple words of text uh-uh n - -
158 multiple words multiple words, yeah y $& multiple words
159 (.*)c(.*) abcde y $&-$1-$2 abcde-ab-de
160 \((.*), (.*)\) (a, b) y ($2, $1) (b, a)
162 abcd abcd y $&-\$&-\\$& abcd-$&-\abcd
163 a(bc)d abcd y $1-\$1-\\$1 bc-$1-\bc
165 (abc)\1 abcabc y $1 abc
166 ([a-c]*)\1 abcabc y $1 abc
167 \1 - c - /\1/: reference to nonexistent group
168 \2 - c - /\2/: reference to nonexistent group
171 (a)|\2 - c - /(a)|\2/: reference to nonexistent group
172 (([a-c])b*?\2)* ababbbcbc y $&-$1-$2 ababb-bb-b
173 (([a-c])b*?\2){3} ababbbcbc y $&-$1-$2 ababbbcbc-cbc-c
174 ((\3|b)\2(a)x)+ aaxabxbaxbbx n - -
175 ((\3|b)\2(a)x)+ aaaxabaxbaaxbbax y $&-$1-$2-$3 bbax-bbax-b-a
176 ((\3|b)\2(a)){2,} bbaababbabaaaaabbaaaabba y $&-$1-$2-$3 bbaaaabba-bba-b-a
181 'abc'i XABCY y $& ABC
182 'abc'i ABABC y $& ABC
184 'ab*bc'i ABC y $& ABC
185 'ab*bc'i ABBC y $& ABBC
186 'ab*?bc'i ABBBBC y $& ABBBBC
187 'ab{0,}?bc'i ABBBBC y $& ABBBBC
188 'ab+?bc'i ABBC y $& ABBC
191 'ab{1,}bc'i ABQ n - -
192 'ab+bc'i ABBBBC y $& ABBBBC
193 'ab{1,}?bc'i ABBBBC y $& ABBBBC
194 'ab{1,3}?bc'i ABBBBC y $& ABBBBC
195 'ab{3,4}?bc'i ABBBBC y $& ABBBBC
196 'ab{4,5}?bc'i ABBBBC n - -
197 'ab??bc'i ABBC y $& ABBC
198 'ab??bc'i ABC y $& ABC
199 'ab{0,1}?bc'i ABC y $& ABC
200 'ab??bc'i ABBBBC n - -
201 'ab??c'i ABC y $& ABC
202 'ab{0,1}?c'i ABC y $& ABC
203 '^abc$'i ABC y $& ABC
205 '^abc'i ABCC y $& ABC
207 'abc$'i AABC y $& ABC
212 'a.*?c'i AXYZC y $& AXYZC
215 'a[bc]d'i ABD y $& ABD
217 'a[b-d]e'i ACE y $& ACE
218 'a[b-d]'i AAC y $& AC
221 'a[b-a]'i - c - /a[b-a]/: invalid [] range in regexp
222 'a[]b'i - c - /a[]b/: unmatched [] in regexp
223 'a['i - c - /a[/: unmatched [] in regexp
225 'a[]]b'i A]B y $& A]B
226 'a[^bc]d'i AED y $& AED
228 'a[^-b]c'i ADC y $& ADC
231 'a[^]b]c'i ADC y $& ADC
233 'ab|cd'i ABCD y $& AB
234 '()ef'i DEF y $&-$1 EF-
235 '*a'i - c - /*a/: ?+*{} follows nothing in regexp
236 '(*)b'i - c - /(*)b/: ?+*{} follows nothing in regexp
238 'a\'i - c - Search pattern not terminated
239 'a\(b'i A(B y $&-$1 A(B-
241 'a\(*b'i A((B y $& A((B
243 'abc)'i - c - /abc)/: unmatched () in regexp
244 '(abc'i - c - /(abc/: unmatched () in regexp
245 '((a))'i ABC y $&-$1-$2 A-A-A
246 '(a)b(c)'i ABC y $&-$1-$2 ABC-A-C
247 'a+b+c'i AABBABC y $& ABC
248 'a{1,}b{1,}c'i AABBABC y $& ABC
249 'a**'i - c - /a**/: nested *?+ in regexp
250 'a.+?c'i ABCABC y $& ABC
251 'a.*?c'i ABCABC y $& ABC
252 'a.{0,5}?c'i ABCABC y $& ABC
253 '(a+|b)*'i AB y $&-$1 AB-B
254 '(a+|b){0,}'i AB y $&-$1 AB-B
255 '(a+|b)+'i AB y $&-$1 AB-B
256 '(a+|b){1,}'i AB y $&-$1 AB-B
257 '(a+|b)?'i AB y $&-$1 A-A
258 '(a+|b){0,1}'i AB y $&-$1 A-A
259 '(a+|b){0,1}?'i AB y $&-$1 -
260 ')('i - c - /)(/: unmatched () in regexp
261 '[^ab]*'i CDE y $& CDE
264 '([abc])*d'i ABBBCD y $&-$1 ABBBCD-C
265 '([abc])*bcd'i ABCD y $&-$1 ABCD-A
266 'a|b|c|d|e'i E y $& E
267 '(a|b|c|d|e)f'i EF y $&-$1 EF-E
268 'abcd*efg'i ABCDEFG y $& ABCDEFG
269 'ab*'i XABYABBBZ y $& AB
270 'ab*'i XAYABBBZ y $& A
271 '(ab|cd)e'i ABCDE y $&-$1 CDE-CD
272 '[abhgefdc]ij'i HIJ y $& HIJ
273 '^(ab|cd)e'i ABCDE n x$1y XY
274 '(abc|)ef'i ABCDEF y $&-$1 EF-
275 '(a|b)c*d'i ABCD y $&-$1 BCD-B
276 '(ab|ab*)bc'i ABC y $&-$1 ABC-A
277 'a([bc]*)c*'i ABC y $&-$1 ABC-BC
278 'a([bc]*)(c*d)'i ABCD y $&-$1-$2 ABCD-BC-D
279 'a([bc]+)(c*d)'i ABCD y $&-$1-$2 ABCD-BC-D
280 'a([bc]*)(c+d)'i ABCD y $&-$1-$2 ABCD-B-CD
281 'a[bcd]*dcdcde'i ADCDCDE y $& ADCDCDE
282 'a[bcd]+dcdcde'i ADCDCDE n - -
283 '(ab|a)b*c'i ABC y $&-$1 ABC-AB
284 '((a)(b)c)(d)'i ABCD y $1-$2-$3-$4 ABC-A-B-D
285 '[a-zA-Z_][a-zA-Z0-9_]*'i ALPHA y $& ALPHA
286 '^a(bc+|b[eh])g|.h$'i ABH y $&-$1 BH-
287 '(bc+d$|ef*g.|h?i(j|k))'i EFFGZ y $&-$1-$2 EFFGZ-EFFGZ-
288 '(bc+d$|ef*g.|h?i(j|k))'i IJ y $&-$1-$2 IJ-IJ-J
289 '(bc+d$|ef*g.|h?i(j|k))'i EFFG n - -
290 '(bc+d$|ef*g.|h?i(j|k))'i BCDD n - -
291 '(bc+d$|ef*g.|h?i(j|k))'i REFFGZ y $&-$1-$2 EFFGZ-EFFGZ-
292 '((((((((((a))))))))))'i A y $10 A
293 '((((((((((a))))))))))\10'i AA y $& AA
294 '((((((((((a))))))))))\41'i AA n - -
295 '((((((((((a))))))))))\41'i A! y $& A!
296 '(((((((((a)))))))))'i A y $& A
297 '(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))'i A y $1 A
298 '(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))'i C y $1 C
299 'multiple words of text'i UH-UH n - -
300 'multiple words'i MULTIPLE WORDS, YEAH y $& MULTIPLE WORDS
301 '(.*)c(.*)'i ABCDE y $&-$1-$2 ABCDE-AB-DE
302 '\((.*), (.*)\)'i (A, B) y ($2, $1) (B, A)
304 'abcd'i ABCD y $&-\$&-\\$& ABCD-$&-\ABCD
305 'a(bc)d'i ABCD y $1-\$1-\\$1 BC-$1-\BC
307 '(abc)\1'i ABCABC y $1 ABC
308 '([a-c]*)\1'i ABCABC y $1 ABC
311 a(?=c|d). abad y $& ad
312 a(?:b|c|d)(.) ace y $1 e
313 a(?:b|c|d)*(.) ace y $1 e
314 a(?:b|c|d)+?(.) ace y $1 e
315 a(?:b|c|d)+?(.) acdbcdbe y $1 d
316 a(?:b|c|d)+(.) acdbcdbe y $1 e
317 a(?:b|c|d){2}(.) acdbcdbe y $1 b
318 a(?:b|c|d){4,5}(.) acdbcdbe y $1 b
319 a(?:b|c|d){4,5}?(.) acdbcdbe y $1 d
320 ((foo)|(bar))* foobar y $1-$2-$3 bar-foo-bar
321 :(?: - c - /(?/: Sequence (? incomplete
322 a(?:b|c|d){6,7}(.) acdbcdbe y $1 e
323 a(?:b|c|d){6,7}?(.) acdbcdbe y $1 e
324 a(?:b|c|d){5,6}(.) acdbcdbe y $1 e
325 a(?:b|c|d){5,6}?(.) acdbcdbe y $1 b
326 a(?:b|c|d){5,7}(.) acdbcdbe y $1 e
327 a(?:b|c|d){5,7}?(.) acdbcdbe y $1 b
328 a(?:b|(c|e){1,2}?|d)+?(.) ace y $1$2 ce
330 ^([^a-z])|(\^)$ . y $1 .
332 ^(a\1?){4}$ aaaaaaaaaa y $1 aaaa
333 ^(a\1?){4}$ aaaaaaaaa n - -
334 ^(a\1?){4}$ aaaaaaaaaaa n - -
335 ^(a(?(1)\1)){4}$ aaaaaaaaaa y $1 aaaa
336 ^(a(?(1)\1)){4}$ aaaaaaaaa n - -
337 ^(a(?(1)\1)){4}$ aaaaaaaaaaa n - -
338 (?:(f)(o)(o)|(b)(a)(r))* foobar y $1:$2:$3:$4:$5:$6 f:o:o:b:a:r
346 (?<%)b - c - /(?<%)b/: Sequence (?%...) not recognized
347 (?:..)*a aba y $& aba
349 ^(?:b|a(?=(.)))*\1 abc y $& ab
352 ^((a|b)+)*ax aax y $1 a
353 ^((a|bc)+)*ax aax y $1 a
356 (?:(?i)a)b ab y $& ab
357 ((?i)a)b ab y $&:$1 ab:a
358 (?:(?i)a)b Ab y $& Ab
359 ((?i)a)b Ab y $&:$1 Ab:A
362 (?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b))) cabbbb y $& cabbbb
363 (?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb))) caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb y $& caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
364 '(ab)\d\1'i Ab4ab y $1 Ab
365 '(ab)\d\1'i ab4Ab y $1 ab
366 foo\w*\d{4}baz foobar1234baz y $& foobar1234baz
368 a(?{)b - c - /a(?{)b/: Sequence (?{...}) not terminated or not {}-balanced
369 a(?{{})b - c - /a(?{{})b/: Sequence (?{...}) not terminated or not {}-balanced
370 a(?{}})b - c - /a(?{}})b/: Sequence (?{...}) not terminated or not {}-balanced
371 a(?{"{"})b - c - /a(?{"{"})b/: Sequence (?{...}) not terminated or not {}-balanced
372 a(?{"\{"})b cabd y $& ab
373 a(?{"{"}})b - c - Unmatched right bracket
374 a(?{$bl="\{"}).b caxbd y $bl {
375 x(~~)*(?:(?:F)?)? x~~ y - -
376 ^a(?#xxx){3}c aaac y $& aaac
377 '^a (?#xxx) (?#yyy) {3}c'x aaac y $& aaac
378 (?<![cd])b dbcb n - -
379 (?<![cd])[ab] dbaacb y $& a
380 (?<!(c|d))b dbcb n - -
381 (?<!(c|d))[ab] dbaacb y $& a
382 (?<!cd)[ab] cdaccb y $& b
383 ^(?:a?b?)*$ a-- n - -
384 ((?s)^a(.))((?m)^b$) a\nb\nc\n y $1;$2;$3 a\n;\n;b
385 ((?m)^b$) a\nb\nc\n y $1 b
387 (?m)^(b) a\nb\n y $1 b
388 ((?m)^b) a\nb\n y $1 b
389 \n((?m)^b) a\nb\n y $1 b
390 ((?s).)c(?!.) a\nb\nc\n y $1 \n
391 ((?s).)c(?!.) a\nb\nc\n y $1:$& \n:\nc
392 ((?s)b.)c(?!.) a\nb\nc\n y $1 b\n
393 ((?s)b.)c(?!.) a\nb\nc\n y $1:$& b\n:b\nc
396 ((?m)^b) a\nb\nc\n y $1 b
399 (x)?(?(1)a|b) a n - -
400 (x)?(?(1)b|a) a y $& a
401 ()?(?(1)b|a) a y $& a
403 ()?(?(1)a|b) a y $& a
404 ^(\()?blah(?(1)(\)))$ (blah) y $2 )
405 ^(\()?blah(?(1)(\)))$ blah y ($2) ()
406 ^(\()?blah(?(1)(\)))$ blah) n - -
407 ^(\()?blah(?(1)(\)))$ (blah n - -
408 ^(\(+)?blah(?(1)(\)))$ (blah) y $2 )
409 ^(\(+)?blah(?(1)(\)))$ blah y ($2) ()
410 ^(\(+)?blah(?(1)(\)))$ blah) n - -
411 ^(\(+)?blah(?(1)(\)))$ (blah n - -
412 (?(1?)a|b) a c - /(?(1?)a|b)/: Switch (?(number? not recognized
413 (?(1)a|b|c) a c - /(?(1)a|b|c)/: Switch (?(condition)... contains too many branches
415 (?(?{0})b|a) a y $& a
417 (?(?{1})a|b) a y $& a
422 (?=(a+?))(\1ab) aaab y $2 aab
423 ^(?=(a+?))\1ab aaab n - -
424 (\w+:)+ one: y $1 one:
426 (?=(a+?))(\1ab) aaab y $2 aab
427 ^(?=(a+?))\1ab aaab n - -
428 ([\w:]+::)?(\w+)$ abcd: n - -
429 ([\w:]+::)?(\w+)$ abcd y $1-$2 -abcd
430 ([\w:]+::)?(\w+)$ xy:z:::abcd y $1-$2 xy:z:::-abcd
431 ^[^bcd]*(c+) aexycd y $1 c
433 ([\w:]+::)?(\w+)$ abcd: n - -
434 ([\w:]+::)?(\w+)$ abcd y $1-$2 -abcd
435 ([\w:]+::)?(\w+)$ xy:z:::abcd y $1-$2 xy:z:::-abcd
436 ^[^bcd]*(c+) aexycd y $1 c
437 (?{$a=2})a*aa(?{local$a=$a+1})k*c(?{$b=$a}) yaaxxaaaacd y $b 3
438 (?{$a=2})(a(?{local$a=$a+1}))*aak*c(?{$b=$a}) yaaxxaaaacd y $b 4
441 ([[:]+) a:[b]: y $1 :[
442 ([[=]+) a=[b]= y $1 =[
443 ([[.]+) a.[b]. y $1 .[
444 [a[:xyz: - c - /[a[:xyz:/: unmatched [] in regexp
445 [a[:xyz:] - c - /[a[:xyz:]/: unmatched [] in regexp
446 ([a[:xyz:]b]+) pbaq y $1 ba
447 ((?>a+)b) aaab y $1 aaab
448 (?>(a+))b aaab y $1 aaa
449 ((?>[^()]+)|\([^()]*\))+ ((abc(ade)ufh()()x y $& abc(ade)ufh()()x
450 (?<=x+)y - c - /(?<=x+)y/: variable length lookbehind not implemented
451 a{37,17} - c - /a{37,17}/: Can't do {n,m} with n > m