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