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