This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Handle /[#]/ and /[(?#]/ with code blocks
[perl5.git] / t / re / re_tests
CommitLineData
5a51db05 1# This stops me getting screenfulls of syntax errors every time I accidentally
1380b51d
DM
2# run this file via a shell glob. The full format of this file is given
3# in regexp.t
2258fb6a 4# Prior to the implementation of autoloading of \N{}, tests that used \N{name}
538b2691
KW
5# could not go in this file, and were farmed out to other .t's, where they
6# remain
1380b51d
DM
7#
8# pat string y/n/etc expr expected-expr skip-reason
5a51db05 9__END__
378cc40b 10abc abc y $& abc
301f462a
MJD
11abc abc y $-[0] 0
12abc abc y $+[0] 3
378cc40b
LW
13abc xbc n - -
14abc axc n - -
15abc abx n - -
16abc xabcy y $& abc
301f462a
MJD
17abc xabcy y $-[0] 1
18abc xabcy y $+[0] 4
378cc40b 19abc ababc y $& abc
301f462a
MJD
20abc ababc y $-[0] 2
21abc ababc y $+[0] 5
378cc40b 22ab*c abc y $& abc
301f462a
MJD
23ab*c abc y $-[0] 0
24ab*c abc y $+[0] 3
378cc40b 25ab*bc abc y $& abc
301f462a
MJD
26ab*bc abc y $-[0] 0
27ab*bc abc y $+[0] 3
378cc40b 28ab*bc abbc y $& abbc
301f462a
MJD
29ab*bc abbc y $-[0] 0
30ab*bc abbc y $+[0] 4
378cc40b 31ab*bc abbbbc y $& abbbbc
301f462a
MJD
32ab*bc abbbbc y $-[0] 0
33ab*bc abbbbc y $+[0] 6
c277df42 34.{1} abbbbc y $& a
301f462a
MJD
35.{1} abbbbc y $-[0] 0
36.{1} abbbbc y $+[0] 1
c277df42 37.{3,4} abbbbc y $& abbb
301f462a
MJD
38.{3,4} abbbbc y $-[0] 0
39.{3,4} abbbbc y $+[0] 4
afefe6bf
RGS
40\N{1} abbbbc y $& a
41\N{1} abbbbc y $-[0] 0
42\N{1} abbbbc y $+[0] 1
c3c41406
KW
43/\N {1}/x abbbbc y $& a
44/\N {1}/x abbbbc y $-[0] 0
45/\N {1}/x abbbbc y $+[0] 1
afefe6bf
RGS
46\N{3,4} abbbbc y $& abbb
47\N{3,4} abbbbc y $-[0] 0
48\N{3,4} abbbbc y $+[0] 4
c3c41406
KW
49/\N {3,4}/x abbbbc y $& abbb
50/\N {3,4}/x abbbbc y $-[0] 0
51/\N {3,4}/x abbbbc y $+[0] 4
a687059c 52ab{0,}bc abbbbc y $& abbbbc
301f462a
MJD
53ab{0,}bc abbbbc y $-[0] 0
54ab{0,}bc abbbbc y $+[0] 6
378cc40b 55ab+bc abbc y $& abbc
301f462a
MJD
56ab+bc abbc y $-[0] 0
57ab+bc abbc y $+[0] 4
378cc40b
LW
58ab+bc abc n - -
59ab+bc abq n - -
a687059c 60ab{1,}bc abq n - -
378cc40b 61ab+bc abbbbc y $& abbbbc
301f462a
MJD
62ab+bc abbbbc y $-[0] 0
63ab+bc abbbbc y $+[0] 6
a687059c 64ab{1,}bc abbbbc y $& abbbbc
301f462a
MJD
65ab{1,}bc abbbbc y $-[0] 0
66ab{1,}bc abbbbc y $+[0] 6
a687059c 67ab{1,3}bc abbbbc y $& abbbbc
301f462a
MJD
68ab{1,3}bc abbbbc y $-[0] 0
69ab{1,3}bc abbbbc y $+[0] 6
a687059c 70ab{3,4}bc abbbbc y $& abbbbc
301f462a
MJD
71ab{3,4}bc abbbbc y $-[0] 0
72ab{3,4}bc abbbbc y $+[0] 6
a687059c 73ab{4,5}bc abbbbc n - -
378cc40b
LW
74ab?bc abbc y $& abbc
75ab?bc abc y $& abc
a687059c 76ab{0,1}bc abc y $& abc
378cc40b
LW
77ab?bc abbbbc n - -
78ab?c abc y $& abc
a687059c 79ab{0,1}c abc y $& abc
378cc40b
LW
80^abc$ abc y $& abc
81^abc$ abcc n - -
82^abc abcc y $& abc
83^abc$ aabc n - -
84abc$ aabc y $& abc
c277df42 85abc$ aabcd n - -
378cc40b
LW
86^ abc y $&
87$ abc y $&
88a.c abc y $& abc
89a.c axc y $& axc
afefe6bf 90a\Nc abc y $& abc
c3c41406 91/a\N c/x abc y $& abc
378cc40b 92a.*c axyzc y $& axyzc
cbf4a129 93a\N*c axyzc y $& axyzc
c3c41406 94/a\N *c/x axyzc y $& axyzc
378cc40b 95a.*c axyzd n - -
afefe6bf 96a\N*c axyzd n - -
c3c41406 97/a\N *c/x axyzd n - -
378cc40b
LW
98a[bc]d abc n - -
99a[bc]d abd y $& abd
3b968408
YO
100a[b]d abd y $& abd
101[a][b][d] abd y $& abd
102.[b]. abd y $& abd
103.[b]. aBd n - -
104(?i:.[b].) abd y $& abd
afefe6bf 105(?i:\N[b]\N) abd y $& abd
378cc40b
LW
106a[b-d]e abd n - -
107a[b-d]e ace y $& ace
108a[b-d] aac y $& ac
109a[-b] a- y $& a-
110a[b-] a- y $& a-
073b366a 111a[b-a] - c - Invalid [] range
24b61696
RK
112a[]b - c - Unmatched [
113a[ - c - Unmatched [
378cc40b
LW
114a] a] y $& a]
115a[]]b a]b y $& a]b
116a[^bc]d aed y $& aed
117a[^bc]d abd n - -
118a[^-b]c adc y $& adc
119a[^-b]c a-c n - -
120a[^]b]c a]c n - -
121a[^]b]c adc y $& adc
bbce6d69
PP
122\ba\b a- y - -
123\ba\b -a y - -
124\ba\b -a- y - -
125\by\b xy n - -
126\by\b yz n - -
127\by\b xyz n - -
128\Ba\B a- n - -
129\Ba\B -a n - -
130\Ba\B -a- n - -
131\By\b xy y - -
301f462a
MJD
132\By\b xy y $-[0] 1
133\By\b xy y $+[0] 2
134\By\b xy y - -
bbce6d69
PP
135\by\B yz y - -
136\By\B xyz y - -
137\w a y - -
138\w - n - -
139\W a n - -
140\W - y - -
141a\sb a b y - -
142a\sb a-b n - -
143a\Sb a b n - -
144a\Sb a-b y - -
145\d 1 y - -
146\d - n - -
147\D 1 n - -
148\D - y - -
149[\w] a y - -
150[\w] - n - -
151[\W] a n - -
152[\W] - y - -
153a[\s]b a b y - -
154a[\s]b a-b n - -
155a[\S]b a b n - -
156a[\S]b a-b y - -
157[\d] 1 y - -
158[\d] - n - -
159[\D] 1 n - -
160[\D] - y - -
378cc40b
LW
161ab|cd abc y $& ab
162ab|cd abcd y $& ab
163()ef def y $&-$1 ef-
301f462a
MJD
164()ef def y $-[0] 1
165()ef def y $+[0] 3
3de645a8 166()\x{100}\x{1000} d\x{100}\x{1000} y $+[0] 3
301f462a
MJD
167()ef def y $-[1] 1
168()ef def y $+[1] 1
24b61696 169*a - c - Quantifier follows nothing
e2e6a0f1
YO
170(|*)b - c - Quantifier follows nothing
171(*)b - c - Unknown verb
378cc40b 172$b b n - -
1b1626e4 173a\ - c - Search pattern not terminated
378cc40b
LW
174a\(b a(b y $&-$1 a(b-
175a\(*b ab y $& ab
176a\(*b a((b y $& a((b
b2a156bd 177a\\b a\\b y $& a\\b
24b61696
RK
178abc) - c - Unmatched )
179(abc - c - Unmatched (
378cc40b 180((a)) abc y $&-$1-$2 a-a-a
301f462a
MJD
181((a)) abc y $-[0]-$-[1]-$-[2] 0-0-0
182((a)) abc y $+[0]-$+[1]-$+[2] 1-1-1
183((a)) abc b @- 0 0 0
184((a)) abc b @+ 1 1 1
378cc40b 185(a)b(c) abc y $&-$1-$2 abc-a-c
301f462a
MJD
186(a)b(c) abc y $-[0]-$-[1]-$-[2] 0-0-2
187(a)b(c) abc y $+[0]-$+[1]-$+[2] 3-1-3
378cc40b 188a+b+c aabbabc y $& abc
a687059c 189a{1,}b{1,}c aabbabc y $& abc
24b61696 190a** - c - Nested quantifiers
a0d0e21e 191a.+?c abcabc y $& abc
378cc40b 192(a+|b)* ab y $&-$1 ab-b
301f462a
MJD
193(a+|b)* ab y $-[0] 0
194(a+|b)* ab y $+[0] 2
195(a+|b)* ab y $-[1] 1
196(a+|b)* ab y $+[1] 2
a687059c 197(a+|b){0,} ab y $&-$1 ab-b
378cc40b 198(a+|b)+ ab y $&-$1 ab-b
a687059c 199(a+|b){1,} ab y $&-$1 ab-b
378cc40b 200(a+|b)? ab y $&-$1 a-a
a687059c 201(a+|b){0,1} ab y $&-$1 a-a
24b61696 202)( - c - Unmatched )
378cc40b
LW
203[^ab]* cde y $& cde
204abc n - -
205a* y $&
206([abc])*d abbbcd y $&-$1 abbbcd-c
207([abc])*bcd abcd y $&-$1 abcd-a
208a|b|c|d|e e y $& e
209(a|b|c|d|e)f ef y $&-$1 ef-e
301f462a
MJD
210(a|b|c|d|e)f ef y $-[0] 0
211(a|b|c|d|e)f ef y $+[0] 2
212(a|b|c|d|e)f ef y $-[1] 0
213(a|b|c|d|e)f ef y $+[1] 1
378cc40b
LW
214abcd*efg abcdefg y $& abcdefg
215ab* xabyabbbz y $& ab
216ab* xayabbbz y $& a
217(ab|cd)e abcde y $&-$1 cde-cd
218[abhgefdc]ij hij y $& hij
219^(ab|cd)e abcde n x$1y xy
220(abc|)ef abcdef y $&-$1 ef-
221(a|b)c*d abcd y $&-$1 bcd-b
222(ab|ab*)bc abc y $&-$1 abc-a
223a([bc]*)c* abc y $&-$1 abc-bc
224a([bc]*)(c*d) abcd y $&-$1-$2 abcd-bc-d
301f462a
MJD
225a([bc]*)(c*d) abcd y $-[0] 0
226a([bc]*)(c*d) abcd y $+[0] 4
227a([bc]*)(c*d) abcd y $-[1] 1
228a([bc]*)(c*d) abcd y $+[1] 3
229a([bc]*)(c*d) abcd y $-[2] 3
230a([bc]*)(c*d) abcd y $+[2] 4
378cc40b
LW
231a([bc]+)(c*d) abcd y $&-$1-$2 abcd-bc-d
232a([bc]*)(c+d) abcd y $&-$1-$2 abcd-b-cd
301f462a
MJD
233a([bc]*)(c+d) abcd y $-[0] 0
234a([bc]*)(c+d) abcd y $+[0] 4
235a([bc]*)(c+d) abcd y $-[1] 1
236a([bc]*)(c+d) abcd y $+[1] 2
237a([bc]*)(c+d) abcd y $-[2] 2
238a([bc]*)(c+d) abcd y $+[2] 4
378cc40b
LW
239a[bcd]*dcdcde adcdcde y $& adcdcde
240a[bcd]+dcdcde adcdcde n - -
241(ab|a)b*c abc y $&-$1 abc-ab
301f462a
MJD
242(ab|a)b*c abc y $-[0] 0
243(ab|a)b*c abc y $+[0] 3
244(ab|a)b*c abc y $-[1] 0
245(ab|a)b*c abc y $+[1] 2
378cc40b 246((a)(b)c)(d) abcd y $1-$2-$3-$4 abc-a-b-d
301f462a
MJD
247((a)(b)c)(d) abcd y $-[0] 0
248((a)(b)c)(d) abcd y $+[0] 4
249((a)(b)c)(d) abcd y $-[1] 0
250((a)(b)c)(d) abcd y $+[1] 3
251((a)(b)c)(d) abcd y $-[2] 0
252((a)(b)c)(d) abcd y $+[2] 1
253((a)(b)c)(d) abcd y $-[3] 1
254((a)(b)c)(d) abcd y $+[3] 2
255((a)(b)c)(d) abcd y $-[4] 3
256((a)(b)c)(d) abcd y $+[4] 4
378cc40b
LW
257[a-zA-Z_][a-zA-Z0-9_]* alpha y $& alpha
258^a(bc+|b[eh])g|.h$ abh y $&-$1 bh-
259(bc+d$|ef*g.|h?i(j|k)) effgz y $&-$1-$2 effgz-effgz-
260(bc+d$|ef*g.|h?i(j|k)) ij y $&-$1-$2 ij-ij-j
261(bc+d$|ef*g.|h?i(j|k)) effg n - -
262(bc+d$|ef*g.|h?i(j|k)) bcdd n - -
263(bc+d$|ef*g.|h?i(j|k)) reffgz y $&-$1-$2 effgz-effgz-
fe14fcc3 264((((((((((a)))))))))) a y $10 a
301f462a
MJD
265((((((((((a)))))))))) a y $-[0] 0
266((((((((((a)))))))))) a y $+[0] 1
267((((((((((a)))))))))) a y $-[10] 0
268((((((((((a)))))))))) a y $+[10] 1
fe14fcc3 269((((((((((a))))))))))\10 aa y $& aa
9d116dd7
JH
270((((((((((a))))))))))${bang} aa n - -
271((((((((((a))))))))))${bang} a! y $& a!
378cc40b
LW
272(((((((((a))))))))) a y $& a
273multiple words of text uh-uh n - -
274multiple words multiple words, yeah y $& multiple words
275(.*)c(.*) abcde y $&-$1-$2 abcde-ab-de
276\((.*), (.*)\) (a, b) y ($2, $1) (b, a)
277[k] ab n - -
b2a156bd
DM
278abcd abcd y $&-\$&-\\$& abcd-\$&-\\abcd
279a(bc)d abcd y $1-\$1-\\$1 bc-\$1-\\bc
378cc40b
LW
280a[-]?c ac y $& ac
281(abc)\1 abcabc y $1 abc
282([a-c]*)\1 abcabc y $1 abc
9baa0206
HS
283\1 - c - Reference to nonexistent group
284\2 - c - Reference to nonexistent group
88307081
RGS
285\g1 - c - Reference to nonexistent group
286\g-1 - c - Reference to nonexistent or unclosed group
287\g{1} - c - Reference to nonexistent group
288\g{-1} - c - Reference to nonexistent or unclosed group
289\g0 - c - Reference to invalid group 0
290\g-0 - c - Reference to invalid group 0
291\g{0} - c - Reference to invalid group 0
292\g{-0} - c - Reference to invalid group 0
ef64f398 293(a)|\1 a y - -
40863337
ML
294(a)|\1 x n - Reference to group in different branch
295(?:(b)?a)\1 a n - Reference to group that did not match
9baa0206 296(a)|\2 - c - Reference to nonexistent group
ef64f398
HS
297(([a-c])b*?\2)* ababbbcbc y $&-$1-$2 ababb-bb-b
298(([a-c])b*?\2){3} ababbbcbc y $&-$1-$2 ababbbcbc-cbc-c
299((\3|b)\2(a)x)+ aaxabxbaxbbx n - -
300((\3|b)\2(a)x)+ aaaxabaxbaaxbbax y $&-$1-$2-$3 bbax-bbax-b-a
301((\3|b)\2(a)){2,} bbaababbabaaaaabbaaaabba y $&-$1-$2-$3 bbaaaabba-bba-b-a
ee1d8f2a
RU
302#Bug #3589 - up to perl-5.6.0 matches incorrectly, from 5.6.1 not anymore
303^((.)?a\2)+$ babadad n - -
301f462a
MJD
304(a)|(b) b y $-[0] 0
305(a)|(b) b y $+[0] 1
306(a)|(b) b y x$-[1] x
307(a)|(b) b y x$+[1] x
308(a)|(b) b y $-[2] 0
309(a)|(b) b y $+[2] 1
1462b684
LW
310'abc'i ABC y $& ABC
311'abc'i XBC n - -
312'abc'i AXC n - -
313'abc'i ABX n - -
314'abc'i XABCY y $& ABC
315'abc'i ABABC y $& ABC
316'ab*c'i ABC y $& ABC
317'ab*bc'i ABC y $& ABC
318'ab*bc'i ABBC y $& ABBC
a0d0e21e
LW
319'ab*?bc'i ABBBBC y $& ABBBBC
320'ab{0,}?bc'i ABBBBC y $& ABBBBC
321'ab+?bc'i ABBC y $& ABBC
1462b684
LW
322'ab+bc'i ABC n - -
323'ab+bc'i ABQ n - -
324'ab{1,}bc'i ABQ n - -
325'ab+bc'i ABBBBC y $& ABBBBC
a0d0e21e
LW
326'ab{1,}?bc'i ABBBBC y $& ABBBBC
327'ab{1,3}?bc'i ABBBBC y $& ABBBBC
328'ab{3,4}?bc'i ABBBBC y $& ABBBBC
329'ab{4,5}?bc'i ABBBBC n - -
330'ab??bc'i ABBC y $& ABBC
331'ab??bc'i ABC y $& ABC
332'ab{0,1}?bc'i ABC y $& ABC
333'ab??bc'i ABBBBC n - -
334'ab??c'i ABC y $& ABC
335'ab{0,1}?c'i ABC y $& ABC
1462b684
LW
336'^abc$'i ABC y $& ABC
337'^abc$'i ABCC n - -
338'^abc'i ABCC y $& ABC
339'^abc$'i AABC n - -
340'abc$'i AABC y $& ABC
341'^'i ABC y $&
342'$'i ABC y $&
343'a.c'i ABC y $& ABC
344'a.c'i AXC y $& AXC
afefe6bf 345'a\Nc'i ABC y $& ABC
a0d0e21e 346'a.*?c'i AXYZC y $& AXYZC
1462b684
LW
347'a.*c'i AXYZD n - -
348'a[bc]d'i ABC n - -
349'a[bc]d'i ABD y $& ABD
350'a[b-d]e'i ABD n - -
351'a[b-d]e'i ACE y $& ACE
352'a[b-d]'i AAC y $& AC
353'a[-b]'i A- y $& A-
354'a[b-]'i A- y $& A-
073b366a 355'a[b-a]'i - c - Invalid [] range
24b61696
RK
356'a[]b'i - c - Unmatched [
357'a['i - c - Unmatched [
1462b684
LW
358'a]'i A] y $& A]
359'a[]]b'i A]B y $& A]B
360'a[^bc]d'i AED y $& AED
361'a[^bc]d'i ABD n - -
362'a[^-b]c'i ADC y $& ADC
363'a[^-b]c'i A-C n - -
364'a[^]b]c'i A]C n - -
365'a[^]b]c'i ADC y $& ADC
366'ab|cd'i ABC y $& AB
367'ab|cd'i ABCD y $& AB
368'()ef'i DEF y $&-$1 EF-
24b61696 369'*a'i - c - Quantifier follows nothing
e2e6a0f1
YO
370'(|*)b'i - c - Quantifier follows nothing
371'(*)b'i - c - Unknown verb
1462b684 372'$b'i B n - -
1b1626e4 373'a\'i - c - Search pattern not terminated
1462b684
LW
374'a\(b'i A(B y $&-$1 A(B-
375'a\(*b'i AB y $& AB
376'a\(*b'i A((B y $& A((B
b2a156bd 377'a\\b'i A\\B y $& A\\B
24b61696
RK
378'abc)'i - c - Unmatched )
379'(abc'i - c - Unmatched (
1462b684
LW
380'((a))'i ABC y $&-$1-$2 A-A-A
381'(a)b(c)'i ABC y $&-$1-$2 ABC-A-C
382'a+b+c'i AABBABC y $& ABC
383'a{1,}b{1,}c'i AABBABC y $& ABC
24b61696 384'a**'i - c - Nested quantifiers
a0d0e21e
LW
385'a.+?c'i ABCABC y $& ABC
386'a.*?c'i ABCABC y $& ABC
387'a.{0,5}?c'i ABCABC y $& ABC
1462b684
LW
388'(a+|b)*'i AB y $&-$1 AB-B
389'(a+|b){0,}'i AB y $&-$1 AB-B
390'(a+|b)+'i AB y $&-$1 AB-B
391'(a+|b){1,}'i AB y $&-$1 AB-B
392'(a+|b)?'i AB y $&-$1 A-A
393'(a+|b){0,1}'i AB y $&-$1 A-A
a0d0e21e 394'(a+|b){0,1}?'i AB y $&-$1 -
24b61696 395')('i - c - Unmatched )
1462b684
LW
396'[^ab]*'i CDE y $& CDE
397'abc'i n - -
398'a*'i y $&
399'([abc])*d'i ABBBCD y $&-$1 ABBBCD-C
400'([abc])*bcd'i ABCD y $&-$1 ABCD-A
401'a|b|c|d|e'i E y $& E
402'(a|b|c|d|e)f'i EF y $&-$1 EF-E
1462b684
LW
403'abcd*efg'i ABCDEFG y $& ABCDEFG
404'ab*'i XABYABBBZ y $& AB
405'ab*'i XAYABBBZ y $& A
406'(ab|cd)e'i ABCDE y $&-$1 CDE-CD
407'[abhgefdc]ij'i HIJ y $& HIJ
408'^(ab|cd)e'i ABCDE n x$1y XY
409'(abc|)ef'i ABCDEF y $&-$1 EF-
410'(a|b)c*d'i ABCD y $&-$1 BCD-B
411'(ab|ab*)bc'i ABC y $&-$1 ABC-A
412'a([bc]*)c*'i ABC y $&-$1 ABC-BC
413'a([bc]*)(c*d)'i ABCD y $&-$1-$2 ABCD-BC-D
414'a([bc]+)(c*d)'i ABCD y $&-$1-$2 ABCD-BC-D
415'a([bc]*)(c+d)'i ABCD y $&-$1-$2 ABCD-B-CD
416'a[bcd]*dcdcde'i ADCDCDE y $& ADCDCDE
417'a[bcd]+dcdcde'i ADCDCDE n - -
418'(ab|a)b*c'i ABC y $&-$1 ABC-AB
419'((a)(b)c)(d)'i ABCD y $1-$2-$3-$4 ABC-A-B-D
420'[a-zA-Z_][a-zA-Z0-9_]*'i ALPHA y $& ALPHA
421'^a(bc+|b[eh])g|.h$'i ABH y $&-$1 BH-
422'(bc+d$|ef*g.|h?i(j|k))'i EFFGZ y $&-$1-$2 EFFGZ-EFFGZ-
423'(bc+d$|ef*g.|h?i(j|k))'i IJ y $&-$1-$2 IJ-IJ-J
424'(bc+d$|ef*g.|h?i(j|k))'i EFFG n - -
425'(bc+d$|ef*g.|h?i(j|k))'i BCDD n - -
426'(bc+d$|ef*g.|h?i(j|k))'i REFFGZ y $&-$1-$2 EFFGZ-EFFGZ-
427'((((((((((a))))))))))'i A y $10 A
428'((((((((((a))))))))))\10'i AA y $& AA
9d116dd7
JH
429'((((((((((a))))))))))${bang}'i AA n - -
430'((((((((((a))))))))))${bang}'i A! y $& A!
1462b684 431'(((((((((a)))))))))'i A y $& A
a0d0e21e
LW
432'(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))'i A y $1 A
433'(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))'i C y $1 C
1462b684
LW
434'multiple words of text'i UH-UH n - -
435'multiple words'i MULTIPLE WORDS, YEAH y $& MULTIPLE WORDS
436'(.*)c(.*)'i ABCDE y $&-$1-$2 ABCDE-AB-DE
437'\((.*), (.*)\)'i (A, B) y ($2, $1) (B, A)
438'[k]'i AB n - -
b2a156bd
DM
439'abcd'i ABCD y $&-\$&-\\$& ABCD-\$&-\\ABCD
440'a(bc)d'i ABCD y $1-\$1-\\$1 BC-\$1-\\BC
1462b684
LW
441'a[-]?c'i AC y $& AC
442'(abc)\1'i ABCABC y $1 ABC
443'([a-c]*)\1'i ABCABC y $1 ABC
a0d0e21e 444a(?!b). abad y $& ad
89c6a13e 445(?=)a a y $& a
a0d0e21e
LW
446a(?=d). abad y $& ad
447a(?=c|d). abad y $& ad
448a(?:b|c|d)(.) ace y $1 e
449a(?:b|c|d)*(.) ace y $1 e
450a(?:b|c|d)+?(.) ace y $1 e
c277df42
IZ
451a(?:b|c|d)+?(.) acdbcdbe y $1 d
452a(?:b|c|d)+(.) acdbcdbe y $1 e
453a(?:b|c|d){2}(.) acdbcdbe y $1 b
454a(?:b|c|d){4,5}(.) acdbcdbe y $1 b
455a(?:b|c|d){4,5}?(.) acdbcdbe y $1 d
456((foo)|(bar))* foobar y $1-$2-$3 bar-foo-bar
9baa0206 457:(?: - c - Sequence (? incomplete
c277df42
IZ
458a(?:b|c|d){6,7}(.) acdbcdbe y $1 e
459a(?:b|c|d){6,7}?(.) acdbcdbe y $1 e
460a(?:b|c|d){5,6}(.) acdbcdbe y $1 e
461a(?:b|c|d){5,6}?(.) acdbcdbe y $1 b
462a(?:b|c|d){5,7}(.) acdbcdbe y $1 e
463a(?:b|c|d){5,7}?(.) acdbcdbe y $1 b
a0d0e21e
LW
464a(?:b|(c|e){1,2}?|d)+?(.) ace y $1$2 ce
465^(.+)?B AB y $1 A
c277df42
IZ
466^([^a-z])|(\^)$ . y $1 .
467^[<>]& <&OUT y $& <&
468^(a\1?){4}$ aaaaaaaaaa y $1 aaaa
469^(a\1?){4}$ aaaaaaaaa n - -
470^(a\1?){4}$ aaaaaaaaaaa n - -
af3f8c16
IZ
471^(a(?(1)\1)){4}$ aaaaaaaaaa y $1 aaaa
472^(a(?(1)\1)){4}$ aaaaaaaaa n - -
473^(a(?(1)\1)){4}$ aaaaaaaaaaa n - -
708e3b05
IZ
474((a{4})+) aaaaaaaaa y $1 aaaaaaaa
475(((aa){2})+) aaaaaaaaaa y $1 aaaaaaaa
476(((a{2}){2})+) aaaaaaaaaa y $1 aaaaaaaa
c277df42
IZ
477(?:(f)(o)(o)|(b)(a)(r))* foobar y $1:$2:$3:$4:$5:$6 f:o:o:b:a:r
478(?<=a)b ab y $& b
479(?<=a)b cb n - -
480(?<=a)b b n - -
481(?<!c)b ab y $& b
482(?<!c)b cb n - -
483(?<!c)b b y - -
484(?<!c)b b y $& b
1f4f6bf1 485(?<%)b - c - Group name must start with a non-digit word character
c277df42
IZ
486(?:..)*a aba y $& aba
487(?:..)*?a aba y $& a
488^(?:b|a(?=(.)))*\1 abc y $& ab
489^(){3,5} abc y a$1 a
490^(a+)*ax aax y $1 a
491^((a|b)+)*ax aax y $1 a
492^((a|bc)+)*ax aax y $1 a
493(a|x)*ab cab y y$1 y
494(a)*ab cab y y$1 y
495(?:(?i)a)b ab y $& ab
496((?i)a)b ab y $&:$1 ab:a
497(?:(?i)a)b Ab y $& Ab
498((?i)a)b Ab y $&:$1 Ab:A
499(?:(?i)a)b aB n - -
500((?i)a)b aB n - -
ca9dfc88
IZ
501(?i:a)b ab y $& ab
502((?i:a))b ab y $&:$1 ab:a
503(?i:a)b Ab y $& Ab
504((?i:a))b Ab y $&:$1 Ab:A
505(?i:a)b aB n - -
506((?i:a))b aB n - -
507'(?:(?-i)a)b'i ab y $& ab
508'((?-i)a)b'i ab y $&:$1 ab:a
509'(?:(?-i)a)b'i aB y $& aB
510'((?-i)a)b'i aB y $&:$1 aB:a
511'(?:(?-i)a)b'i Ab n - -
512'((?-i)a)b'i Ab n - -
513'(?:(?-i)a)b'i aB y $& aB
514'((?-i)a)b'i aB y $1 a
515'(?:(?-i)a)b'i AB n - -
516'((?-i)a)b'i AB n - -
517'(?-i:a)b'i ab y $& ab
518'((?-i:a))b'i ab y $&:$1 ab:a
519'(?-i:a)b'i aB y $& aB
520'((?-i:a))b'i aB y $&:$1 aB:a
521'(?-i:a)b'i Ab n - -
522'((?-i:a))b'i Ab n - -
523'(?-i:a)b'i aB y $& aB
524'((?-i:a))b'i aB y $1 a
525'(?-i:a)b'i AB n - -
526'((?-i:a))b'i AB n - -
527'((?-i:a.))b'i a\nB n - -
afefe6bf 528'((?-i:a\N))b'i a\nB n - -
ca9dfc88 529'((?s-i:a.))b'i a\nB y $1 a\n
afefe6bf 530'((?s-i:a\N))b'i a\nB n - -
ca9dfc88 531'((?s-i:a.))b'i B\nB n - -
afefe6bf 532'((?s-i:a\N))b'i B\nB n - -
c277df42
IZ
533(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b))) cabbbb y $& cabbbb
534(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb))) caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb y $& caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
535'(ab)\d\1'i Ab4ab y $1 Ab
536'(ab)\d\1'i ab4Ab y $1 ab
ad4f75a6 537foo\w*\d{4}baz foobar1234baz y $& foobar1234baz
61525e55 538a(?{})b cabd y $& ab
9da1dd8f
DM
539a(?{f()+ - c - Missing right curly or square bracket
540a(?{{1}+ - c - Missing right curly or square bracket
380a0633 541a(?{}})b - c -
b30fcab9 542a(?{"{"})b ab y - -
61525e55 543a(?{"\{"})b cabd y $& ab
9da1dd8f 544a(?{"{"}})b - c - Sequence (?{...}) not terminated with ')'
94c1d7aa 545a(?{$::bl="\{"}).b caxbd y $::bl {
c277df42
IZ
546x(~~)*(?:(?:F)?)? x~~ y - -
547^a(?#xxx){3}c aaac y $& aaac
548'^a (?#xxx) (?#yyy) {3}c'x aaac y $& aaac
549(?<![cd])b dbcb n - -
550(?<![cd])[ab] dbaacb y $& a
551(?<!(c|d))b dbcb n - -
552(?<!(c|d))[ab] dbaacb y $& a
553(?<!cd)[ab] cdaccb y $& b
554^(?:a?b?)*$ a-- n - -
555((?s)^a(.))((?m)^b$) a\nb\nc\n y $1;$2;$3 a\n;\n;b
556((?m)^b$) a\nb\nc\n y $1 b
557(?m)^b a\nb\n y $& b
558(?m)^(b) a\nb\n y $1 b
559((?m)^b) a\nb\n y $1 b
560\n((?m)^b) a\nb\n y $1 b
561((?s).)c(?!.) a\nb\nc\n y $1 \n
562((?s).)c(?!.) a\nb\nc\n y $1:$& \n:\nc
563((?s)b.)c(?!.) a\nb\nc\n y $1 b\n
564((?s)b.)c(?!.) a\nb\nc\n y $1:$& b\n:b\nc
cbf4a129
RGS
565((?s)b.)c(?!\N) a\nb\nc\n y $1:$& b\n:b\nc
566'(b.)c(?!\N)'s a\nb\nc\n y $1:$& b\n:b\nc
c277df42
IZ
567^b a\nb\nc\n n - -
568()^b a\nb\nc\n n - -
569((?m)^b) a\nb\nc\n y $1 b
570(?(1)a|b) a n - -
571(?(1)b|a) a y $& a
572(x)?(?(1)a|b) a n - -
573(x)?(?(1)b|a) a y $& a
574()?(?(1)b|a) a y $& a
575()(?(1)b|a) a n - -
576()?(?(1)a|b) a y $& a
577^(\()?blah(?(1)(\)))$ (blah) y $2 )
578^(\()?blah(?(1)(\)))$ blah y ($2) ()
579^(\()?blah(?(1)(\)))$ blah) n - -
580^(\()?blah(?(1)(\)))$ (blah n - -
581^(\(+)?blah(?(1)(\)))$ (blah) y $2 )
582^(\(+)?blah(?(1)(\)))$ blah y ($2) ()
583^(\(+)?blah(?(1)(\)))$ blah) n - -
584^(\(+)?blah(?(1)(\)))$ (blah n - -
0f7276ab
KW
585(?(1?)a|b) - c - Switch condition not recognized
586(?(1)a|b|c) - c - Switch (?(condition)... contains too many branches
61525e55
NC
587(?(?{0})a|b) a n - -
588(?(?{0})b|a) a y $& a
589(?(?{1})b|a) a n - -
590(?(?{1})a|b) a y $& a
c277df42
IZ
591(?(?!a)a|b) a n - -
592(?(?!a)b|a) a y $& a
593(?(?=a)b|a) a n - -
594(?(?=a)a|b) a y $& a
e22f9b1c
NC
595(?(?!\x{100})\x{100}|b) \x{100} n - -
596(?(?!\x{100})b|\x{100}) \x{100} y $& \x{100}
597(?(?=\x{100})b|\x{100}) \x{100} n - -
598(?(?=\x{100})\x{100}|b) \x{100} y $& \x{100}
c277df42
IZ
599(?=(a+?))(\1ab) aaab y $2 aab
600^(?=(a+?))\1ab aaab n - -
601(\w+:)+ one: y $1 one:
602$(?<=^(a)) a y $1 a
603(?=(a+?))(\1ab) aaab y $2 aab
604^(?=(a+?))\1ab aaab n - -
605([\w:]+::)?(\w+)$ abcd: n - -
606([\w:]+::)?(\w+)$ abcd y $1-$2 -abcd
607([\w:]+::)?(\w+)$ xy:z:::abcd y $1-$2 xy:z:::-abcd
608^[^bcd]*(c+) aexycd y $1 c
609(a*)b+ caab y $1 aa
610([\w:]+::)?(\w+)$ abcd: n - -
611([\w:]+::)?(\w+)$ abcd y $1-$2 -abcd
612([\w:]+::)?(\w+)$ xy:z:::abcd y $1-$2 xy:z:::-abcd
613^[^bcd]*(c+) aexycd y $1 c
94c1d7aa
DM
614(?{$a=2})a*aa(?{local$a=$a+1})k*c(?{$b=$a}) yaaxxaaaacd y $b 3
615(?{$a=2})(a(?{local$a=$a+1}))*aak*c(?{$b=$a}) yaaxxaaaacd y $b 4
f5df269c
FC
616# [perl #117917]
617^(a(?{ "x" =~ m{x}})b)(??{ $1 }) abab y $& abab
c277df42 618(>a+)ab aaab n - -
fe44a5e8 619(?>a+)b aaab y - -
4599a1de
JH
620([[:]+) a:[b]: y $1 :[
621([[=]+) a=[b]= y $1 =[
622([[.]+) a.[b]. y $1 .[
24b61696
RK
623[a[:xyz: - c - Unmatched [
624[a[:xyz:] - c - POSIX class [:xyz:] unknown
767d463e 625[a[:]b[:c] abc y $& abc
0f7276ab 626([a[:xyz:]b]+) - c - POSIX class [:xyz:] unknown
b8c5462f
JH
627([[:alpha:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd
628([[:alnum:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy
629([[:ascii:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__-- ${nulnul}
630([[:cntrl:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ${nulnul}
631([[:digit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 01
632([[:graph:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__--
633([[:lower:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 cd
634([[:print:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__--
635([[:punct:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 __--
636([[:space:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1
637([[:word:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__
638([[:upper:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 AB
639([[:xdigit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01
640([[:^alpha:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 01
cfaf538b 641((?a)[[:^alnum:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 __-- ${nulnul}${ffff}
b8c5462f
JH
642([[:^ascii:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ${ffff}
643([[:^cntrl:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__--
644([[:^digit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd
645([[:^lower:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 AB
cfaf538b 646((?a)[[:^print:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ${nulnul}${ffff}
b8c5462f
JH
647([[:^punct:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy
648([[:^space:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__--
cfaf538b 649((?a)[[:^word:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 -- ${nulnul}${ffff}
b8c5462f
JH
650([[:^upper:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 cd01
651([[:^xdigit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 Xy__-- ${nulnul}${ffff}
24b61696
RK
652[[:foo:]] - c - POSIX class [:foo:] unknown
653[[:^foo:]] - c - POSIX class [:^foo:] unknown
fe44a5e8
IZ
654((?>a+)b) aaab y $1 aaab
655(?>(a+))b aaab y $1 aaa
c277df42 656((?>[^()]+)|\([^()]*\))+ ((abc(ade)ufh()()x y $& abc(ade)ufh()()x
24b61696 657(?<=x+)y - c - Variable length lookbehind not implemented
31c15ce5 658((def){37,17})?ABC ABC y $& ABC
cf93c79d
IZ
659\Z a\nb\n y $-[0] 3
660\z a\nb\n y $-[0] 4
661$ a\nb\n y $-[0] 3
662\Z b\na\n y $-[0] 3
663\z b\na\n y $-[0] 4
664$ b\na\n y $-[0] 3
665\Z b\na y $-[0] 3
666\z b\na y $-[0] 3
667$ b\na y $-[0] 3
668'\Z'm a\nb\n y $-[0] 3
669'\z'm a\nb\n y $-[0] 4
670'$'m a\nb\n y $-[0] 1
671'\Z'm b\na\n y $-[0] 3
672'\z'm b\na\n y $-[0] 4
673'$'m b\na\n y $-[0] 1
674'\Z'm b\na y $-[0] 3
675'\z'm b\na y $-[0] 3
676'$'m b\na y $-[0] 1
b85d18e9 677a\Z a\nb\n n - -
cf93c79d
IZ
678a\z a\nb\n n - -
679a$ a\nb\n n - -
680a\Z b\na\n y $-[0] 2
681a\z b\na\n n - -
682a$ b\na\n y $-[0] 2
683a\Z b\na y $-[0] 2
684a\z b\na y $-[0] 2
685a$ b\na y $-[0] 2
a1917ab9 686'a\Z'm a\nb\n n - -
cf93c79d
IZ
687'a\z'm a\nb\n n - -
688'a$'m a\nb\n y $-[0] 0
689'a\Z'm b\na\n y $-[0] 2
690'a\z'm b\na\n n - -
691'a$'m b\na\n y $-[0] 2
692'a\Z'm b\na y $-[0] 2
693'a\z'm b\na y $-[0] 2
694'a$'m b\na y $-[0] 2
695aa\Z aa\nb\n n - -
696aa\z aa\nb\n n - -
697aa$ aa\nb\n n - -
698aa\Z b\naa\n y $-[0] 2
699aa\z b\naa\n n - -
700aa$ b\naa\n y $-[0] 2
701aa\Z b\naa y $-[0] 2
702aa\z b\naa y $-[0] 2
703aa$ b\naa y $-[0] 2
a1917ab9 704'aa\Z'm aa\nb\n n - -
cf93c79d
IZ
705'aa\z'm aa\nb\n n - -
706'aa$'m aa\nb\n y $-[0] 0
707'aa\Z'm b\naa\n y $-[0] 2
708'aa\z'm b\naa\n n - -
709'aa$'m b\naa\n y $-[0] 2
710'aa\Z'm b\naa y $-[0] 2
711'aa\z'm b\naa y $-[0] 2
712'aa$'m b\naa y $-[0] 2
713aa\Z ac\nb\n n - -
714aa\z ac\nb\n n - -
715aa$ ac\nb\n n - -
716aa\Z b\nac\n n - -
717aa\z b\nac\n n - -
718aa$ b\nac\n n - -
719aa\Z b\nac n - -
720aa\z b\nac n - -
721aa$ b\nac n - -
722'aa\Z'm ac\nb\n n - -
723'aa\z'm ac\nb\n n - -
724'aa$'m ac\nb\n n - -
725'aa\Z'm b\nac\n n - -
726'aa\z'm b\nac\n n - -
727'aa$'m b\nac\n n - -
728'aa\Z'm b\nac n - -
729'aa\z'm b\nac n - -
730'aa$'m b\nac n - -
731aa\Z ca\nb\n n - -
732aa\z ca\nb\n n - -
733aa$ ca\nb\n n - -
734aa\Z b\nca\n n - -
735aa\z b\nca\n n - -
736aa$ b\nca\n n - -
737aa\Z b\nca n - -
738aa\z b\nca n - -
739aa$ b\nca n - -
740'aa\Z'm ca\nb\n n - -
741'aa\z'm ca\nb\n n - -
742'aa$'m ca\nb\n n - -
743'aa\Z'm b\nca\n n - -
744'aa\z'm b\nca\n n - -
745'aa$'m b\nca\n n - -
746'aa\Z'm b\nca n - -
747'aa\z'm b\nca n - -
748'aa$'m b\nca n - -
749ab\Z ab\nb\n n - -
750ab\z ab\nb\n n - -
751ab$ ab\nb\n n - -
752ab\Z b\nab\n y $-[0] 2
753ab\z b\nab\n n - -
754ab$ b\nab\n y $-[0] 2
755ab\Z b\nab y $-[0] 2
756ab\z b\nab y $-[0] 2
757ab$ b\nab y $-[0] 2
a1917ab9 758'ab\Z'm ab\nb\n n - -
cf93c79d
IZ
759'ab\z'm ab\nb\n n - -
760'ab$'m ab\nb\n y $-[0] 0
761'ab\Z'm b\nab\n y $-[0] 2
762'ab\z'm b\nab\n n - -
763'ab$'m b\nab\n y $-[0] 2
764'ab\Z'm b\nab y $-[0] 2
765'ab\z'm b\nab y $-[0] 2
766'ab$'m b\nab y $-[0] 2
767ab\Z ac\nb\n n - -
768ab\z ac\nb\n n - -
769ab$ ac\nb\n n - -
770ab\Z b\nac\n n - -
771ab\z b\nac\n n - -
772ab$ b\nac\n n - -
773ab\Z b\nac n - -
774ab\z b\nac n - -
775ab$ b\nac n - -
776'ab\Z'm ac\nb\n n - -
777'ab\z'm ac\nb\n n - -
778'ab$'m ac\nb\n n - -
779'ab\Z'm b\nac\n n - -
780'ab\z'm b\nac\n n - -
781'ab$'m b\nac\n n - -
782'ab\Z'm b\nac n - -
783'ab\z'm b\nac n - -
784'ab$'m b\nac n - -
785ab\Z ca\nb\n n - -
786ab\z ca\nb\n n - -
787ab$ ca\nb\n n - -
788ab\Z b\nca\n n - -
789ab\z b\nca\n n - -
790ab$ b\nca\n n - -
791ab\Z b\nca n - -
792ab\z b\nca n - -
793ab$ b\nca n - -
794'ab\Z'm ca\nb\n n - -
795'ab\z'm ca\nb\n n - -
796'ab$'m ca\nb\n n - -
797'ab\Z'm b\nca\n n - -
798'ab\z'm b\nca\n n - -
799'ab$'m b\nca\n n - -
800'ab\Z'm b\nca n - -
801'ab\z'm b\nca n - -
802'ab$'m b\nca n - -
803abb\Z abb\nb\n n - -
804abb\z abb\nb\n n - -
805abb$ abb\nb\n n - -
806abb\Z b\nabb\n y $-[0] 2
807abb\z b\nabb\n n - -
808abb$ b\nabb\n y $-[0] 2
809abb\Z b\nabb y $-[0] 2
810abb\z b\nabb y $-[0] 2
811abb$ b\nabb y $-[0] 2
a1917ab9 812'abb\Z'm abb\nb\n n - -
cf93c79d
IZ
813'abb\z'm abb\nb\n n - -
814'abb$'m abb\nb\n y $-[0] 0
815'abb\Z'm b\nabb\n y $-[0] 2
816'abb\z'm b\nabb\n n - -
817'abb$'m b\nabb\n y $-[0] 2
818'abb\Z'm b\nabb y $-[0] 2
819'abb\z'm b\nabb y $-[0] 2
820'abb$'m b\nabb y $-[0] 2
821abb\Z ac\nb\n n - -
822abb\z ac\nb\n n - -
823abb$ ac\nb\n n - -
824abb\Z b\nac\n n - -
825abb\z b\nac\n n - -
826abb$ b\nac\n n - -
827abb\Z b\nac n - -
828abb\z b\nac n - -
829abb$ b\nac n - -
830'abb\Z'm ac\nb\n n - -
831'abb\z'm ac\nb\n n - -
832'abb$'m ac\nb\n n - -
833'abb\Z'm b\nac\n n - -
834'abb\z'm b\nac\n n - -
835'abb$'m b\nac\n n - -
836'abb\Z'm b\nac n - -
837'abb\z'm b\nac n - -
838'abb$'m b\nac n - -
839abb\Z ca\nb\n n - -
840abb\z ca\nb\n n - -
841abb$ ca\nb\n n - -
842abb\Z b\nca\n n - -
843abb\z b\nca\n n - -
844abb$ b\nca\n n - -
845abb\Z b\nca n - -
846abb\z b\nca n - -
847abb$ b\nca n - -
848'abb\Z'm ca\nb\n n - -
849'abb\z'm ca\nb\n n - -
850'abb$'m ca\nb\n n - -
851'abb\Z'm b\nca\n n - -
852'abb\z'm b\nca\n n - -
853'abb$'m b\nca\n n - -
854'abb\Z'm b\nca n - -
855'abb\z'm b\nca n - -
856'abb$'m b\nca n - -
fad493ef 857'\Aa$'m a\n\n y $& a
8e680dc3 858(^|x)(c) ca y $2 c
aca2d497 859a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz x n - -
94c1d7aa 860a(?{$a=2;$b=3;($b)=$a})b yabz y $b 2
9fe1d20c 861round\(((?>[^()]+))\) _I(round(xs * sz),1) y $1 xs * sz
ce3e6498
HS
862'((?x:.) )' x y $1- x -
863'((?-x:.) )'x x y $1- x-
adac82c7 864foo.bart foo.bart y - -
2c2d71f5
JH
865'^d[x][x][x]'m abcd\ndxxx y - -
866.X(.+)+X bbbbXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y - -
867.X(.+)+XX bbbbXcXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y - -
868.XX(.+)+X bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y - -
869.X(.+)+X bbbbXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
870.X(.+)+XX bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
871.XX(.+)+X bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
872.X(.+)+[X] bbbbXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y - -
873.X(.+)+[X][X] bbbbXcXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y - -
874.XX(.+)+[X] bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y - -
875.X(.+)+[X] bbbbXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
876.X(.+)+[X][X] bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
877.XX(.+)+[X] bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
878.[X](.+)+[X] bbbbXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y - -
879.[X](.+)+[X][X] bbbbXcXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y - -
880.[X][X](.+)+[X] bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y - -
881.[X](.+)+[X] bbbbXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
882.[X](.+)+[X][X] bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
883.[X][X](.+)+[X] bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
884tt+$ xxxtt y - -
073b366a
KW
885([a-\d]+) za-9z Sy $1 a-9
886([a-\d]+) - sc - False [] range
887([\d-z]+) a0-za Sy $1 0-z
888([\d-z]+) - sc $1 False [] range
889([\d-\s]+) a0- z Sy $1 0-
890([\d-\s]+) - sc $1 False [] range
891([a-[:digit:]]+) za-9z Sy $1 a-9
892([a-[:digit:]]+) - sc - False [] range
893([[:digit:]-z]+) =0-z= Sy $1 0-z
894([[:digit:]-z]+) - sc c False [] range
895([[:digit:]-[:alpha:]]+) =0-z= Sy $1 0-z
896([[:digit:]-[:alpha:]]+) - sc - False [] range
30382c73 897\GX.*X aaaXbX n - -
6eb5f6b9
JH
898(\d+\.\d+) 3.1415926 y $1 3.1415926
899(\ba.{0,10}br) have a web browser y $1 a web br
66e933ab
GS
900'\.c(pp|xx|c)?$'i Changes n - -
901'\.c(pp|xx|c)?$'i IO.c y - -
902'(\.c(pp|xx|c)?$)'i IO.c y $1 .c
653099ff 903^([a-z]:) C:/ n - -
60e71179 904'^\S\s+aa$'m \nx aa y - -
de0c8cb8 905(^|a)b ab y - -
f06a1d4e 906^([ab]*?)(b)?(c)$ abac y -$2- --
29d1e993 907(\w)?(abc)\1b abcab n - -
2a8d9689
HS
908^(?:.,){2}c a,b,c y - -
909^(.,){2}c a,b,c y $1 b,
910^(?:[^,]*,){2}c a,b,c y - -
911^([^,]*,){2}c a,b,c y $1 b,
4b2cff9a
HS
912^([^,]*,){3}d aaa,b,c,d y $1 c,
913^([^,]*,){3,}d aaa,b,c,d y $1 c,
914^([^,]*,){0,3}d aaa,b,c,d y $1 c,
915^([^,]{1,3},){3}d aaa,b,c,d y $1 c,
916^([^,]{1,3},){3,}d aaa,b,c,d y $1 c,
917^([^,]{1,3},){0,3}d aaa,b,c,d y $1 c,
918^([^,]{1,},){3}d aaa,b,c,d y $1 c,
919^([^,]{1,},){3,}d aaa,b,c,d y $1 c,
920^([^,]{1,},){0,3}d aaa,b,c,d y $1 c,
921^([^,]{0,3},){3}d aaa,b,c,d y $1 c,
922^([^,]{0,3},){3,}d aaa,b,c,d y $1 c,
923^([^,]{0,3},){0,3}d aaa,b,c,d y $1 c,
bf93d4cc 924(?i) y - -
cfaf538b 925(?a:((?u)\w)\W) \xC0\xC0 y $& \xC0\xC0
c2a73568 926'(?!\A)x'm a\nxb\n y - -
c1d44abf
JH
927^(a(b)?)+$ aba y -$1-$2- -a--
928^(aa(bb)?)+$ aabbaa y -$1-$2- -aa--
0e41cd87 929'^.{9}abc.*\n'm 123\nabcabcabcabc\n y - -
66417f84
HS
930^(a)?a$ a y -$1- --
931^(a)?(?(1)a|b)+$ a n - -
cb434fcc
IZ
932^(a\1?)(a\1?)(a\2?)(a\3?)$ aaaaaa y $1,$2,$3,$4 a,aa,a,aa
933^(a\1?){4}$ aaaaaa y $1 aa
934^(0+)?(?:x(1))? x1 y - -
935^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))? 012cxx0190 y - -
e1901655
IZ
936^(b+?|a){1,2}c bbbac y $1 a
937^(b+?|a){1,2}c bbbbac y $1 a
2e36c929 938\((\w\. \w+)\) cd. (A. Tw) y -$1- -A. Tw-
f49d4d0f
HS
939((?:aaaa|bbbb)cccc)? aaaacccc y - -
940((?:aaaa|bbbb)cccc)? bbbbcccc y - -
36670241
JH
941(a)?(a)+ a y $1:$2 :a -
942(ab)?(ab)+ ab y $1:$2 :ab -
943(abc)?(abc)+ abc y $1:$2 :abc -
12d33761 944'b\s^'m a\nb\n n - -
ee0b7718 945\ba a y - -
61525e55 946^(a(??{"(?!)"})|(a)(?{1}))b ab y $2 a # [ID 20010811.006]
055bb491
HS
947ab(?i)cd AbCd n - - # [ID 20010809.023]
948ab(?i)cd abCd y - -
f31a99c8
HS
949(A|B)*(?(1)(CD)|(CD)) CD y $2-$3 -CD
950(A|B)*(?(1)(CD)|(CD)) ABCD y $2-$3 CD-
951(A|B)*?(?(1)(CD)|(CD)) CD y $2-$3 -CD # [ID 20010803.016]
952(A|B)*?(?(1)(CD)|(CD)) ABCD y $2-$3 CD-
f65d3ee7 953'^(o)(?!.*\1)'i Oo n - -
24ba5a3c 954(.*)\d+\1 abc12bc y $1 bc
1ac24cf0 955(?m:(foo\s*$)) foo\n bar y $1 foo
a84d97b6
HS
956(.*)c abcd y $1 ab
957(.*)(?=c) abcd y $1 ab
958(.*)(?=c)c abcd yB $1 ab
959(.*)(?=b|c) abcd y $1 ab
960(.*)(?=b|c)c abcd y $1 ab
961(.*)(?=c|b) abcd y $1 ab
962(.*)(?=c|b)c abcd y $1 ab
963(.*)(?=[bc]) abcd y $1 ab
964(.*)(?=[bc])c abcd yB $1 ab
965(.*)(?<=b) abcd y $1 ab
966(.*)(?<=b)c abcd y $1 ab
967(.*)(?<=b|c) abcd y $1 abc
968(.*)(?<=b|c)c abcd y $1 ab
969(.*)(?<=c|b) abcd y $1 abc
970(.*)(?<=c|b)c abcd y $1 ab
971(.*)(?<=[bc]) abcd y $1 abc
972(.*)(?<=[bc])c abcd y $1 ab
973(.*?)c abcd y $1 ab
974(.*?)(?=c) abcd y $1 ab
975(.*?)(?=c)c abcd yB $1 ab
976(.*?)(?=b|c) abcd y $1 a
977(.*?)(?=b|c)c abcd y $1 ab
978(.*?)(?=c|b) abcd y $1 a
979(.*?)(?=c|b)c abcd y $1 ab
980(.*?)(?=[bc]) abcd y $1 a
981(.*?)(?=[bc])c abcd yB $1 ab
982(.*?)(?<=b) abcd y $1 ab
983(.*?)(?<=b)c abcd y $1 ab
984(.*?)(?<=b|c) abcd y $1 ab
985(.*?)(?<=b|c)c abcd y $1 ab
986(.*?)(?<=c|b) abcd y $1 ab
987(.*?)(?<=c|b)c abcd y $1 ab
988(.*?)(?<=[bc]) abcd y $1 ab
989(.*?)(?<=[bc])c abcd y $1 ab
d3aea5f7 9902(]*)?$\1 2 y $& 2
61525e55 991(??{}) x y - -
ecc99935 992a(b)?? abc y <$1> <> # undef [perl #16773]
c152dc43 993(\d{1,3}\.){3,} 128.134.142.8 y <$1> <142.> # [perl #18019]
b0e70d55
HS
994^.{3,4}(.+)\1\z foobarbar y $1 bar # 16 tests for [perl #23171]
995^(?:f|o|b){3,4}(.+)\1\z foobarbar y $1 bar
996^.{3,4}((?:b|a|r)+)\1\z foobarbar y $1 bar
997^(?:f|o|b){3,4}((?:b|a|r)+)\1\z foobarbar y $1 bar
998^.{3,4}(.+?)\1\z foobarbar y $1 bar
999^(?:f|o|b){3,4}(.+?)\1\z foobarbar y $1 bar
1000^.{3,4}((?:b|a|r)+?)\1\z foobarbar y $1 bar
1001^(?:f|o|b){3,4}((?:b|a|r)+?)\1\z foobarbar y $1 bar
1002^.{2,3}?(.+)\1\z foobarbar y $1 bar
1003^(?:f|o|b){2,3}?(.+)\1\z foobarbar y $1 bar
1004^.{2,3}?((?:b|a|r)+)\1\z foobarbar y $1 bar
1005^(?:f|o|b){2,3}?((?:b|a|r)+)\1\z foobarbar y $1 bar
1006^.{2,3}?(.+?)\1\z foobarbar y $1 bar
1007^(?:f|o|b){2,3}?(.+?)\1\z foobarbar y $1 bar
1008^.{2,3}?((?:b|a|r)+?)\1\z foobarbar y $1 bar
1009^(?:f|o|b){2,3}?((?:b|a|r)+?)\1\z foobarbar y $1 bar
c2b0868c 1010.*a(?!(b|cd)*e).*f ......abef n - - # [perl #23030]
0f7276ab
KW
1011x(?# - c - Sequence (?#... not terminated
1012:x(?#: - c - Sequence (?#... not terminated
a3621e74
YO
1013(WORDS|WORD)S WORDS y $1 WORD
1014(X.|WORDS|X.|WORD)S WORDS y $1 WORD
1015(WORDS|WORLD|WORD)S WORDS y $1 WORD
1016(X.|WORDS|WORD|Y.)S WORDS y $1 WORD
1017(foo|fool|x.|money|parted)$ fool y $1 fool
1018(x.|foo|fool|x.|money|parted|y.)$ fool y $1 fool
1019(foo|fool|money|parted)$ fool y $1 fool
1020(foo|fool|x.|money|parted)$ fools n - -
1021(x.|foo|fool|x.|money|parted|y.)$ fools n - -
1022(foo|fool|money|parted)$ fools n - -
3dab1dad 1023(a|aa|aaa||aaaa|aaaaa|aaaaaa)(b|c) aaaaaaaaaaaaaaab y $1$2 aaaaaab
61525e55
NC
1024(a|aa|aaa||aaaa|aaaaa|aaaaaa)(??{$1&&""})(b|c) aaaaaaaaaaaaaaab y $1$2 aaaaaab
1025(a|aa|aaa|aaaa|aaaaa|aaaaaa)(??{$1&&"foo"})(b|c) aaaaaaaaaaaaaaab n - -
3ab3c9b4
HS
1026^(a*?)(?!(aa|aaaa)*$) aaaaaaaaaaaaaaaaaaaa y $1 a # [perl #34195]
1027^(a*?)(?!(aa|aaaa)*$)(?=a\z) aaaaaaaa y $1 aaaaaaa
c315bfe8 1028^(.)\s+.$(?(1)) A B y $1 A # [perl #37688]
3a2830be
A
1029(?:r?)*?r|(.{2,4}) abcde y $1 abcd
1030(?!)+?|(.{2,4}) abcde y $1 abcd
7409bbd3 1031^(a*?)(?!(a{6}|a{5})*$) aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa y $+[1] 12 # super-linear cache bug may return 18
dad79028
DM
1032^((?>(?:aa)?b)?) aab y $1 aab
1033^((?:aa)*)(?:X+((?:\d+|-)(?:X+(.+))?))?$ aaaaX5 y $1 aaaa
3dab1dad
YO
1034X(A|B||C|D)Y XXXYYY y $& XY # Trie w/ NOTHING
1035(?i:X([A]|[B]|y[Y]y|[D]|)Y) XXXYYYB y $& XY # Trie w/ NOTHING
40a82448 1036^([a]{1})*$ aa y $1 a
3298f257
DM
1037a(?!b(?!c))(..) abababc y $1 bc # test nested negatives
1038a(?!b(?=a))(..) abababc y $1 bc # test nested lookaheads
1039a(?!b(?!c(?!d(?!e))))...(.) abxabcdxabcde y $1 e
1040X(?!b+(?!(c+)*(?!(c+)*d))).*X aXbbbbbbbcccccccccccccaaaX y - -
786e8c11
YO
1041^(XXXXXXXXXX|YYYYYYYYYY|Z.Q*X|Z[TE]Q*P): ZEQQQQQQQQQQQQQQQQQQP: y $1 ZEQQQQQQQQQQQQQQQQQQP
1042^(XXXXXXXXXX|YYYYYYYYYY|Z.Q*X|Z[TE]Q*P): ZEQQQX: y $1 ZEQQQX
1043^([TUV]+|XXXXXXXXXX|YYYYYYYYYY|Z.Q*X|Z[TE]Q*P): ZEQQQQQQQQQQQQQQQQQQP: y $1 ZEQQQQQQQQQQQQQQQQQQP
1044^([TUV]+|XXXXXXXXXX|YYYYYYYYYY|Z.Q*X|Z[TE]Q*P): ZEQQQX: y $1 ZEQQQX
1045^([TUV]+|XXXXXXXXXX|YYYYYYYYYY|Z.Q*X|Z[TE]Q*P|[MKJ]): ZEQQQQQQQQQQQQQQQQQQP: y $1 ZEQQQQQQQQQQQQQQQQQQP
1046^([TUV]+|XXXXXXXXXX|YYYYYYYYYY|Z.Q*X|Z[TE]Q*P|[MKJ]): ZEQQQX: y $1 ZEQQQX
1047^(XXX|YYY|Z.Q*X|Z[TE]Q*P): ZEQQQQQQQQQQQQQQQQQQP: y $1 ZEQQQQQQQQQQQQQQQQQQP
1048^(XXX|YYY|Z.Q*X|Z[TE]Q*P): ZEQQQX: y $1 ZEQQQX
1049^([TUV]+|XXX|YYY|Z.Q*X|Z[TE]Q*P): ZEQQQQQQQQQQQQQQQQQQP: y $1 ZEQQQQQQQQQQQQQQQQQQP
1050^([TUV]+|XXX|YYY|Z.Q*X|Z[TE]Q*P): ZEQQQX: y $1 ZEQQQX
1051^([TUV]+|XXX|YYY|Z.Q*X|Z[TE]Q*P|[MKJ]): ZEQQQQQQQQQQQQQQQQQQP: y $1 ZEQQQQQQQQQQQQQQQQQQP
1052^([TUV]+|XXX|YYY|Z.Q*X|Z[TE]Q*P|[MKJ]): ZEQQQX: y $1 ZEQQQX
1053X(?:ABCF[cC]x*|ABCD|ABCF):(?:DIT|DID|DIM) XABCFCxxxxxxxxxx:DIM y $& XABCFCxxxxxxxxxx:DIM
1054(((ABCD|ABCE|ABCF)))(A|B|C[xy]*): ABCFCxxxxxxxxxx:DIM y $& ABCFCxxxxxxxxxx:
1de06328
YO
1055(?=foo) foo y pos 0
1056(?=foo) XfooY y pos 1
1057.*(?=foo) XfooY y pos 1
1058(?<=foo) foo y pos 3
1059(?<=foo) XfooY y pos 4
1060.*(?<=foo) foo y pos 3
1061.*(?<=foo) XfooY y pos 4
1062(?<=foo)Y XfooY y pos 5
1063o(?<=foo)Y ..XfooY.. y pos 7
1064X(?=foo)f ..XfooY.. y pos 4
1065X(?=foo) ..XfooY.. y pos 3
1066X(?<=foo.)[YZ] ..XfooXY.. y pos 8
1067(?=XY*foo) Xfoo y pos 0
1068^(?=XY*foo) Xfoo y pos 0
61525e55
NC
1069^(??{"a+"})a aa y $& aa
1070^(?:(??{"a+"})|b)a aa y $& aa
1071^(??{chr 0x100}).$ \x{100}\x{100} y $& \x{100}\x{100}
1072^(??{q(\x{100})}). \x{100}\x{100} y $& \x{100}\x{100}
1073^(??{q(.+)})\x{100} \x{100}\x{100} y $& \x{100}\x{100}
1074^(??{q(.)})\x{100} \x{100}\x{100} y $& \x{100}\x{100}
1075^(??{chr 0x100})\xbb \x{100}\x{bb} y $& \x{100}\x{bb}
1076^(.)(??{"(.)(.)"})(.)$ abcd y $1-$2 a-d
1077^(.)(??{"(bz+|.)(.)"})(.)$ abcd y $1-$2 a-d
1078^(.)((??{"(.)(cz+)"})|.) abcd y $1-$2 a-b
1079^a(?>(??{q(b)}))(??{q(c)})d abcd y - -
1080^x(??{""})+$ x y $& x
6bda09f9
YO
1081^(<(?:[^<>]+|(?3)|(?1))*>)()(!>!>!>)$ <<!>!>!>><>>!>!>!> y $1 <<!>!>!>><>>
1082^(<(?:[^<>]+|(?1))*>)$ <<><<<><>>>> y $1 <<><<<><>>>>
1083((?2)*)([fF]o+) fooFoFoo y $1-$2 fooFo-Foo
1084(<(?:[^<>]+|(?R))*>) <<><<<><>>>> y $1 <<><<<><>>>>
81714fb9 1085(?<n>foo|bar|baz) snofooewa y $1 foo
cb6fa888
NC
1086(?<n>foo|bar|baz) snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1087(?<n>foo|bar|baz)(?<m>[ew]+) snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1088(?<n>foo|bar|baz)(?<m>[ew]+) snofooewa yM $+{m} ew miniperl cannot load Tie::Hash::NamedCapture
1089(?<n>foo)|(?<n>bar)|(?<n>baz) snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1090(?<n>foo)(??{ $+{n} }) snofooefoofoowaa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1f1031fe 1091(?P<n>foo|bar|baz) snofooewa y $1 foo
cb6fa888
NC
1092(?P<n>foo|bar|baz) snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1093(?P<n>foo|bar|baz)(?P<m>[ew]+) snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1094(?P<n>foo|bar|baz)(?P<m>[ew]+) snofooewa yM $+{m} ew miniperl cannot load Tie::Hash::NamedCapture
1095(?P<n>foo)|(?P<n>bar)|(?P<n>baz) snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1096(?P<n>foo)(??{ $+{n} }) snofooefoofoowaa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
0f7276ab
KW
1097(?P<=n>foo|bar|baz) - c - Group name must start with a non-digit word character
1098(?P<!n>foo|bar|baz) - c - Group name must start with a non-digit word character
1099(?PX<n>foo|bar|baz) - c - Sequence (?PX<...) not recognized
81714fb9 1100/(?'n'foo|bar|baz)/ snofooewa y $1 foo
cb6fa888
NC
1101/(?'n'foo|bar|baz)/ snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1102/(?'n'foo|bar|baz)(?'m'[ew]+)/ snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1103/(?'n'foo|bar|baz)(?'m'[ew]+)/ snofooewa yM $+{m} ew miniperl cannot load Tie::Hash::NamedCapture
1104/(?'n'foo)|(?'n'bar)|(?<n>baz)/ snobazewa yM $+{n} baz miniperl cannot load Tie::Hash::NamedCapture
1105/(?'n'foo)(??{ $+{n} })/ snofooefoofoowaa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
81714fb9 1106/(?'n'foo)\k<n>/ ..foofoo.. y $1 foo
cb6fa888 1107/(?'n'foo)\k<n>/ ..foofoo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
81714fb9 1108/(?<n>foo)\k'n'/ ..foofoo.. y $1 foo
cb6fa888
NC
1109/(?<n>foo)\k'n'/ ..foofoo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1110/(?:(?<n>foo)|(?<n>bar))\k<n>/ ..barbar.. yM $+{n} bar miniperl cannot load Tie::Hash::NamedCapture
1111/^(?'main'<(?:[^<>]+|(?&crap)|(?&main))*>)(?'empty')(?'crap'!>!>!>)$/ <<!>!>!>><>>!>!>!> yM $+{main} <<!>!>!>><>> miniperl cannot load Tie::Hash::NamedCapture
894be9b7 1112/^(?'main'<(?:[^<>]+|(?&main))*>)$/ <<><<<><>>>> y $1 <<><<<><>>>>
cb6fa888
NC
1113/(?'first'(?&second)*)(?'second'[fF]o+)/ fooFoFoo yM $+{first}-$+{second} fooFo-Foo miniperl cannot load Tie::Hash::NamedCapture
1114(?<A>foo)?(?(<A>)bar|nada) foobar yM $+{A} foo miniperl cannot load Tie::Hash::NamedCapture
0a4db386
YO
1115(?<A>foo)?(?(<A>)bar|nada) foo-barnada y $& nada
1116(?<A>foo)?(?(1)bar|nada) foo-barnada y $& nada
1117(?<A>foo(?(R)bar))?(?1) foofoobar y $1 foo
1118(?<A>foo(?(R)bar))?(?1) foofoobar y $& foofoobar
1119(x)(?<A>foo(?(R&A)bar))?(?&A) xfoofoobar y $2 foo
1120(x)(?<A>foo(?(R&A)bar))?(?&A) xfoofoobar y $& xfoofoobar
1121(x)(?<A>foo(?(R2)bar))?(?&A) xfoofoobar y $2 foo
1122(x)(?<A>foo(?(R2)bar))?(?&A) xfoofoobar y $& xfoofoobar
1123(?1)(?(DEFINE)(blah)) blah y $& blah
1124/^(?<PAL>(?<CHAR>.)((?&PAL)|.?)\k<CHAR>)$/ madamimadam y $& madamimadam
1125/^(?<PAL>(?<CHAR>.)((?&PAL)|.?)\k<CHAR>)$/ madamiamadam n - -
1126/(a)?((?1))(fox)/ aafox y $1-$2-$3 a-a-fox
1127/(a)*((?1))(fox)/ aafox y $1-$2-$3 a-a-fox
1128/(a)+((?1))(fox)/ aafox y $1-$2-$3 a-a-fox
1129/(a){1,100}((?1))(fox)/ aafox y $1-$2-$3 a-a-fox
1130/(a){0,100}((?1))(fox)/ aafox y $1-$2-$3 a-a-fox
1131/(ab)?((?1))(fox)/ ababfox y $1-$2-$3 ab-ab-fox
1132/(ab)*((?1))(fox)/ ababfox y $1-$2-$3 ab-ab-fox
1133/(ab)+((?1))(fox)/ ababfox y $1-$2-$3 ab-ab-fox
1134/(ab){1,100}((?1))(fox)/ ababfox y $1-$2-$3 ab-ab-fox
1135/(ab){0,100}((?1))(fox)/ ababfox y $1-$2-$3 ab-ab-fox
b9b4dddf
YO
1136# possessive captures
1137a++a aaaaa n - -
1138a*+a aaaaa n - -
1139a{1,5}+a aaaaa n - -
1140a?+a ab n - -
1141a++b aaaaab y $& aaaaab
1142a*+b aaaaab y $& aaaaab
1143a{1,5}+b aaaaab y $& aaaaab
1144a?+b ab y $& ab
1145fooa++a fooaaaaa n - -
1146fooa*+a fooaaaaa n - -
1147fooa{1,5}+a fooaaaaa n - -
1148fooa?+a fooab n - -
1149fooa++b fooaaaaab y $& fooaaaaab
1150fooa*+b fooaaaaab y $& fooaaaaab
1151fooa{1,5}+b fooaaaaab y $& fooaaaaab
1152fooa?+b fooab y $& fooab
1153(?:aA)++(?:aA) aAaAaAaAaA n - aAaAaAaAaA
1154(aA)++(aA) aAaAaAaAaA n - aAaAaAaAaA
1155(aA|bB)++(aA|bB) aAaAbBaAbB n - aAaAbBaAbB
1156(?:aA|bB)++(?:aA|bB) aAbBbBbBaA n - aAbBbBbBaA
1157(?:aA)*+(?:aA) aAaAaAaAaA n - aAaAaAaAaA
1158(aA)*+(aA) aAaAaAaAaA n - aAaAaAaAaA
1159(aA|bB)*+(aA|bB) aAaAbBaAaA n - aAaAbBaAaA
1160(?:aA|bB)*+(?:aA|bB) aAaAaAbBaA n - aAaAaAbBaA
1161(?:aA){1,5}+(?:aA) aAaAaAaAaA n - aAaAaAaAaA
1162(aA){1,5}+(aA) aAaAaAaAaA n - aAaAaAaAaA
1163(aA|bB){1,5}+(aA|bB) aAaAbBaAaA n - aAaAbBaAaA
1164(?:aA|bB){1,5}+(?:aA|bB) bBbBbBbBbB n - bBbBbBbBbB
1165(?:aA)?+(?:aA) aAb n - aAb
1166(aA)?+(aA) aAb n - aAb
1167(aA|bB)?+(aA|bB) bBb n - bBb
1168(?:aA|bB)?+(?:aA|bB) aAb n - aAb
1169(?:aA)++b aAaAaAaAaAb y $& aAaAaAaAaAb
1170(aA)++b aAaAaAaAaAb y $& aAaAaAaAaAb
1171(aA|bB)++b aAbBaAaAbBb y $& aAbBaAaAbBb
1172(?:aA|bB)++b aAbBbBaAaAb y $& aAbBbBaAaAb
1173(?:aA)*+b aAaAaAaAaAb y $& aAaAaAaAaAb
1174(aA)*+b aAaAaAaAaAb y $& aAaAaAaAaAb
1175(aA|bB)*+b bBbBbBbBbBb y $& bBbBbBbBbBb
1176(?:aA|bB)*+b bBaAbBbBaAb y $& bBaAbBbBaAb
1177(?:aA){1,5}+b aAaAaAaAaAb y $& aAaAaAaAaAb
1178(aA){1,5}+b aAaAaAaAaAb y $& aAaAaAaAaAb
1179(aA|bB){1,5}+b bBaAbBaAbBb y $& bBaAbBaAbBb
1180(?:aA|bB){1,5}+b aAbBaAbBbBb y $& aAbBaAbBbBb
1181(?:aA)?+b aAb y $& aAb
1182(aA)?+b aAb y $& aAb
1183(aA|bB)?+b bBb y $& bBb
1184(?:aA|bB)?+b bBb y $& bBb
1185foo(?:aA)++(?:aA) fooaAaAaAaAaA n - fooaAaAaAaAaA
1186foo(aA)++(aA) fooaAaAaAaAaA n - fooaAaAaAaAaA
1187foo(aA|bB)++(aA|bB) foobBbBbBaAaA n - foobBbBbBaAaA
1188foo(?:aA|bB)++(?:aA|bB) fooaAaAaAaAaA n - fooaAaAaAaAaA
1189foo(?:aA)*+(?:aA) fooaAaAaAaAaA n - fooaAaAaAaAaA
1190foo(aA)*+(aA) fooaAaAaAaAaA n - fooaAaAaAaAaA
1191foo(aA|bB)*+(aA|bB) foobBaAbBaAaA n - foobBaAbBaAaA
1192foo(?:aA|bB)*+(?:aA|bB) fooaAaAbBbBaA n - fooaAaAbBbBaA
1193foo(?:aA){1,5}+(?:aA) fooaAaAaAaAaA n - fooaAaAaAaAaA
1194foo(aA){1,5}+(aA) fooaAaAaAaAaA n - fooaAaAaAaAaA
1195foo(aA|bB){1,5}+(aA|bB) fooaAbBbBaAaA n - fooaAbBbBaAaA
1196foo(?:aA|bB){1,5}+(?:aA|bB) fooaAbBbBaAbB n - fooaAbBbBaAbB
1197foo(?:aA)?+(?:aA) fooaAb n - fooaAb
1198foo(aA)?+(aA) fooaAb n - fooaAb
1199foo(aA|bB)?+(aA|bB) foobBb n - foobBb
1200foo(?:aA|bB)?+(?:aA|bB) fooaAb n - fooaAb
1201foo(?:aA)++b fooaAaAaAaAaAb y $& fooaAaAaAaAaAb
1202foo(aA)++b fooaAaAaAaAaAb y $& fooaAaAaAaAaAb
1203foo(aA|bB)++b foobBaAbBaAbBb y $& foobBaAbBaAbBb
1204foo(?:aA|bB)++b fooaAaAbBaAaAb y $& fooaAaAbBaAaAb
1205foo(?:aA)*+b fooaAaAaAaAaAb y $& fooaAaAaAaAaAb
1206foo(aA)*+b fooaAaAaAaAaAb y $& fooaAaAaAaAaAb
1207foo(aA|bB)*+b foobBbBaAaAaAb y $& foobBbBaAaAaAb
1208foo(?:aA|bB)*+b foobBaAaAbBaAb y $& foobBaAaAbBaAb
1209foo(?:aA){1,5}+b fooaAaAaAaAaAb y $& fooaAaAaAaAaAb
1210foo(aA){1,5}+b fooaAaAaAaAaAb y $& fooaAaAaAaAaAb
1211foo(aA|bB){1,5}+b foobBaAaAaAaAb y $& foobBaAaAaAaAb
1212foo(?:aA|bB){1,5}+b fooaAbBaAbBbBb y $& fooaAbBaAbBbBb
1213foo(?:aA)?+b fooaAb y $& fooaAb
1214foo(aA)?+b fooaAb y $& fooaAb
1215foo(aA|bB)?+b foobBb y $& foobBb
1216foo(?:aA|bB)?+b foobBb y $& foobBb
1217
1218([^()]++|\([^()]*\))+ ((abc(ade)ufh()()x y $& abc(ade)ufh()()x
1219round\(([^()]++)\) _I(round(xs * sz),1) y $1 xs * sz
1220
7f69552c
YO
1221(foo[1x]|bar[2x]|baz[3x])+y foo1bar2baz3y y $1 baz3
1222(foo[1x]|bar[2x]|baz[3x])+y foo1bar2baz3y y $& foo1bar2baz3y
1223(foo[1x]|bar[2x]|baz[3x])*y foo1bar2baz3y y $1 baz3
1224(foo[1x]|bar[2x]|baz[3x])*y foo1bar2baz3y y $& foo1bar2baz3y
1225
1226([yX].|WORDS|[yX].|WORD)S WORDS y $1 WORD
1227(WORDS|WORLD|WORD)S WORDS y $1 WORD
1228([yX].|WORDS|WORD|[xY].)S WORDS y $1 WORD
1229(foo|fool|[zx].|money|parted)$ fool y $1 fool
1230([zx].|foo|fool|[zq].|money|parted|[yx].)$ fool y $1 fool
1231(foo|fool|[zx].|money|parted)$ fools n - -
1232([zx].|foo|fool|[qx].|money|parted|[py].)$ fools n - -
1233
1234([yX].|WORDS|[yX].|WORD)+S WORDS y $1 WORD
1235(WORDS|WORLD|WORD)+S WORDS y $1 WORD
1236([yX].|WORDS|WORD|[xY].)+S WORDS y $1 WORD
1237(foo|fool|[zx].|money|parted)+$ fool y $1 fool
1238([zx].|foo|fool|[zq].|money|parted|[yx].)+$ fool y $1 fool
1239(foo|fool|[zx].|money|parted)+$ fools n - -
1240([zx].|foo|fool|[qx].|money|parted|[py].)+$ fools n - -
1241
1242(x|y|z[QW])+(longish|loquatious|excessive|overblown[QW])+ xyzQzWlongishoverblownW y $1-$2 zW-overblownW
1243(x|y|z[QW])*(longish|loquatious|excessive|overblown[QW])* xyzQzWlongishoverblownW y $1-$2 zW-overblownW
1244(x|y|z[QW]){1,5}(longish|loquatious|excessive|overblown[QW]){1,5} xyzQzWlongishoverblownW y $1-$2 zW-overblownW
1245
1246(x|y|z[QW])++(longish|loquatious|excessive|overblown[QW])++ xyzQzWlongishoverblownW y $1-$2 zW-overblownW
1247(x|y|z[QW])*+(longish|loquatious|excessive|overblown[QW])*+ xyzQzWlongishoverblownW y $1-$2 zW-overblownW
1248(x|y|z[QW]){1,5}+(longish|loquatious|excessive|overblown[QW]){1,5}+ xyzQzWlongishoverblownW y $1-$2 zW-overblownW
1249
7f69552c 1250a*(?!) aaaab n - -
e2e6a0f1
YO
1251a*(*FAIL) aaaab n - -
1252a*(*F) aaaab n - -
1253
1254(A(A|B(*ACCEPT)|C)D)(E) AB y $1 AB
1255(A(A|B(*ACCEPT)|C)D)(E) ACDE y $1$2$3 ACDCE
1256
542fa716 1257(a)(?:(?-1)|(?+1))(b) aab y $&-$1-$2 aab-a-b
c74340f9 1258(a)(?:(?-1)|(?+1))(b) abb y $1-$2 a-b
542fa716 1259(a)(?:(?-1)|(?+1))(b) acb n - -
c74340f9 1260
2bf803e2
YO
1261(foo)(\g-2) foofoo y $1-$2 foo-foo
1262(foo)(\g-2)(foo)(\g-2) foofoofoofoo y $1-$2-$3-$4 foo-foo-foo-foo
1263(([abc]+) \g-1)(([abc]+) \g{-1}) abc abccba cba y $2-$4 abc-cba
1264(a)(b)(c)\g1\g2\g3 abcabc y $1$2$3 abc
1265
1f1031fe 1266# \k<n> preceded by a literal
99ed40ff 1267/(?'n'foo) \k<n>/ ..foo foo.. y $1 foo
cb6fa888 1268/(?'n'foo) \k<n>/ ..foo foo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
99ed40ff 1269/(?<n>foo) \k'n'/ ..foo foo.. y $1 foo
cb6fa888
NC
1270/(?<n>foo) \k'n'/ ..foo foo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1271/(?'a1'foo) \k'a1'/ ..foo foo.. yM $+{a1} foo miniperl cannot load Tie::Hash::NamedCapture
1272/(?<a1>foo) \k<a1>/ ..foo foo.. yM $+{a1} foo miniperl cannot load Tie::Hash::NamedCapture
1273/(?'_'foo) \k'_'/ ..foo foo.. yM $+{_} foo miniperl cannot load Tie::Hash::NamedCapture
1274/(?<_>foo) \k<_>/ ..foo foo.. yM $+{_} foo miniperl cannot load Tie::Hash::NamedCapture
1275/(?'_0_'foo) \k'_0_'/ ..foo foo.. yM $+{_0_} foo miniperl cannot load Tie::Hash::NamedCapture
1276/(?<_0_>foo) \k<_0_>/ ..foo foo.. yM $+{_0_} foo miniperl cannot load Tie::Hash::NamedCapture
0f7276ab
KW
1277/(?'0'foo) bar/ - c - Group name must start with a non-digit word character
1278/(?<0>foo) bar/ - c - Group name must start with a non-digit word character
1279/(?'12'foo) bar/ - c - Group name must start with a non-digit word character
1280/(?<12>foo) bar/ - c - Group name must start with a non-digit word character
1281/(?'1a'foo) bar/ - c - Group name must start with a non-digit word character
1282/(?<1a>foo) bar/ - c - Group name must start with a non-digit word character
1283/(?''foo) bar/ - c - Group name must start with a non-digit word character
1284/(?<>foo) bar/ - c - Group name must start with a non-digit word character
1285/foo \k'n'/ - c - Reference to nonexistent named group
1286/foo \k<n>/ - c - Reference to nonexistent named group
1287/foo \k'a1'/ - c - Reference to nonexistent named group
1288/foo \k<a1>/ - c - Reference to nonexistent named group
1289/foo \k'_'/ - c - Reference to nonexistent named group
1290/foo \k<_>/ - c - Reference to nonexistent named group
1291/foo \k'_0_'/ - c - Reference to nonexistent named group
1292/foo \k<_0_>/ - c - Reference to nonexistent named group
1293/foo \k'0'/ - c - Group name must start with a non-digit word character
1294/foo \k<0>/ - c - Group name must start with a non-digit word character
1295/foo \k'12'/ - c - Group name must start with a non-digit word character
1296/foo \k<12>/ - c - Group name must start with a non-digit word character
1297/foo \k'1a'/ - c - Group name must start with a non-digit word character
1298/foo \k<1a>/ - c - Group name must start with a non-digit word character
1299/foo \k''/ - c - Group name must start with a non-digit word character
1300/foo \k<>/ - c - Group name must start with a non-digit word character
99ed40ff 1301/(?<as>as) (\w+) \k<as> (\w+)/ as easy as pie y $1-$2-$3 as-easy-pie
1f1031fe
YO
1302
1303# \g{...} with a name as the argument
1304/(?'n'foo) \g{n}/ ..foo foo.. y $1 foo
cb6fa888 1305/(?'n'foo) \g{n}/ ..foo foo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1f1031fe 1306/(?<n>foo) \g{n}/ ..foo foo.. y $1 foo
cb6fa888 1307/(?<n>foo) \g{n}/ ..foo foo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1f1031fe
YO
1308/(?<as>as) (\w+) \g{as} (\w+)/ as easy as pie y $1-$2-$3 as-easy-pie
1309
1310# Python style named capture buffer stuff
1311/(?P<n>foo)(?P=n)/ ..foofoo.. y $1 foo
cb6fa888
NC
1312/(?P<n>foo)(?P=n)/ ..foofoo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1313/(?:(?P<n>foo)|(?P<n>bar))(?P=n)/ ..barbar.. yM $+{n} bar miniperl cannot load Tie::Hash::NamedCapture
1f1031fe
YO
1314/^(?P<PAL>(?P<CHAR>.)((?P>PAL)|.?)(?P=CHAR))$/ madamimadam y $& madamimadam
1315/^(?P<PAL>(?P<CHAR>.)((?P>PAL)|.?)(?P=CHAR))$/ madamiamadam n - -
1316/(?P<n>foo) (?P=n)/ ..foo foo.. y $1 foo
cb6fa888 1317/(?P<n>foo) (?P=n)/ ..foo foo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
1f1031fe
YO
1318/(?P<as>as) (\w+) (?P=as) (\w+)/ as easy as pie y $1-$2-$3 as-easy-pie
1319
1320#check that non identifiers as names are treated as the appropriate lookaround
1321(?<=bar>)foo bar>foo y $& foo
1322(?<!bar>)foo bar>foo n - -
1323(?<=bar>ABC)foo bar>ABCfoo y $& foo
1324(?<!bar>ABC)foo bar>ABCfoo n - -
1325(?<bar>)foo bar>ABCfoo y $& foo
68ba3a3f
YO
1326(?<bar>ABC)foo bar>ABCfoo y $& ABCfoo
1327
1328(?<=abcd(?<=(aaaabcd))) ..aaaabcd.. y $1 aaaabcd
1329(?=xy(?<=(aaxy))) ..aaxy.. y $1 aaxy
fae667d5
YO
1330
1331X(\w+)(?=\s)|X(\w+) Xab y [$1-$2] [-ab]
594d7033
YO
1332
1333#check that branch reset works ok.
3bce0506 1334(?|(a)) a y $1-$+-$^N a-a-a
594d7033
YO
1335(?|a(.)b|d(.(o).)d|i(.)(.)j)(.) d!o!da y $1-$2-$3 !o!-o-a
1336(?|a(.)b|d(.(o).)d|i(.)(.)j)(.) aabc y $1-$2-$3 a--c
1337(?|a(.)b|d(.(o).)d|i(.)(.)j)(.) ixyjp y $1-$2-$3 x-y-p
1338(?|(?|(a)|(b))|(?|(c)|(d))) a y $1 a
1339(?|(?|(a)|(b))|(?|(c)|(d))) b y $1 b
1340(?|(?|(a)|(b))|(?|(c)|(d))) c y $1 c
1341(?|(?|(a)|(b))|(?|(c)|(d))) d y $1 d
1342(.)(?|(.)(.)x|(.)d)(.) abcde y $1-$2-$3-$4-$5- b-c--e--
cbf4a129 1343(\N)(?|(\N)(\N)x|(\N)d)(\N) abcde y $1-$2-$3-$4-$5- b-c--e--
cb6fa888
NC
1344(?|(?<foo>x)) x yM $+{foo} x miniperl cannot load Tie::Hash::NamedCapture
1345(?|(?<foo>x)|(?<bar>y)) x yM $+{foo} x miniperl cannot load Tie::Hash::NamedCapture
1346(?|(?<bar>y)|(?<foo>x)) x yM $+{foo} x miniperl cannot load Tie::Hash::NamedCapture
1347(?<bar>)(?|(?<foo>x)) x yM $+{foo} x miniperl cannot load Tie::Hash::NamedCapture
fd4be6f0
FC
1348# Used to crash, because the last branch was ignored when the parens
1349# were counted:
1350(?|(b)|()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(a)) a y $& a
ee91d26e 1351
3e901dc0
YO
1352#Bug #41492
1353(?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A) a y $& a
1354(?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A) aa y $& aa
61525e55 1355\x{100}?(??{""})xxx xxx y $& xxx
e1d1eefb
YO
1356
1357foo(\R)bar foo\r\nbar y $1 \r\n
1358foo(\R)bar foo\nbar y $1 \n
1359foo(\R)bar foo\rbar y $1 \r
1360
1361foo(\R+)bar foo\r\n\x{85}\r\n\nbar y $1 \r\n\x{85}\r\n\n
1362(\V+)(\R) foo\r\n\x{85}\r\n\nbar y $1-$2 foo-\r\n
1363(\R+)(\V) foo\r\n\x{85}\r\n\nbar y $1-$2 \r\n\x{85}\r\n\n-b
1364foo(\R)bar foo\x{85}bar y $1 \x{85}
1365(\V)(\R) foo\x{85}bar y $1-$2 o-\x{85}
1366(\R)(\V) foo\x{85}bar y $1-$2 \x{85}-b
1367foo(\R)bar foo\r\nbar y $1 \r\n
1368(\V)(\R) foo\r\nbar y $1-$2 o-\r\n
1369(\R)(\V) foo\r\nbar y $1-$2 \r\n-b
1370foo(\R)bar foo\r\nbar y $1 \r\n
1371(\V)(\R) foo\r\nbar y $1-$2 o-\r\n
1372(\R)(\V) foo\r\nbar y $1-$2 \r\n-b
1373foo(\R)bar foo\rbar y $1 \r
1374(\V)(\R) foo\rbar y $1-$2 o-\r
1375(\R)(\V) foo\rbar y $1-$2 \r-b
1376
1377foo(\v+)bar foo\r\n\x{85}\r\n\nbar y $1 \r\n\x{85}\r\n\n
1378(\V+)(\v) foo\r\n\x{85}\r\n\nbar y $1-$2 foo-\r
1379(\v+)(\V) foo\r\n\x{85}\r\n\nbar y $1-$2 \r\n\x{85}\r\n\n-b
1380foo(\v)bar foo\x{85}bar y $1 \x{85}
1381(\V)(\v) foo\x{85}bar y $1-$2 o-\x{85}
1382(\v)(\V) foo\x{85}bar y $1-$2 \x{85}-b
1383foo(\v)bar foo\rbar y $1 \r
1384(\V)(\v) foo\rbar y $1-$2 o-\r
1385(\v)(\V) foo\rbar y $1-$2 \r-b
1386
1387
1388foo(\h+)bar foo\t\x{A0}bar y $1 \t\x{A0}
1389(\H+)(\h) foo\t\x{A0}bar y $1-$2 foo-\t
1390(\h+)(\H) foo\t\x{A0}bar y $1-$2 \t\x{A0}-b
1391foo(\h)bar foo\x{A0}bar y $1 \x{A0}
1392(\H)(\h) foo\x{A0}bar y $1-$2 o-\x{A0}
1393(\h)(\H) foo\x{A0}bar y $1-$2 \x{A0}-b
1394foo(\h)bar foo\tbar y $1 \t
1395(\H)(\h) foo\tbar y $1-$2 o-\t
1396(\h)(\H) foo\tbar y $1-$2 \t-b
5339e136 1397
cbf4a129
RGS
1398.*\z foo\n y -$&- --
1399\N*\z foo\n y -$&- --
1400.*\Z foo\n y -$&- -foo-
1401\N*\Z foo\n y -$&- -foo-
225593e1 1402^(?:(\d)x)?\d$ 1 y ${\(defined($1)?1:0)} 0
60f65011 1403.*?(?:(\w)|(\w))x abx y $1-$2 b-
639081d6
YO
1404
14050{50} 000000000000000000000000000000000000000000000000000 y - -
906cdd2b
HS
1406^a?(?=b)b ab y $& ab # Bug #56690
1407^a*(?=b)b ab y $& ab # Bug #56690
2811b836
B
1408/>\d+$ \n/ix >10\n y $& >10
1409/>\d+$ \n/ix >1\n y $& >1
1410/\d+$ \n/ix >10\n y $& 10
1411/>\d\d$ \n/ix >10\n y $& >10
1412/>\d+$ \n/x >10\n y $& >10
44d268c3
NC
1413
1414# Two regressions in 5.8.x (only) introduced by change 30638
1415# Simplification of the test failure in XML::LibXML::Simple:
1416/^\s*i.*?o\s*$/s io\n io y - -
1417# As reported in #59168 by Father Chrysostomos:
1418/(.*?)a(?!(a+)b\2c)/ baaabaac y $&-$1 baa-ba
aff3edb5
YO
1419# [perl #60344] Regex lookbehind failure after an (if)then|else in perl 5.10
1420/\A(?(?=db2)db2|\D+)(?<!processed)\.csv\z/xms sql_processed.csv n - -
24d786f4 1421/\N{U+0100}/ \x{100} y $& \x{100} # Bug #59328
ff3f963a
KW
1422/[a\N{U+0100}]/ \x{100} y $& \x{100}
1423/[a\N{U+0100}]/ a y $& a
1424
1425# Verify that \N{U+...} forces Unicode semantics
1426/\N{U+41}\x{c1}/i a\x{e1} y $& a\x{e1}
1427/[\N{U+41}\x{c1}]/i \x{e1} y $& \x{e1}
1428
11454c59 1429[\s][\S] \x{a0}\x{a0} n - - # Unicode complements should not match same character
3cf20fa2
KW
1430
1431# was generating malformed utf8
1432'[\x{100}\xff]'i \x{ff} y $& \x{ff}
e120390b
B
1433
1434((??{ "(?:|)" }))\s C\x20 y - -
40863337 1435
ff3f963a
KW
1436# Verify that \ escapes the { after \N, and causes \N to match non-newline
1437abc\N\{U+BEEF} abc\n{UBEEF} n
1438abc\N\{U+BEEF} abc.{UBEEF} y $& abc.{UBEEF}
1439[abc\N\{U+BEEF}] - c - \\N in a character class must be a named character
1440
1441# Verify that \N can be trailing and causes \N to match non-newline
1442abc\N abcd y $& abcd
1443abc\N abc\n n
1444
1445# Verify get errors. For these, we need // or else puts it in single quotes,
c3c41406 1446# and bypasses the lexer.
ff3f963a 1447/\N{U+}/ - c - Invalid hexadecimal number
c3c41406 1448# Below currently gives a misleading message
073b366a
KW
1449/[\N{U+}]/ - Sc - Unmatched
1450/[\N{U+}]/ - sc - Syntax error in (?[...])
ff3f963a 1451/abc\N{def/ - c - Missing right brace
c3c41406
KW
1452/\N{U+4AG3}/ - c - Illegal hexadecimal digit
1453/[\N{U+4AG3}]/ - c - Illegal hexadecimal digit
1454
1455# And verify that in single quotes which bypasses the lexer, the regex compiler
1456# figures it out.
1457\N{U+} - c - Invalid hexadecimal number
1458[\N{U+}] - c - Invalid hexadecimal number
b9c48b5b 1459\N{U+4AG3} - c - Invalid hexadecimal number
c3c41406
KW
1460[\N{U+4AG3}] - c - Invalid hexadecimal number
1461abc\N{def - c - \\N{NAME} must be resolved by the lexer
1462
1463# Verify that under /x that still cant have space before left brace
1464/abc\N {U+41}/x - c - Missing braces
1465/abc\N {SPACE}/x - c - Missing braces
ff3f963a
KW
1466
1467# Verifies catches hex errors, and doesn't expose our . notation to the outside
0b70ce6f
KW
1468/\N{U+0xBEEF}/ - c - Illegal hexadecimal digit
1469/\N{U+BEEF.BEAD}/ - c - Illegal hexadecimal digit
ff3f963a 1470
c3c41406
KW
1471# Verify works in single quotish context; regex compiler delivers slightly different msg
1472# \N{U+BEEF.BEAD} succeeds here, because can't completely hide it from the outside.
b9c48b5b 1473\N{U+0xBEEF} - c - Invalid hexadecimal number
17a3df4c
KW
1474\c` - c - \"\\c`\" is more clearly written simply as \"\\ \"
1475\c1 - c - \"\\c1\" is more clearly written simply as \"q\"
0b70ce6f 1476\cA \001 y $& \1
c3c41406 1477
fa1639c5
KW
1478\400 \x{100} y $& \x{100}
1479\600 \x{180} y $& \x{180}
1480\777 \x{1FF} y $& \x{1FF}
1481[a\400] \x{100} y $& \x{100}
1482[b\600] \x{180} y $& \x{180}
1483[c\777] \x{1FF} y $& \x{1FF}
f0a2b745
KW
1484\o{120} \x{50} y $& \x{50}
1485\o{400} \x{100} y $& \x{100}
1486\o{1000} \x{200} y $& \x{200}
1487[a\o{120}] \x{50} y $& \x{50}
1488[a\o{400}] \x{100} y $& \x{100}
1489[a\o{1000}] \x{200} y $& \x{200}
fa1639c5 1490
726ee55d 1491# The below were inserting a NULL
f1e1b256
YO
1492\87 87 c - Reference to nonexistent group in regex
1493a\87 a87 c - Reference to nonexistent group in regex
1494a\97 a97 c - Reference to nonexistent group in regex
726ee55d 1495
c99e91e9 1496# The below was inserting a NULL into the character class.
073b366a
KW
1497[\8\9] \000 Sn - -
1498[\8\9] - sc $& Unrecognized escape \\8 in character class
1499[\8\9] 8 Sy $& 8
1500[\8\9] 9 Sy $& 9
c99e91e9
KW
1501
1502# Verify that reads 1-3 octal digits, and that \_ works in char class
073b366a
KW
1503[\0] \000 Sy $& \000
1504[\0] - sc - Need exactly 3 octal digits
1505[\07] \007 Sy $& \007
1506[\07] - sc - Need exactly 3 octal digits
1507[\07] 7\000 Sn - -
1508[\07] - sc - Need exactly 3 octal digits
c99e91e9
KW
1509[\006] \006 y $& \006
1510[\006] 6\000 n - -
1511[\0005] \0005 y $& \000
1512[\0005] 5\000 y $& 5
1513[\_] _ y $& _
1514
779bcb7d
NC
1515# RT #79152
1516(q1|.)*(q2|.)*(x(a|bc)*y){2,} xayxay y $& xayxay
1517(q1|.)*(q2|.)*(x(a|bc)*y){2,3} xayxay y $& xayxay
1518(q1|z)*(q2|z)*z{15}-.*?(x(a|bc)*y){2,3}Z zzzzzzzzzzzzzzzz-xayxayxayxayZ y $& zzzzzzzzzzzzzzzz-xayxayxayxayZ
1519
20dbff7c 1520(?:(?:)foo|bar|zot|rt78356) foo y $& foo
e40e74fe 1521/\xe0\pL/i \xc0a y $& \xc0a
1411dba4
KW
1522
1523# RT #85528
1524(?{})[\x{100}] \x{100} y $& \x{100}
6241f69e
KW
1525
1526# RT #85964
af302e7f 1527^m?(\S)(.*)\1$ aba y $1 a
6241f69e 1528^m?(\S)(.*)\1$ \tb\t n - -
af302e7f 1529^m?(\s)(.*)\1$ \tb\t y $1 \t
6241f69e 1530^m?(\s)(.*)\1$ aba n - -
af302e7f 1531^m?(\W)(.*)\1$ :b: y $1 :
6241f69e 1532^m?(\W)(.*)\1$ aba n - -
af302e7f 1533^m?(\w)(.*)\1$ aba y $1 a
6241f69e 1534^m?(\w)(.*)\1$ :b: n - -
af302e7f 1535^m?(\D)(.*)\1$ aba y $1 a
6241f69e 1536^m?(\D)(.*)\1$ 5b5 n - -
af302e7f 1537^m?(\d)(.*)\1$ 5b5 y $1 5
6241f69e 1538^m?(\d)(.*)\1$ aba n - -
f6a766d5
KW
1539
1540# 17F is 'Long s'; This makes sure the a's in /aa can be separate
1541/s/ai \x{17F} y $& \x{17F}
1542/s/aia \x{17F} n - -
1543/s/aia S y $& S
1544/(?aia:s)/ \x{17F} n - -
1545/(?aia:s)/ S y $& S
827f5bb8
KW
1546
1547# Normally 1E9E generates a multi-char fold, but not in inverted class;
1548# See [perl #89750]. This makes sure that the simple fold gets generated
1549# in that case, to DF.
073b366a 1550/[^\x{1E9E}]/i \x{DF} Sn - -
1380b51d
DM
1551
1552# RT #96354
1553/^.*\d\H/ X1 n - -
1554/^.*\d\V/ X1 n - -
1555
45376db6
KW
1556# \p{L_} was being misinterpreted as \p{L}. L_ matches cased letters, which
1557# the ideograph below isn't, whereas it does match L
1558/^\p{L_}/ \x{3400} n - -
1559/^\p{L}/ \x{3400} y $& \x{3400}
1560
fd0f00a9 1561# RT #89774
073b366a 1562/[s\xDF]a/ui ssa Sy $& ssa
9d53c457 1563/[s\xDF]a/ui sa y $& sa
fd0f00a9 1564
e47f2755 1565# RT #99928
1978b668 1566/^\R\x0A$/ \x0D\x0A n - -
e47f2755 1567
7b8a8069 1568/ff/i \x{FB00}\x{FB01} y $& \x{FB00}
7c1b9f38 1569/ff/i \x{FB01}\x{FB00} y $& \x{FB00}
7b8a8069 1570/fi/i \x{FB01}\x{FB00} y $& \x{FB01}
7c1b9f38 1571/fi/i \x{FB00}\x{FB01} y $& \x{FB01}
2866decb
DM
1572#
1573# Make sure we don't see code blocks where there aren't, and vice-versa
1574(?#( (?{1+)a a y - -
1575'a# (?{1+'x a y - -
1576ab[(?{1] ab1 y - -
1577ab[(?{1\](?{2] ab2 y - -
1578ab(?{"["})cd abcd y - -
e4a2df84
DM
1579ab(??{"[x]"})cd abxcd y - -
1580ab\[(??{1})c ab[1c y - -
1581ab\\[(??{1;})]c ab\\;c y - -
1582ab\\\[(??{1})c ab\\[1c y - -
1583ab[c\](??{"]d abcd y - -
1584ab[c\\](??{"[x]"})d ab\\xd y - -
1585ab[c\\\](??{"x"})]{3}d ab\\](d y - -
7b8a8069 1586
e067297c
KW
1587# These test that doesn't cut-off matching too soon in the string for
1588# multi-char folds
1589/ffiffl/i abcdef\x{FB03}\x{FB04} y $& \x{FB03}\x{FB04}
1590/\xdf\xdf/ui abcdefssss y $& ssss
1591
7a2d0ccc
KW
1592/st/i \x{DF}\x{FB05} y $& \x{FB05}
1593/ssst/i \x{DF}\x{FB05} y $& \x{DF}\x{FB05}
1594
4f03b4b6
KW
1595# [perl #101970]
1596/[[:lower:]]/i \x{100} y $& \x{100}
1597/[[:upper:]]/i \x{101} y $& \x{101}
1598
ed178f65
KW
1599# Was matching 'ss' only and failing the entire match, not seeing the
1600# alternative that would succeed
bb914485
KW
1601/s\xDF/ui \xDFs y $& \xDFs
1602/sst/ui s\N{LATIN SMALL LIGATURE ST} y $& s\N{LATIN SMALL LIGATURE ST}
1603/sst/ui s\N{LATIN SMALL LIGATURE LONG S T} y $& s\N{LATIN SMALL LIGATURE LONG S T}
ed178f65 1604
35245af4 1605# /i properties shouldn't match more than the property itself
ea317ccb
KW
1606/[[:ascii:]]/i \N{KELVIN SIGN} n - -
1607
dab0c3e7
KW
1608# [[:lower:]]/i and [[:upper:]]/i should match what \p{Lower} and \p{Upper} do.
1609# which is \p{Cased}, not \p{Alpha},
1610/[[:lower:]]/i \N{U+3400} n - -
1611/[[:upper:]]/i \N{U+01BB} n - -
1612
5d103fec
KW
1613# [perl #110648]
1614[^\p{Alphabetic}] \x{100} n - -
1615
b4069bca
KW
1616# [perl #111400]. Tests the first Y/N boundary above 255 for each of these.
1617/[[:alnum:]]/ \x{2c1} y - -
1618/[[:alnum:]]/ \x{2c2} n - -
1619/[[:alpha:]]/ \x{2c1} y - -
1620/[[:alpha:]]/ \x{2c2} n - -
1621/[[:graph:]]/ \x{377} y - -
1622/[[:graph:]]/ \x{378} n - -
1623/[[:lower:]]/ \x{100} n - -
1624/[[:lower:]]/ \x{101} y - -
1625/[[:lower:]]/ \x{102} n - -
1626/[[:print:]]/ \x{377} y - -
1627/[[:print:]]/ \x{378} n - -
1628/[[:punct:]]/ \x{37D} n - -
1629/[[:punct:]]/ \x{37E} y - -
1630/[[:punct:]]/ \x{388} n - -
1631/[[:upper:]]/ \x{100} y - -
1632/[[:upper:]]/ \x{101} n - -
1633/[[:word:]]/ \x{2c1} y - -
1634/[[:word:]]/ \x{2c2} n - -
1635
4adb7801
FC
1636# [perl #113400]
1637/syntax OK\s+\z/si t/bin/good.pl syntax OK\n y - -
b4069bca 1638
df826430
YO
1639/^(.*?)\s*\|\s*(?:\/\s*|)'(.+)'$/ text|'sec' y <$1><$2> <text><sec>
1640/^(foo|)bar$/ bar y <$&> <bar>
1641/^(foo||baz)bar$/ bar y <$&> <bar>
1642/^(foo||baz)bar$/ bazbar y <$1> <baz>
1643/^(foo||baz)bar$/ foobar y <$1> <foo>
1644
1645/^(?:foo|)bar$/ bar y <$&> <bar>
1646/^(?:foo||baz)bar$/ bar y <$&> <bar>
1647/^(?:foo||baz)bar$/ bazbar y <$&> <bazbar>
1648/^(?:foo||baz)bar$/ foobar y <$&> <foobar>
1649
1650/^(?i:foo|)bar$/ bar y <$&> <bar>
1651/^(?i:foo||baz)bar$/ bar y <$&> <bar>
1652/^(?i:foo||baz)bar$/ bazbar y <$&> <bazbar>
1653/^(?i:foo||baz)bar$/ foobar y <$&> <foobar>
1654
f6033a9d
DM
1655# $^N, $+ on backtrackracking
1656# BRANCH
1657^(.)(?:(..)|B)[CX] ABCDE y $^N-$+ A-A -
1658# TRIE
1659^(.)(?:BC(.)|B)[CX] ABCDE y $^N-$+ A-A -
1660# CURLYX
1661^(.)(?:(.)+)*[BX] ABCDE y $^N-$+ A-A -
1662# CURLYM
1663^(.)(BC)* ABCDE y $^N-$+ BC-BC -
1664^(.)(BC)*[BX] ABCDE y $^N-$+ A-A -
1665# CURLYN
1666^(.)(B)*.[DX] ABCDE y $^N-$+ B-B -
1667^(.)(B)*.[CX] ABCDE y $^N-$+ A-A -
1668
cec72654
DM
1669# using 'return' in code blocks
1670^(A)(?{"xyz"})B$ AB y $1-$^R A-xyz -
1671^(A)(?{return "xyz"})B$ AB y $1-$^R A-xyz -
1672^(A)((??{"xyz"}))$ Axyz y $1-$2 A-xyz -
1673^(A)((??{return "xyz"}))$ Axyz y $1-$2 A-xyz -
1674^(A)((?(?{1})abc|xyz))$ Aabc y $1-$2 A-abc -
1675^(A)((?(?{0})abc|xyz))$ Axyz y $1-$2 A-xyz -
1676^(A)((?(?{return 1})abc|xyz))$ Aabc y $1-$2 A-abc -
1677^(A)((?(?{return 0})abc|xyz))$ Axyz y $1-$2 A-xyz -
1678
ec841a27
DM
1679# pattern modifier flags should propagate into returned (??{}) pattern
1680# p,d,l not tested
1681
1682/^(a)((??{"b"}))$/i AB y $1-$2 A-B -
1683/^(A)((??{'B$'}))(\nC)$/m AB\nC y $1-$2-$3 A-B-\nC -
1684/^(A)((??{'.'}))(B)$/s A\nB y $1-$2-$3 A-\n-B -
1685/^(A) ((??{' .'}))(B)$/x A B y $1-$2-$3 A- -B -
1686/^((??{'\d'}))$/a \x{660} n - -
1687/^(??{"s"})$/i \x{17F} y - -
1688/^(??{"s"})$/ia \x{17F} y - -
1689/^(??{"s"})$/iaa \x{17F} n - -
1690/^(??{'\w'})$/u \x{AA} y - -
1691
a8d1f4b4
DM
1692# #113670 ensure any captures to the right are invalidated when CURLY
1693# and CURLYM backtrack
1694
1695^(?:(X)?(\d)|(X)?(\d\d))$ X12 y $1-$2-$3-$4 --X-12
1696^(?:(XX)?(\d)|(XX)?(\d\d))$ XX12 y $1-$2-$3-$4 --XX-12
1697
190c1910
YO
1698# rt 113770
1699\A(?>\[(?:(?:)(?:R){1}|T|V?|A)\])\z [A] y $& [A]
ac7af3f6
YO
1700# rt 114068
1701/( [^z] $ [^z]+)/xm aa\nbb\ncc\n y $1 a\nbb\ncc\n
d8661376
KW
1702
1703# [perl #114220]
1704/[\h]/ \x{A0} y $& \xA0
1705/[\H]/ \x{BF} y $& \xBF
1706/[\H]/ \x{A0} n - -
1707/[\H]/ \x{A1} y $& \xA1
1708
5a279aa0
KW
1709[^\n]+ \nb y $& b
1710[^\n]+ a\n y $& a
1711
0658cdde
KW
1712# /a has no effect on properties
1713(?a:\p{Any}) \x{100} y $& \x{100}
1714(?aa:\p{Any}) \x{100} y $& \x{100}
1715
7a4d6ad6
KW
1716\w \x{200C} y $& \x{200C}
1717\W \x{200C} n - -
1718\w \x{200D} y $& \x{200D}
1719\W \x{200D} n - -
1720
7dff6b46 1721/^(?d:\xdf|_)*_/i \x{17f}\x{17f}_ y $& \x{17f}\x{17f}_
6502e081
DM
1722#
1723# check that @-, @+ count chars, not bytes; especially if beginning of
1724# string is not copied
1725
1726(\x{100}) \x{2000}\x{2000}\x{2000}\x{100} y $-[0]:$-[1]:$+[0]:$+[1] 3:3:4:4
7dff6b46 1727
565fc1bb
KW
1728^\R{2}$ \r\n\r\n y $& \r\n\r\n
1729
4063ade8
KW
1730/^\D{11}/a \x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF} n - -
1731/^\S{11}/a \x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF} n - -
1732/^\W{11}/a \x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF} n - -
1733
d87fc68d 1734# [ perl #114272]
41043df0 1735\Vn \xFFn/ y $& \xFFn
d87fc68d 1736
b25a1036 1737/(?l:a?\w)/ b y $& b
4d68ffa0 1738m?^xy\?$? xy? y $& xy?
b25a1036 1739
aed7b151
DM
1740# check we have the right utf8ness as we switch back and forth between
1741# patterns
1742^(\x{100}|a)(??{ qr/.?\xF7/d}) a_\xF7 y - -
1743
c37d14f9
KW
1744# [perl #118375]
1745/(a|(bc)){0,0}?xyz/ xyz y $& xyz
1746/( a | ( bc ) ) {0,0} ? xyz/x xyz y $& xyz
1747
b75763d6
YO
1748/(a|(bc)){0,0}+xyz/ xyz y $& xyz
1749/( a | ( bc ) ) {0,0} + xyz/x xyz y $& xyz
1750
5c53df94
YO
1751(A(*PRUNE)B|A(*PRUNE)C) AC n - -
1752(A(*PRUNE)B|A(*PRUNE)D|A(*PRUNE)C) AC n - -
1753(A(*PRUNE)B|A(*PRUNE)C|A(*PRUNE)D) AC n - -
1754((A(*PRUNE)B|A(*PRUNE)C)) AC n - -
1755((A(*PRUNE)B|A(*PRUNE)D|A(*PRUNE)C)) AC n - -
1756((A(*PRUNE)B|A(*PRUNE)C|A(*PRUNE)D)) AC n - -
1757
b8f6efdd
YO
1758A+?(*THEN)BC AAABC y $& ABC
1759A+?(*PRUNE)BC AAABC y $& ABC
1760A+(*THEN)BC AAABC y $& AAABC
1761A+(*PRUNE)BC AAABC y $& AAABC
1762A+?(*THEN)BC(?{}) AAABC y $& ABC
1763A+?(*PRUNE)BC(?{}) AAABC y $& ABC
1764A+(*THEN)BC(?{}) AAABC y $& AAABC
1765A+(*PRUNE)BC(?{}) AAABC y $& AAABC
0b70ce6f 1766# vim: softtabstop=0 noexpandtab
c30fc27b
DM
1767/[#]/ a#b y $& #
1768/[#]b/ a#b y $& #b
1769/[#]/x a#b y $& #
1770/[#]b/x a#b y $& #b
1771/[#](?{})/x a#b y $& #
1772/[#](??{'b'})/x a#b y $& #b
1773/(?#)(?{})b/ a#b y $& b
1774/(?#)(??{'b'})/ a#b y $& b
1775/[(?#](?{})b/ a#b y $& #b
1776/[(?#](??{'b'})/ a#b y $& #b
1777/(?#)(?{})b/x a#b y $& b
1778/(?#)(??{'b'})/x a#b y $& b