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