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