• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This set of tests is not Perl-compatible. It checks on special features
2# of PCRE2's API, error diagnostics, and the compiled code of some patterns.
3# It also checks the non-Perl syntax that PCRE2 supports (Python, .NET,
4# Oniguruma). There are also some tests where PCRE2 and Perl differ,
5# either because PCRE2 can't be compatible, or there is a possible Perl
6# bug.
7
8# NOTE: This is a non-UTF set of tests. When UTF support is needed, use
9# test 5.
10
11#forbid_utf
12#newline_default lf any anycrlf
13
14# Test binary zeroes in the pattern
15
16# /a\0B/ where 0 is a binary zero
17/61 5c 00 62/B,hex
18    a\x{0}b
19
20# /a0b/ where 0 is a binary zero
21/61 00 62/B,hex
22    a\x{0}b
23
24# /(?#B0C)DE/ where 0 is a binary zero
25/28 3f 23 42 00 43 29 44 45/B,hex
26    DE
27
28/(a)b|/I
29
30/abc/I
31    abc
32    defabc
33    abc\=anchored
34\= Expect no match
35    defabc\=anchored
36    ABC
37
38/^abc/I
39    abc
40    abc\=anchored
41\= Expect no match
42    defabc
43    defabc\=anchored
44
45/a+bc/I
46
47/a*bc/I
48
49/a{3}bc/I
50
51/(abc|a+z)/I
52
53/^abc$/I
54    abc
55\= Expect no match
56    def\nabc
57
58/ab\idef/
59
60/(?X)ab\idef/
61
62/x{5,4}/
63
64/z{65536}/
65
66/[abcd/
67
68/[\B]/B
69
70/[\R]/B
71
72/[\X]/B
73
74/[z-a]/
75
76/^*/
77
78/(abc/
79
80/(?# abc/
81
82/(?z)abc/
83
84/.*b/I
85
86/.*?b/I
87
88/cat|dog|elephant/I
89    this sentence eventually mentions a cat
90    this sentences rambles on and on for a while and then reaches elephant
91
92/cat|dog|elephant/I
93    this sentence eventually mentions a cat
94    this sentences rambles on and on for a while and then reaches elephant
95
96/cat|dog|elephant/Ii
97    this sentence eventually mentions a CAT cat
98    this sentences rambles on and on for a while to elephant ElePhant
99
100/a|[bcd]/I
101
102/(a|[^\dZ])/I
103
104/(a|b)*[\s]/I
105
106/(ab\2)/
107
108/{4,5}abc/
109
110/(a)(b)(c)\2/I
111    abcb
112    abcb\=ovector=0
113    abcb\=ovector=1
114    abcb\=ovector=2
115    abcb\=ovector=3
116    abcb\=ovector=4
117
118/(a)bc|(a)(b)\2/I
119    abc
120    abc\=ovector=0
121    abc\=ovector=1
122    abc\=ovector=2
123    aba
124    aba\=ovector=0
125    aba\=ovector=1
126    aba\=ovector=2
127    aba\=ovector=3
128    aba\=ovector=4
129
130/abc$/I,dollar_endonly
131    abc
132\= Expect no match
133    abc\n
134    abc\ndef
135
136/(a)(b)(c)(d)(e)\6/
137
138/the quick brown fox/I
139    the quick brown fox
140    this is a line with the quick brown fox
141
142/the quick brown fox/I,anchored
143    the quick brown fox
144\= Expect no match
145    this is a line with the quick brown fox
146
147/ab(?z)cd/
148
149/^abc|def/I
150    abcdef
151    abcdef\=notbol
152
153/.*((abc)$|(def))/I
154    defabc
155    defabc\=noteol
156
157/)/
158
159/a[]b/
160
161/[^aeiou ]{3,}/I
162    co-processors, and for
163
164/<.*>/I
165    abc<def>ghi<klm>nop
166
167/<.*?>/I
168    abc<def>ghi<klm>nop
169
170/<.*>/I,ungreedy
171    abc<def>ghi<klm>nop
172
173/(?U)<.*>/I
174    abc<def>ghi<klm>nop
175
176/<.*?>/I,ungreedy
177    abc<def>ghi<klm>nop
178
179/={3,}/I,ungreedy
180    abc========def
181
182/(?U)={3,}?/I
183    abc========def
184
185/(?<!bar|cattle)foo/I
186    foo
187    catfoo
188\= Expect no match
189    the barfoo
190    and cattlefoo
191
192/abc(?<=a+)b/
193
194/12345(?<=aaa|b{0,3})b/
195
196/(?<!(foo)a\1)bar/
197
198/(?i)abc/I
199
200/(a|(?m)a)/I
201
202/(?i)^1234/I
203
204/(^b|(?i)^d)/I
205
206/(?s).*/I
207
208/[abcd]/I
209
210/(?i)[abcd]/I
211
212/(?m)[xy]|(b|c)/I
213
214/(^a|^b)/Im
215
216/(?i)(^a|^b)/Im
217
218/(a)(?(1)a|b|c)/
219
220/(?(?=a)a|b|c)/
221
222/(?(1a)/
223
224/(?(1a))/
225
226/(?(?i))/
227
228/(?(abc))/
229
230/(?(?<ab))/
231
232/((?s)blah)\s+\1/I
233
234/((?i)blah)\s+\1/I
235
236/((?i)b)/IB
237
238/(a*b|(?i:c*(?-i)d))/I
239
240/a$/I
241    a
242    a\n
243\= Expect no match
244    a\=noteol
245    a\n\=noteol
246
247/a$/Im
248    a
249    a\n
250    a\n\=noteol
251\= Expect no match
252    a\=noteol
253
254/\Aabc/Im
255
256/^abc/Im
257
258/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/I
259  aaaaabbbbbcccccdef
260
261/(?<=foo)[ab]/I
262
263/(?<!foo)(alpha|omega)/I
264
265/(?!alphabet)[ab]/I
266
267/(?<=foo\n)^bar/Im
268    foo\nbarbar
269\= Expect no match
270    rhubarb
271    barbell
272    abc\nbarton
273
274/^(?<=foo\n)bar/Im
275    foo\nbarbar
276\= Expect no match
277    rhubarb
278    barbell
279    abc\nbarton
280
281/(?>^abc)/Im
282    abc
283    def\nabc
284\= Expect no match
285    defabc
286
287/(?<=ab(c+)d)ef/
288
289/(?<=ab(?<=c+)d)ef/
290
291/(?<=ab(c|de)f)g/
292
293/The next three are in testinput2 because they have variable length branches/
294
295/(?<=bullock|donkey)-cart/I
296    the bullock-cart
297    a donkey-cart race
298\= Expect no match
299    cart
300    horse-and-cart
301
302/(?<=ab(?i)x|y|z)/I
303
304/(?>.*)(?<=(abcd)|(xyz))/I
305    alphabetabcd
306    endingxyz
307
308/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/I
309    abxyZZ
310    abXyZZ
311    ZZZ
312    zZZ
313    bZZ
314    BZZ
315\= Expect no match
316    ZZ
317    abXYZZ
318    zzz
319    bzz
320
321/(?<!(foo)a)bar/I
322    bar
323    foobbar
324\= Expect no match
325    fooabar
326
327# Perl does not fail these two for the final subjects.
328
329/^(xa|=?\1a){2}$/
330    xa=xaa
331\= Expect no match
332    xa=xaaa
333
334/^(xa|=?\1a)+$/
335    xa=xaa
336\= Expect no match
337    xa=xaaa
338
339# These are syntax tests from Perl 5.005
340
341/a[b-a]/
342
343/a[]b/
344
345/a[/
346
347/*a/
348
349/(*)b/
350
351/abc)/
352
353/(abc/
354
355/a**/
356
357/)(/
358
359/\1/
360
361/\2/
362
363/(a)|\2/
364
365/a[b-a]/Ii
366
367/a[]b/Ii
368
369/a[/Ii
370
371/*a/Ii
372
373/(*)b/Ii
374
375/abc)/Ii
376
377/(abc/Ii
378
379/a**/Ii
380
381/)(/Ii
382
383/:(?:/
384
385/(?<%)b/
386
387/a(?{)b/
388
389/a(?{{})b/
390
391/a(?{}})b/
392
393/a(?{"{"})b/
394
395/a(?{"{"}})b/
396
397/(?(1?)a|b)/
398
399/[a[:xyz:/
400
401/(?<=x+)y/
402
403/a{37,17}/
404
405/abc/\
406
407/abc/\i
408
409/(a)bc(d)/I
410    abcd
411    abcd\=copy=2
412    abcd\=copy=5
413
414/(.{20})/I
415    abcdefghijklmnopqrstuvwxyz
416    abcdefghijklmnopqrstuvwxyz\=copy=1
417    abcdefghijklmnopqrstuvwxyz\=get=1
418
419/(.{15})/I
420    abcdefghijklmnopqrstuvwxyz
421    abcdefghijklmnopqrstuvwxyz\=copy=1,get=1
422
423/(.{16})/I
424    abcdefghijklmnopqrstuvwxyz
425    abcdefghijklmnopqrstuvwxyz\=copy=1,get=1,getall
426
427/^(a|(bc))de(f)/I
428    adef\=get=1,get=2,get=3,get=4,getall
429    bcdef\=get=1,get=2,get=3,get=4,getall
430    adefghijk\=copy=0
431
432/^abc\00def/I
433    abc\00def\=copy=0,getall
434
435/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
436)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
437)?)?)?)?)?)?)?)?)?otherword/I
438
439/.*X/IB
440
441/.*X/IBs
442
443/(.*X|^B)/IB
444
445/(.*X|^B)/IBs
446
447/(?s)(.*X|^B)/IB
448
449/(?s:.*X|^B)/IB
450
451/\Biss\B/I,aftertext
452    Mississippi
453
454/iss/I,aftertext,altglobal
455    Mississippi
456
457/\Biss\B/I,aftertext,altglobal
458    Mississippi
459
460/\Biss\B/Ig,aftertext
461    Mississippi
462\= Expect no match
463    Mississippi\=anchored
464
465/(?<=[Ms])iss/Ig,aftertext
466    Mississippi
467
468/(?<=[Ms])iss/I,aftertext,altglobal
469    Mississippi
470
471/^iss/Ig,aftertext
472    ississippi
473
474/.*iss/Ig,aftertext
475    abciss\nxyzisspqr
476
477/.i./Ig,aftertext
478    Mississippi
479    Mississippi\=anchored
480    Missouri river
481    Missouri river\=anchored
482
483/^.is/Ig,aftertext
484    Mississippi
485
486/^ab\n/Ig,aftertext
487    ab\nab\ncd
488
489/^ab\n/Igm,aftertext
490    ab\nab\ncd
491
492/^/gm,newline=any
493    a\rb\nc\r\nxyz\=aftertext
494
495/abc/I
496
497/abc|bac/I
498
499/(abc|bac)/I
500
501/(abc|(c|dc))/I
502
503/(abc|(d|de)c)/I
504
505/a*/I
506
507/a+/I
508
509/(baa|a+)/I
510
511/a{0,3}/I
512
513/baa{3,}/I
514
515/"([^\\"]+|\\.)*"/I
516
517/(abc|ab[cd])/I
518
519/(a|.)/I
520
521/a|ba|\w/I
522
523/abc(?=pqr)/I
524
525/...(?<=abc)/I
526
527/abc(?!pqr)/I
528
529/ab./I
530
531/ab[xyz]/I
532
533/abc*/I
534
535/ab.c*/I
536
537/a.c*/I
538
539/.c*/I
540
541/ac*/I
542
543/(a.c*|b.c*)/I
544
545/a.c*|aba/I
546
547/.+a/I
548
549/(?=abcda)a.*/I
550
551/(?=a)a.*/I
552
553/a(b)*/I
554
555/a\d*/I
556
557/ab\d*/I
558
559/a(\d)*/I
560
561/abcde{0,0}/I
562
563/ab\d+/I
564
565/a(?(1)b)(.)/I
566
567/a(?(1)bag|big)(.)/I
568
569/a(?(1)bag|big)*(.)/I
570
571/a(?(1)bag|big)+(.)/I
572
573/a(?(1)b..|b..)(.)/I
574
575/ab\d{0}e/I
576
577/a?b?/I
578    a
579    b
580    ab
581    \
582\= Expect no match
583    \=notempty
584
585/|-/I
586    abcd
587    -abc
588    ab-c\=notempty
589\= Expect no match
590    abc\=notempty
591
592/^.?abcd/I
593
594/\(             # ( at start
595  (?:           # Non-capturing bracket
596  (?>[^()]+)    # Either a sequence of non-brackets (no backtracking)
597  |             # Or
598  (?R)          # Recurse - i.e. nested bracketed string
599  )*            # Zero or more contents
600  \)            # Closing )
601  /Ix
602    (abcd)
603    (abcd)xyz
604    xyz(abcd)
605    (ab(xy)cd)pqr
606    (ab(xycd)pqr
607    () abc ()
608    12(abcde(fsh)xyz(foo(bar))lmno)89
609\= Expect no match
610    abcd
611    abcd)
612    (abcd
613
614/\(  ( (?>[^()]+) | (?R) )* \) /Igx
615    (ab(xy)cd)pqr
616    1(abcd)(x(y)z)pqr
617
618/\(  (?: (?>[^()]+) | (?R) ) \) /Ix
619    (abcd)
620    (ab(xy)cd)
621    (a(b(c)d)e)
622    ((ab))
623\= Expect no match
624    ()
625
626/\(  (?: (?>[^()]+) | (?R) )? \) /Ix
627    ()
628    12(abcde(fsh)xyz(foo(bar))lmno)89
629
630/\(  ( (?>[^()]+) | (?R) )* \) /Ix
631    (ab(xy)cd)
632
633/\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
634    (ab(xy)cd)
635
636/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix
637    (ab(xy)cd)
638    (123ab(xy)cd)
639
640/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix
641    (ab(xy)cd)
642    (123ab(xy)cd)
643
644/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
645    (ab(xy)cd)
646
647/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
648    (abcd(xyz<p>qrs)123)
649
650/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
651    (ab(cd)ef)
652    (ab(cd(ef)gh)ij)
653
654/^[[:alnum:]]/IB
655
656/^[[:^alnum:]]/IB
657
658/^[[:alpha:]]/IB
659
660/^[[:^alpha:]]/IB
661
662/[_[:alpha:]]/I
663
664/^[[:ascii:]]/IB
665
666/^[[:^ascii:]]/IB
667
668/^[[:blank:]]/IB
669
670/^[[:^blank:]]/IB
671
672/[\n\x0b\x0c\x0d[:blank:]]/I
673
674/^[[:cntrl:]]/IB
675
676/^[[:digit:]]/IB
677
678/^[[:graph:]]/IB
679
680/^[[:lower:]]/IB
681
682/^[[:print:]]/IB
683
684/^[[:punct:]]/IB
685
686/^[[:space:]]/IB
687
688/^[[:upper:]]/IB
689
690/^[[:xdigit:]]/IB
691
692/^[[:word:]]/IB
693
694/^[[:^cntrl:]]/IB
695
696/^[12[:^digit:]]/IB
697
698/^[[:^blank:]]/IB
699
700/[01[:alpha:]%]/IB
701
702/[[.ch.]]/I
703
704/[[=ch=]]/I
705
706/[[:rhubarb:]]/I
707
708/[[:upper:]]/Ii
709    A
710    a
711
712/[[:lower:]]/Ii
713    A
714    a
715
716/((?-i)[[:lower:]])[[:lower:]]/Ii
717    ab
718    aB
719\= Expect no match
720    Ab
721    AB
722
723/[\200-\110]/I
724
725/^(?(0)f|b)oo/I
726
727# This one's here because of the large output vector needed
728
729/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/I
730     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC\=ovector=300
731
732# This one's here because Perl does this differently and PCRE2 can't at present
733
734/(main(O)?)+/I
735    mainmain
736    mainOmain
737
738# These are all cases where Perl does it differently (nested captures)
739
740/^(a(b)?)+$/I
741    aba
742
743/^(aa(bb)?)+$/I
744    aabbaa
745
746/^(aa|aa(bb))+$/I
747    aabbaa
748
749/^(aa(bb)??)+$/I
750    aabbaa
751
752/^(?:aa(bb)?)+$/I
753    aabbaa
754
755/^(aa(b(b))?)+$/I
756    aabbaa
757
758/^(?:aa(b(b))?)+$/I
759    aabbaa
760
761/^(?:aa(b(?:b))?)+$/I
762    aabbaa
763
764/^(?:aa(bb(?:b))?)+$/I
765    aabbbaa
766
767/^(?:aa(b(?:bb))?)+$/I
768    aabbbaa
769
770/^(?:aa(?:b(b))?)+$/I
771    aabbaa
772
773/^(?:aa(?:b(bb))?)+$/I
774    aabbbaa
775
776/^(aa(b(bb))?)+$/I
777    aabbbaa
778
779/^(aa(bb(bb))?)+$/I
780    aabbbbaa
781
782# ----------------
783
784/#/IBx
785
786/a#/IBx
787
788/[\s]/IB
789
790/[\S]/IB
791
792/a(?i)b/IB
793    ab
794    aB
795\= Expect no match
796    AB
797
798/(a(?i)b)/IB
799    ab
800    aB
801\= Expect no match
802    AB
803
804/   (?i)abc/IBx
805
806/#this is a comment
807  (?i)abc/IBx
808
809/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB
810
811/\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB
812
813/\Q\E/IB
814    \
815
816/\Q\Ex/IB
817
818/ \Q\E/IB
819
820/a\Q\E/IB
821  abc
822  bca
823  bac
824
825/a\Q\Eb/IB
826  abc
827
828/\Q\Eabc/IB
829
830/x*+\w/IB
831\= Expect no match
832    xxxxx
833
834/x?+/IB
835
836/x++/IB
837
838/x{1,3}+/B,no_auto_possess
839
840/x{1,3}+/Bi,no_auto_possess
841
842/[^x]{1,3}+/B,no_auto_possess
843
844/[^x]{1,3}+/Bi,no_auto_possess
845
846/(x)*+/IB
847
848/^(\w++|\s++)*$/I
849    now is the time for all good men to come to the aid of the party
850\= Expect no match
851    this is not a line with only words and spaces!
852
853/(\d++)(\w)/I
854    12345a
855\= Expect no match
856    12345+
857
858/a++b/I
859    aaab
860
861/(a++b)/I
862    aaab
863
864/(a++)b/I
865    aaab
866
867/([^()]++|\([^()]*\))+/I
868    ((abc(ade)ufh()()x
869
870/\(([^()]++|\([^()]+\))+\)/I
871    (abc)
872    (abc(def)xyz)
873\= Expect no match
874    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
875
876/(abc){1,3}+/IB
877
878/a+?+/I
879
880/a{2,3}?+b/I
881
882/(?U)a+?+/I
883
884/a{2,3}?+b/I,ungreedy
885
886/x(?U)a++b/IB
887    xaaaab
888
889/(?U)xa++b/IB
890    xaaaab
891
892/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/IB
893
894/^x(?U)a+b/IB
895
896/^x(?U)(a+)b/IB
897
898/[.x.]/I
899
900/[=x=]/I
901
902/[:x:]/I
903
904/\F/I
905
906/\l/I
907
908/\L/I
909
910/\N{name}/I
911
912/\u/I
913
914/\U/I
915
916/a{1,3}b/ungreedy
917    ab
918
919/[/I
920
921/[a-/I
922
923/[[:space:]/I
924
925/[\s]/IB
926
927/[[:space:]]/IB
928
929/[[:space:]abcde]/IB
930
931/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/Ix
932    <>
933    <abcd>
934    <abc <123> hij>
935    <abc <def> hij>
936    <abc<>def>
937    <abc<>
938\= Expect no match
939    <abc
940
941/8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b/IB
942
943/\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b/IB
944
945/(.*)\d+\1/I
946
947/(.*)\d+/I
948
949/(.*)\d+\1/Is
950
951/(.*)\d+/Is
952
953/(.*(xyz))\d+\2/I
954
955/((.*))\d+\1/I
956    abc123bc
957
958/a[b]/I
959
960/(?=a).*/I
961
962/(?=abc).xyz/Ii
963
964/(?=abc)(?i).xyz/I
965
966/(?=a)(?=b)/I
967
968/(?=.)a/I
969
970/((?=abcda)a)/I
971
972/((?=abcda)ab)/I
973
974/()a/I
975
976/(?:(?=.)|(?<!x))a/I
977
978/(?(1)ab|ac)(.)/I
979
980/(?(1)abz|acz)(.)/I
981
982/(?(1)abz)(.)/I
983
984/(?(1)abz)(1)23/I
985
986/(a)+/I
987
988/(a){2,3}/I
989
990/(a)*/I
991
992/[a]/I
993
994/[ab]/I
995
996/[ab]/I
997
998/[^a]/I
999
1000/\d456/I
1001
1002/\d456/I
1003
1004/a^b/I
1005
1006/^a/Im
1007  abcde
1008  xy\nabc
1009\= Expect no match
1010  xyabc
1011
1012/c|abc/I
1013
1014/(?i)[ab]/I
1015
1016/[ab](?i)cd/I
1017
1018/abc(?C)def/I
1019    abcdef
1020    1234abcdef
1021\= Expect no match
1022    abcxyz
1023    abcxyzf
1024
1025/abc(?C)de(?C1)f/I
1026    123abcdef
1027
1028/(?C1)\dabc(?C2)def/I
1029    1234abcdef
1030\= Expect no match
1031    abcdef
1032
1033/(?C1)\dabc(?C2)def/I
1034    1234abcdef
1035\= Expect no match
1036    abcdef
1037
1038/(?C255)ab/I
1039
1040/(?C256)ab/I
1041
1042/(?Cab)xx/I
1043
1044/(?C12vr)x/I
1045
1046/abc(?C)def/I
1047    \x83\x0\x61bcdef
1048
1049/(abc)(?C)de(?C1)f/I
1050    123abcdef
1051    123abcdef\=callout_capture
1052    123abcdefC-\=callout_none
1053\= Expect no match
1054    123abcdef\=callout_fail=1
1055
1056/(?C0)(abc(?C1))*/I
1057    abcabcabc
1058    abcabc\=callout_fail=1:4
1059    abcabcabc\=callout_fail=1:4
1060
1061/(\d{3}(?C))*/I
1062    123\=callout_capture
1063    123456\=callout_capture
1064    123456789\=callout_capture
1065
1066/((xyz)(?C)p|(?C1)xyzabc)/I
1067    xyzabc\=callout_capture
1068
1069/(X)((xyz)(?C)p|(?C1)xyzabc)/I
1070    Xxyzabc\=callout_capture
1071
1072/(?=(abc))(?C)abcdef/I
1073    abcdef\=callout_capture
1074
1075/(?!(abc)(?C1)d)(?C2)abcxyz/I
1076    abcxyz\=callout_capture
1077
1078/(?<=(abc)(?C))xyz/I
1079   abcxyz\=callout_capture
1080
1081/a(b+)(c*)(?C1)/I
1082\= Expect no match
1083    abbbbbccc\=callout_data=1
1084
1085/a(b+?)(c*?)(?C1)/I
1086\= Expect no match
1087    abbbbbccc\=callout_data=1
1088
1089/(?C)abc/I
1090
1091/(?C)^abc/I
1092
1093/(?C)a|b/I
1094
1095/a|(b)(?C)/I
1096    b
1097
1098/x(ab|(bc|(de|(?R))))/I
1099    xab
1100    xbc
1101    xde
1102    xxab
1103    xxxab
1104\= Expect no match
1105    xyab
1106
1107/^([^()]|\((?1)*\))*$/I
1108    abc
1109    a(b)c
1110    a(b(c))d
1111\= Expect no match)
1112    a(b(c)d
1113
1114/^>abc>([^()]|\((?1)*\))*<xyz<$/I
1115   >abc>123<xyz<
1116   >abc>1(2)3<xyz<
1117   >abc>(1(2)3)<xyz<
1118
1119/(a(?1)b)/IB
1120
1121/(a(?1)+b)/IB
1122
1123/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/I
1124    12
1125    (((2+2)*-3)-7)
1126    -12
1127\= Expect no match
1128    ((2+2)*-3)-7)
1129
1130/^(x(y|(?1){2})z)/I
1131    xyz
1132    xxyzxyzz
1133\= Expect no match
1134    xxyzz
1135    xxyzxyzxyzz
1136
1137/((< (?: (?(R) \d++  | [^<>]*+) | (?2)) * >))/Ix
1138    <>
1139    <abcd>
1140    <abc <123> hij>
1141    <abc <def> hij>
1142    <abc<>def>
1143    <abc<>
1144\= Expect no match
1145    <abc
1146
1147/(?1)/I
1148
1149/((?2)(abc)/I
1150
1151/^(abc)def(?1)/I
1152    abcdefabc
1153
1154/^(a|b|c)=(?1)+/I
1155    a=a
1156    a=b
1157    a=bc
1158
1159/^(a|b|c)=((?1))+/I
1160    a=a
1161    a=b
1162    a=bc
1163
1164/a(?P<name1>b|c)d(?P<longername2>e)/IB
1165    abde
1166    acde
1167
1168/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/IB
1169
1170/(?P<a>a)...(?P=a)bbb(?P>a)d/IB
1171
1172/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/Ii
1173    1221
1174    Satan, oscillate my metallic sonatas!
1175    A man, a plan, a canal: Panama!
1176    Able was I ere I saw Elba.
1177\= Expect no match
1178    The quick brown fox
1179
1180/((?(R)a|b))\1(?1)?/I
1181  bb
1182  bbaa
1183
1184/(.*)a/Is
1185
1186/(.*)a\1/Is
1187
1188/(.*)a(b)\2/Is
1189
1190/((.*)a|(.*)b)z/Is
1191
1192/((.*)a|(.*)b)z\1/Is
1193
1194/((.*)a|(.*)b)z\2/Is
1195
1196/((.*)a|(.*)b)z\3/Is
1197
1198/((.*)a|^(.*)b)z\3/Is
1199
1200/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is
1201
1202/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is
1203
1204/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is
1205
1206/(a)(bc)/IB,no_auto_capture
1207  abc
1208
1209/(?P<one>a)(bc)/IB,no_auto_capture
1210  abc
1211
1212/(a)(?P<named>bc)/IB,no_auto_capture
1213
1214/(aaa(?C1)bbb|ab)/I
1215   aaabbb
1216   aaabbb\=callout_data=0
1217   aaabbb\=callout_data=1
1218\= Expect no match
1219   aaabbb\=callout_data=-1
1220
1221/ab(?P<one>cd)ef(?P<two>gh)/I
1222    abcdefgh
1223    abcdefgh\=copy=1,get=two
1224    abcdefgh\=copy=one,copy=two
1225    abcdefgh\=copy=three
1226
1227/(?P<Tes>)(?P<Test>)/IB
1228
1229/(?P<Test>)(?P<Tes>)/IB
1230
1231/(?P<Z>zz)(?P<A>aa)/I
1232    zzaa\=copy=Z
1233    zzaa\=copy=A
1234
1235/(?P<x>eks)(?P<x>eccs)/I
1236
1237/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/I
1238
1239"\[((?P<elem>\d+)(,(?P>elem))*)\]"I
1240    [10,20,30,5,5,4,4,2,43,23,4234]
1241\= Expect no match
1242    []
1243
1244"\[((?P<elem>\d+)(,(?P>elem))*)?\]"I
1245    [10,20,30,5,5,4,4,2,43,23,4234]
1246    []
1247
1248/(a(b(?2)c))?/IB
1249
1250/(a(b(?2)c))*/IB
1251
1252/(a(b(?2)c)){0,2}/IB
1253
1254/[ab]{1}+/B
1255
1256/()(?1){1}/B
1257
1258/()(?1)/B
1259
1260/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
1261     Baby Bjorn Active Carrier - With free SHIPPING!!
1262
1263/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
1264     Baby Bjorn Active Carrier - With free SHIPPING!!
1265
1266/a*.*b/IB
1267
1268/(a|b)*.?c/IB
1269
1270/abc(?C255)de(?C)f/IB
1271
1272/abcde/IB,auto_callout
1273  abcde
1274\= Expect no match
1275  abcdfe
1276
1277/a*b/IB,auto_callout
1278  ab
1279  aaaab
1280  aaaacb
1281
1282/a*b/IB,auto_callout
1283  ab
1284  aaaab
1285  aaaacb
1286
1287/a+b/IB,auto_callout
1288  ab
1289  aaaab
1290\= Expect no match
1291  aaaacb
1292
1293/(abc|def)x/IB,auto_callout
1294  abcx
1295  defx
1296\= Expect no match
1297  abcdefzx
1298
1299/(abc|def)x/IB,auto_callout
1300  abcx
1301  defx
1302\= Expect no match
1303  abcdefzx
1304
1305/(ab|cd){3,4}/I,auto_callout
1306  ababab
1307  abcdabcd
1308  abcdcdcdcdcd
1309
1310/([ab]{,4}c|xy)/IB,auto_callout
1311\= Expect no match
1312    Note: that { does NOT introduce a quantifier
1313
1314/([ab]{,4}c|xy)/IB,auto_callout
1315\= Expect no match
1316    Note: that { does NOT introduce a quantifier
1317
1318/([ab]{1,4}c|xy){4,5}?123/IB,auto_callout
1319    aacaacaacaacaac123
1320
1321/\b.*/I
1322  ab cd\=offset=1
1323
1324/\b.*/Is
1325  ab cd\=startoffset=1
1326
1327/(?!.bcd).*/I
1328  Xbcd12345
1329
1330/abcde/I
1331    ab\=ps
1332    abc\=ps
1333    abcd\=ps
1334    abcde\=ps
1335    the quick brown abc\=ps
1336\= Expect no match\=ps
1337    the quick brown abxyz fox\=ps
1338
1339"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I
1340    13/05/04\=ps
1341    13/5/2004\=ps
1342    02/05/09\=ps
1343    1\=ps
1344    1/2\=ps
1345    1/2/0\=ps
1346    1/2/04\=ps
1347    0\=ps
1348    02/\=ps
1349    02/0\=ps
1350    02/1\=ps
1351\= Expect no match\=ps
1352    \=ps
1353    123\=ps
1354    33/4/04\=ps
1355    3/13/04\=ps
1356    0/1/2003\=ps
1357    0/\=ps
1358    02/0/\=ps
1359    02/13\=ps
1360
1361/0{0,2}ABC/I
1362
1363/\d{3,}ABC/I
1364
1365/\d*ABC/I
1366
1367/[abc]+DE/I
1368
1369/[abc]?123/I
1370    123\=ps
1371    a\=ps
1372    b\=ps
1373    c\=ps
1374    c12\=ps
1375    c123\=ps
1376
1377/^(?:\d){3,5}X/I
1378    1\=ps
1379    123\=ps
1380    123X
1381    1234\=ps
1382    1234X
1383    12345\=ps
1384    12345X
1385\= Expect no match
1386    1X
1387    123456\=ps
1388
1389"<(\w+)/?>(.)*</(\1)>"Igms
1390    <!DOCTYPE seite SYSTEM "http://www.lco.lineas.de/xmlCms.dtd">\n<seite>\n<dokumenteninformation>\n<seitentitel>Partner der LCO</seitentitel>\n<sprache>de</sprache>\n<seitenbeschreibung>Partner der LINEAS Consulting\nGmbH</seitenbeschreibung>\n<schluesselworte>LINEAS Consulting GmbH Hamburg\nPartnerfirmen</schluesselworte>\n<revisit>30 days</revisit>\n<robots>index,follow</robots>\n<menueinformation>\n<aktiv>ja</aktiv>\n<menueposition>3</menueposition>\n<menuetext>Partner</menuetext>\n</menueinformation>\n<lastedited>\n<autor>LCO</autor>\n<firma>LINEAS Consulting</firma>\n<datum>15.10.2003</datum>\n</lastedited>\n</dokumenteninformation>\n<inhalt>\n\n<absatzueberschrift>Die Partnerfirmen der LINEAS Consulting\nGmbH</absatzueberschrift>\n\n<absatz><link ziel="http://www.ca.com/" zielfenster="_blank">\n<bild name="logo_ca.gif" rahmen="no"/></link> <link\nziel="http://www.ey.com/" zielfenster="_blank"><bild\nname="logo_euy.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.cisco.de/" zielfenster="_blank">\n<bild name="logo_cisco.gif" rahmen="ja"/></link></absatz>\n\n<absatz><link ziel="http://www.atelion.de/"\nzielfenster="_blank"><bild\nname="logo_atelion.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.line-information.de/"\nzielfenster="_blank">\n<bild name="logo_line_information.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><bild name="logo_aw.gif" rahmen="no"/></absatz>\n\n<absatz><link ziel="http://www.incognis.de/"\nzielfenster="_blank"><bild\nname="logo_incognis.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.addcraft.com/"\nzielfenster="_blank"><bild\nname="logo_addcraft.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.comendo.com/"\nzielfenster="_blank"><bild\nname="logo_comendo.gif" rahmen="no"/></link></absatz>\n\n</inhalt>\n</seite>\=jitstack=1024
1391
1392/line\nbreak/I
1393    this is a line\nbreak
1394    line one\nthis is a line\nbreak in the second line
1395
1396/line\nbreak/I,firstline
1397    this is a line\nbreak
1398\= Expect no match
1399    line one\nthis is a line\nbreak in the second line
1400
1401/line\nbreak/Im,firstline
1402    this is a line\nbreak
1403\= Expect no match
1404    line one\nthis is a line\nbreak in the second line
1405
1406/(?i)(?-i)AbCd/I
1407    AbCd
1408\= Expect no match
1409    abcd
1410
1411/a{11111111111111111111}/I
1412
1413/(){64294967295}/I
1414
1415/(){2,4294967295}/I
1416
1417"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I
1418    abcdefghijklAkB
1419
1420"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"I
1421    abcdefghijklAkB
1422
1423"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I
1424    abcdefghijklAkB
1425
1426"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"I
1427    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1428
1429"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"I
1430    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1431
1432/[^()]*(?:\((?R)\)[^()]*)*/I
1433    (this(and)that
1434    (this(and)that)
1435    (this(and)that)stuff
1436
1437/[^()]*(?:\((?>(?R))\)[^()]*)*/I
1438    (this(and)that
1439    (this(and)that)
1440
1441/[^()]*(?:\((?R)\))*[^()]*/I
1442    (this(and)that
1443    (this(and)that)
1444
1445/(?:\((?R)\))*[^()]*/I
1446    (this(and)that
1447    (this(and)that)
1448    ((this))
1449
1450/(?:\((?R)\))|[^()]*/I
1451    (this(and)that
1452    (this(and)that)
1453    (this)
1454    ((this))
1455
1456/\x{0000ff}/I
1457
1458/^((?P<A>a1)|(?P<A>a2)b)/I
1459
1460/^((?P<A>a1)|(?P<A>a2)b)/I,dupnames
1461    a1b\=copy=A
1462    a2b\=copy=A
1463    a1b\=copy=Z,copy=A
1464
1465/(?|(?<a>)(?<b>)(?<a>)|(?<a>)(?<b>)(?<a>))/I,dupnames
1466
1467/^(?P<A>a)(?P<A>b)/I,dupnames
1468    ab\=copy=A
1469
1470/^(?P<A>a)(?P<A>b)|cd/I,dupnames
1471    ab\=copy=A
1472    cd\=copy=A
1473
1474/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/I,dupnames
1475    cdefgh\=copy=A
1476
1477/^((?P<A>a1)|(?P<A>a2)b)/I,dupnames
1478    a1b\=get=A
1479    a2b\=get=A
1480    a1b\=get=Z,get=A
1481
1482/^(?P<A>a)(?P<A>b)/I,dupnames
1483    ab\=get=A
1484
1485/^(?P<A>a)(?P<A>b)|cd/I,dupnames
1486    ab\=get=A
1487    cd\=get=A
1488
1489/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/I,dupnames
1490    cdefgh\=get=A
1491
1492/(?J)^((?P<A>a1)|(?P<A>a2)b)/I
1493    a1b\=copy=A
1494    a2b\=copy=A
1495
1496/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/I
1497
1498# In this next test, J is not set at the outer level; consequently it isn't set
1499# in the pattern's options; consequently pcre2_substring_get_byname() produces
1500# a random value.
1501
1502/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/I
1503    a bc d\=copy=A,copy=B,copy=C
1504
1505/^(?P<A>a)?(?(A)a|b)/I
1506    aabc
1507    bc
1508\= Expect no match
1509    abc
1510
1511/(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
1512    bXaX
1513
1514/(?:(?(2y)a|b)(X))+/I
1515
1516/(?:(?(ZA)a|b)(?P<ZZ>X))+/I
1517
1518/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
1519    bbXaaX
1520
1521/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
1522    (b)\\Xa\\X
1523
1524/(?P<ABC/I
1525
1526/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
1527    bXXaYYaY
1528    bXYaXXaX
1529
1530/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
1531    bXXaYYaY
1532
1533/\s*,\s*/I
1534    \x0b,\x0b
1535    \x0c,\x0d
1536
1537/^abc/Im,newline=lf
1538    xyz\nabc
1539    xyz\r\nabc
1540\= Expect no match
1541    xyz\rabc
1542    xyzabc\r
1543    xyzabc\rpqr
1544    xyzabc\r\n
1545    xyzabc\r\npqr
1546
1547/^abc/Im,newline=crlf
1548    xyz\r\nabclf>
1549\= Expect no match
1550    xyz\nabclf
1551    xyz\rabclf
1552
1553/^abc/Im,newline=cr
1554    xyz\rabc
1555\= Expect no match
1556    xyz\nabc
1557    xyz\r\nabc
1558
1559/^abc/Im,newline=bad
1560
1561/.*/I,newline=lf
1562    abc\ndef
1563    abc\rdef
1564    abc\r\ndef
1565
1566/.*/I,newline=cr
1567    abc\ndef
1568    abc\rdef
1569    abc\r\ndef
1570
1571/.*/I,newline=crlf
1572    abc\ndef
1573    abc\rdef
1574    abc\r\ndef
1575
1576/\w+(.)(.)?def/Is
1577    abc\ndef
1578    abc\rdef
1579    abc\r\ndef
1580
1581/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
1582
1583/()()()()()()()()()()()()()()()()()()()()
1584 ()()()()()()()()()()()()()()()()()()()()
1585 ()()()()()()()()()()()()()()()()()()()()
1586 ()()()()()()()()()()()()()()()()()()()()
1587 ()()()()()()()()()()()()()()()()()()()()
1588 (.(.))/Ix
1589    XY\=ovector=133
1590
1591/(a*b|(?i:c*(?-i)d))/I
1592
1593/()[ab]xyz/I
1594
1595/(|)[ab]xyz/I
1596
1597/(|c)[ab]xyz/I
1598
1599/(|c?)[ab]xyz/I
1600
1601/(d?|c?)[ab]xyz/I
1602
1603/(d?|c)[ab]xyz/I
1604
1605/^a*b\d/IB
1606
1607/^a*+b\d/IB
1608
1609/^a*?b\d/IB
1610
1611/^a+A\d/IB
1612    aaaA5
1613\= Expect no match
1614    aaaa5
1615
1616/^a*A\d/IBi
1617    aaaA5
1618    aaaa5
1619    a5
1620
1621/(a*|b*)[cd]/I
1622
1623/(a+|b*)[cd]/I
1624
1625/(a*|b+)[cd]/I
1626
1627/(a+|b+)[cd]/I
1628
1629/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
1630 ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
1631 (((
1632 a
1633 ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
1634 ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
1635 )))
1636/Ix
1637  large nest
1638
1639/a*\d/B
1640
1641/a*\D/B
1642
1643/0*\d/B
1644
1645/0*\D/B
1646
1647/a*\s/B
1648
1649/a*\S/B
1650
1651/ *\s/B
1652
1653/ *\S/B
1654
1655/a*\w/B
1656
1657/a*\W/B
1658
1659/=*\w/B
1660
1661/=*\W/B
1662
1663/\d*a/B
1664
1665/\d*2/B
1666
1667/\d*\d/B
1668
1669/\d*\D/B
1670
1671/\d*\s/B
1672
1673/\d*\S/B
1674
1675/\d*\w/B
1676
1677/\d*\W/B
1678
1679/\D*a/B
1680
1681/\D*2/B
1682
1683/\D*\d/B
1684
1685/\D*\D/B
1686
1687/\D*\s/B
1688
1689/\D*\S/B
1690
1691/\D*\w/B
1692
1693/\D*\W/B
1694
1695/\s*a/B
1696
1697/\s*2/B
1698
1699/\s*\d/B
1700
1701/\s*\D/B
1702
1703/\s*\s/B
1704
1705/\s*\S/B
1706
1707/\s*\w/B
1708
1709/\s*\W/B
1710
1711/\S*a/B
1712
1713/\S*2/B
1714
1715/\S*\d/B
1716
1717/\S*\D/B
1718
1719/\S*\s/B
1720
1721/\S*\S/B
1722
1723/\S*\w/B
1724
1725/\S*\W/B
1726
1727/\w*a/B
1728
1729/\w*2/B
1730
1731/\w*\d/B
1732
1733/\w*\D/B
1734
1735/\w*\s/B
1736
1737/\w*\S/B
1738
1739/\w*\w/B
1740
1741/\w*\W/B
1742
1743/\W*a/B
1744
1745/\W*2/B
1746
1747/\W*\d/B
1748
1749/\W*\D/B
1750
1751/\W*\s/B
1752
1753/\W*\S/B
1754
1755/\W*\w/B
1756
1757/\W*\W/B
1758
1759/[^a]+a/B
1760
1761/[^a]+a/Bi
1762
1763/[^a]+A/Bi
1764
1765/[^a]+b/B
1766
1767/[^a]+\d/B
1768
1769/a*[^a]/B
1770
1771/(?P<abc>x)(?P<xyz>y)/I
1772    xy\=copy=abc,copy=xyz
1773
1774/(?<abc>x)(?'xyz'y)/I
1775    xy\=copy=abc,copy=xyz
1776
1777/(?<abc'x)(?'xyz'y)/I
1778
1779/(?<abc>x)(?'xyz>y)/I
1780
1781/(?P'abc'x)(?P<xyz>y)/I
1782
1783/^(?:(?(ZZ)a|b)(?<ZZ>X))+/
1784    bXaX
1785    bXbX
1786\= Expect no match
1787    aXaX
1788    aXbX
1789
1790/^(?P>abc)(?<abcd>xxx)/
1791
1792/^(?P>abc)(?<abc>x|y)/
1793    xx
1794    xy
1795    yy
1796    yx
1797
1798/^(?P>abc)(?P<abc>x|y)/
1799    xx
1800    xy
1801    yy
1802    yx
1803
1804/^((?(abc)a|b)(?<abc>x|y))+/
1805    bxay
1806    bxby
1807\= Expect no match
1808    axby
1809
1810/^(((?P=abc)|X)(?<abc>x|y))+/
1811    XxXxxx
1812    XxXyyx
1813    XxXyxx
1814\= Expect no match
1815    x
1816
1817/^(?1)(abc)/
1818    abcabc
1819
1820/^(?:(?:\1|X)(a|b))+/
1821    Xaaa
1822    Xaba
1823
1824/^[\E\Qa\E-\Qz\E]+/B
1825
1826/^[a\Q]bc\E]/B
1827
1828/^[a-\Q\E]/B
1829
1830/^(?P>abc)[()](?<abc>)/B
1831
1832/^((?(abc)y)[()](?P<abc>x))+/B
1833    (xy)x
1834
1835/^(?P>abc)\Q()\E(?<abc>)/B
1836
1837/^(?P>abc)[a\Q(]\E(](?<abc>)/B
1838
1839/^(?P>abc) # this is (a comment)
1840  (?<abc>)/Bx
1841
1842/^\W*(?:(?<one>(?<two>.)\W*(?&one)\W*\k<two>|)|(?<three>(?<four>.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii
1843    1221
1844    Satan, oscillate my metallic sonatas!
1845    A man, a plan, a canal: Panama!
1846    Able was I ere I saw Elba.
1847\= Expect no match
1848    The quick brown fox
1849
1850/(?=(\w+))\1:/I
1851    abcd:
1852
1853/(?=(?'abc'\w+))\k<abc>:/I
1854    abcd:
1855
1856/(?'abc'a|b)(?<abc>d|e)\k<abc>{2}/dupnames
1857    adaa
1858\= Expect no match
1859    addd
1860    adbb
1861
1862/(?'abc'a|b)(?<abc>d|e)(?&abc){2}/dupnames
1863    bdaa
1864    bdab
1865\= Expect no match
1866    bddd
1867
1868/(?(<bc))/
1869
1870/(?(''))/
1871
1872/(?('R')stuff)/
1873
1874/((abc (?(R) (?(R1)1) (?(R2)2) X  |  (?1)  (?2)   (?R) ))) /x
1875    abcabc1Xabc2XabcXabcabc
1876
1877/(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
1878    abcabc1Xabc2XabcXabcabc
1879
1880/(?<A> (?'B' abc (?(R) (?(R&C)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
1881
1882/^(?(DEFINE) abc | xyz ) /x
1883
1884/(?(DEFINE) abc) xyz/Ix
1885
1886/(a|)*\d/
1887  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4\=ovector=0
1888\= Expect no match
1889  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=0
1890
1891/^a.b/newline=lf
1892    a\rb
1893\= Expect no match
1894    a\nb
1895
1896/^a.b/newline=cr
1897    a\nb
1898\= Expect no match
1899    a\rb
1900
1901/^a.b/newline=anycrlf
1902    a\x85b
1903\= Expect no match
1904    a\rb
1905
1906/^a.b/newline=any
1907\= Expect no match
1908    a\nb
1909    a\rb
1910    a\x85b
1911
1912/^abc./gmx,newline=any
1913    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
1914
1915/abc.$/gmx,newline=any
1916    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7 abc9
1917
1918/^a\Rb/bsr=unicode
1919    a\nb
1920    a\rb
1921    a\r\nb
1922    a\x0bb
1923    a\x0cb
1924    a\x85b
1925\= Expect no match
1926    a\n\rb
1927
1928/^a\R*b/bsr=unicode
1929    ab
1930    a\nb
1931    a\rb
1932    a\r\nb
1933    a\x0bb
1934    a\x0cb
1935    a\x85b
1936    a\n\rb
1937    a\n\r\x85\x0cb
1938
1939/^a\R+b/bsr=unicode
1940    a\nb
1941    a\rb
1942    a\r\nb
1943    a\x0bb
1944    a\x0cb
1945    a\x85b
1946    a\n\rb
1947    a\n\r\x85\x0cb
1948\= Expect no match
1949    ab
1950
1951/^a\R{1,3}b/bsr=unicode
1952    a\nb
1953    a\n\rb
1954    a\n\r\x85b
1955    a\r\n\r\nb
1956    a\r\n\r\n\r\nb
1957    a\n\r\n\rb
1958    a\n\n\r\nb
1959\= Expect no match
1960    a\n\n\n\rb
1961    a\r
1962
1963/(?&abc)X(?<abc>P)/I
1964    abcPXP123
1965
1966/(?1)X(?<abc>P)/I
1967    abcPXP123
1968
1969/(?:a(?&abc)b)*(?<abc>x)/
1970    123axbaxbaxbx456
1971    123axbaxbaxb456
1972
1973/(?:a(?&abc)b){1,5}(?<abc>x)/
1974    123axbaxbaxbx456
1975
1976/(?:a(?&abc)b){2,5}(?<abc>x)/
1977    123axbaxbaxbx456
1978
1979/(?:a(?&abc)b){2,}(?<abc>x)/
1980    123axbaxbaxbx456
1981
1982/(abc)(?i:(?1))/
1983    defabcabcxyz
1984\= Expect no match
1985    DEFabcABCXYZ
1986
1987/(abc)(?:(?i)(?1))/
1988    defabcabcxyz
1989\= Expect no match
1990    DEFabcABCXYZ
1991
1992/^(a)\g-2/
1993
1994/^(a)\g/
1995
1996/^(a)\g{0}/
1997
1998/^(a)\g{3/
1999
2000/^(a)\g{aa}/
2001
2002/^a.b/newline=lf
2003    a\rb
2004\= Expect no match
2005    a\nb
2006
2007/.+foo/
2008    afoo
2009\= Expect no match
2010    \r\nfoo
2011    \nfoo
2012
2013/.+foo/newline=crlf
2014    afoo
2015    \nfoo
2016\= Expect no match
2017    \r\nfoo
2018
2019/.+foo/newline=any
2020    afoo
2021\= Expect no match
2022    \nfoo
2023    \r\nfoo
2024
2025/.+foo/s
2026    afoo
2027    \r\nfoo
2028    \nfoo
2029
2030/^$/gm,newline=any
2031    abc\r\rxyz
2032    abc\n\rxyz
2033\= Expect no match
2034    abc\r\nxyz
2035
2036/(?m)^$/g,newline=any,aftertext
2037    abc\r\n\r\n
2038
2039/(?m)^$|^\r\n/g,newline=any,aftertext
2040    abc\r\n\r\n
2041
2042/(?m)$/g,newline=any,aftertext
2043    abc\r\n\r\n
2044
2045/abc.$/gmx,newline=anycrlf
2046    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
2047
2048/^X/m
2049    XABC
2050\= Expect no match
2051    XABC\=notbol
2052
2053/(ab|c)(?-1)/B
2054    abc
2055
2056/xy(?+1)(abc)/B
2057    xyabcabc
2058\= Expect no match
2059    xyabc
2060
2061/x(?-0)y/
2062
2063/x(?-1)y/
2064
2065/x(?+0)y/
2066
2067/x(?+1)y/
2068
2069/^(abc)?(?(-1)X|Y)/B
2070    abcX
2071    Y
2072\= Expect no match
2073    abcY
2074
2075/^((?(+1)X|Y)(abc))+/B
2076    YabcXabc
2077    YabcXabcXabc
2078\= Expect no match
2079    XabcXabc
2080
2081/(?(-1)a)/B
2082
2083/((?(-1)a))/B
2084
2085/((?(-2)a))/B
2086
2087/^(?(+1)X|Y)(.)/B
2088    Y!
2089
2090/(?<A>tom|bon)-\k{A}/
2091    tom-tom
2092    bon-bon
2093\= Expect no match
2094    tom-bon
2095
2096/\g{A/
2097
2098/(?|(abc)|(xyz))/B
2099   >abc<
2100   >xyz<
2101
2102/(x)(?|(abc)|(xyz))(x)/B
2103    xabcx
2104    xxyzx
2105
2106/(x)(?|(abc)(pqr)|(xyz))(x)/B
2107    xabcpqrx
2108    xxyzx
2109
2110/\H++X/B
2111\= Expect no match
2112    XXXX
2113
2114/\H+\hY/B
2115    XXXX Y
2116
2117/\H+ Y/B
2118
2119/\h+A/B
2120
2121/\v*B/B
2122
2123/\V+\x0a/B
2124
2125/A+\h/B
2126
2127/ *\H/B
2128
2129/A*\v/B
2130
2131/\x0b*\V/B
2132
2133/\d+\h/B
2134
2135/\d*\v/B
2136
2137/S+\h\S+\v/B
2138
2139/\w{3,}\h\w+\v/B
2140
2141/\h+\d\h+\w\h+\S\h+\H/B
2142
2143/\v+\d\v+\w\v+\S\v+\V/B
2144
2145/\H+\h\H+\d/B
2146
2147/\V+\v\V+\w/B
2148
2149/\( (?: [^()]* | (?R) )* \)/x
2150(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(00)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)\=jitstack=1024
2151
2152/[\E]AAA/
2153
2154/[\Q\E]AAA/
2155
2156/[^\E]AAA/
2157
2158/[^\Q\E]AAA/
2159
2160/[\E^]AAA/
2161
2162/[\Q\E^]AAA/
2163
2164/A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/B
2165
2166/^a+(*FAIL)/auto_callout
2167\= Expect no match
2168    aaaaaa
2169
2170/a+b?c+(*FAIL)/auto_callout
2171\= Expect no match
2172    aaabccc
2173
2174/a+b?(*PRUNE)c+(*FAIL)/auto_callout
2175\= Expect no match
2176    aaabccc
2177
2178/a+b?(*COMMIT)c+(*FAIL)/auto_callout
2179\= Expect no match
2180    aaabccc
2181
2182/a+b?(*SKIP)c+(*FAIL)/auto_callout
2183\= Expect no match
2184    aaabcccaaabccc
2185
2186/a+b?(*THEN)c+(*FAIL)/auto_callout
2187\= Expect no match
2188    aaabccc
2189
2190/a(*MARK)b/
2191
2192/(?i:A{1,}\6666666666)/
2193
2194/\g6666666666/
2195
2196/[\g6666666666]/B
2197
2198/(?1)\c[/
2199
2200/.+A/newline=crlf
2201\= Expect no match
2202    \r\nA
2203
2204/\nA/newline=crlf
2205    \r\nA
2206
2207/[\r\n]A/newline=crlf
2208    \r\nA
2209
2210/(\r|\n)A/newline=crlf
2211    \r\nA
2212
2213/a(*CR)b/
2214
2215/(*CR)a.b/
2216    a\nb
2217\= Expect no match
2218    a\rb
2219
2220/(*CR)a.b/newline=lf
2221    a\nb
2222\= Expect no match
2223    a\rb
2224
2225/(*LF)a.b/newline=CRLF
2226    a\rb
2227\= Expect no match
2228    a\nb
2229
2230/(*CRLF)a.b/
2231    a\rb
2232    a\nb
2233\= Expect no match
2234    a\r\nb
2235
2236/(*ANYCRLF)a.b/newline=CR
2237\= Expect no match
2238    a\rb
2239    a\nb
2240    a\r\nb
2241
2242/(*ANY)a.b/newline=cr
2243\= Expect no match
2244    a\rb
2245    a\nb
2246    a\r\nb
2247    a\x85b
2248
2249/(*ANY).*/g
2250    abc\r\ndef
2251
2252/(*ANYCRLF).*/g
2253    abc\r\ndef
2254
2255/(*CRLF).*/g
2256    abc\r\ndef
2257
2258/(*NUL)^.*/
2259    a\nb\x00ccc
2260
2261/(*NUL)^.*/s
2262    a\nb\x00ccc
2263
2264/^x/m,newline=NUL
2265    ab\x00xy
2266
2267/'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex
2268    x\nyz
2269
2270/(*NUL)^X\NY/
2271    X\nY
2272    X\rY
2273\= Expect no match
2274    X\x00Y
2275
2276/a\Rb/I,bsr=anycrlf
2277    a\rb
2278    a\nb
2279    a\r\nb
2280\= Expect no match
2281    a\x85b
2282    a\x0bb
2283
2284/a\Rb/I,bsr=unicode
2285    a\rb
2286    a\nb
2287    a\r\nb
2288    a\x85b
2289    a\x0bb
2290
2291/a\R?b/I,bsr=anycrlf
2292    a\rb
2293    a\nb
2294    a\r\nb
2295\= Expect no match
2296    a\x85b
2297    a\x0bb
2298
2299/a\R?b/I,bsr=unicode
2300    a\rb
2301    a\nb
2302    a\r\nb
2303    a\x85b
2304    a\x0bb
2305
2306/a\R{2,4}b/I,bsr=anycrlf
2307    a\r\n\nb
2308    a\n\r\rb
2309    a\r\n\r\n\r\n\r\nb
2310\= Expect no match
2311    a\x85\x85b
2312    a\x0b\x0bb
2313
2314/a\R{2,4}b/I,bsr=unicode
2315    a\r\rb
2316    a\n\n\nb
2317    a\r\n\n\r\rb
2318    a\x85\x85b
2319    a\x0b\x0bb
2320\= Expect no match
2321    a\r\r\r\r\rb
2322
2323/(*BSR_ANYCRLF)a\Rb/I
2324    a\nb
2325    a\rb
2326
2327/(*BSR_UNICODE)a\Rb/I
2328    a\x85b
2329
2330/(*BSR_ANYCRLF)(*CRLF)a\Rb/I
2331    a\nb
2332    a\rb
2333
2334/(*CRLF)(*BSR_UNICODE)a\Rb/I
2335    a\x85b
2336
2337/(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
2338
2339/(?<a>)(?&)/
2340
2341/(?<abc>)(?&a)/
2342
2343/(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
2344
2345/(?+-a)/
2346
2347/(?-+a)/
2348
2349/(?(-1))/
2350
2351/(?(+10))/
2352
2353/(?(10))/
2354
2355/(?(+2))()()/
2356
2357/(?(2))()()/
2358
2359/\k''/
2360
2361/\k<>/
2362
2363/\k{}/
2364
2365/\k/
2366
2367/\kabc/
2368
2369/(?P=)/
2370
2371/(?P>)/
2372
2373/[[:foo:]]/
2374
2375/[[:1234:]]/
2376
2377/[[:f\oo:]]/
2378
2379/[[: :]]/
2380
2381/[[:...:]]/
2382
2383/[[:l\ower:]]/
2384
2385/[[:abc\:]]/
2386
2387/[abc[:x\]pqr:]]/
2388
2389/[[:a\dz:]]/
2390
2391/(^(a|b\g<-1'c))/
2392
2393/^(?+1)(?<a>x|y){0}z/
2394    xzxx
2395    yzyy
2396\= Expect no match
2397    xxz
2398
2399/(\3)(\1)(a)/
2400\= Expect no match
2401    cat
2402
2403/(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
2404    cat
2405
2406/TA]/
2407    The ACTA] comes
2408
2409/TA]/allow_empty_class,match_unset_backref,dupnames
2410    The ACTA] comes
2411
2412/(?2)[]a()b](abc)/
2413    abcbabc
2414
2415/(?2)[^]a()b](abc)/
2416    abcbabc
2417
2418/(?1)[]a()b](abc)/
2419    abcbabc
2420\= Expect no match
2421    abcXabc
2422
2423/(?1)[^]a()b](abc)/
2424    abcXabc
2425\= Expect no match
2426    abcbabc
2427
2428/(?2)[]a()b](abc)(xyz)/
2429    xyzbabcxyz
2430
2431/(?&N)[]a(?<N>)](?<M>abc)/
2432   abc<abc
2433
2434/(?&N)[]a(?<N>)](abc)/
2435   abc<abc
2436
2437/a[]b/
2438
2439/a[^]b/
2440
2441/a[]b/allow_empty_class,match_unset_backref,dupnames
2442\= Expect no match
2443    ab
2444
2445/a[]+b/allow_empty_class,match_unset_backref,dupnames
2446\= Expect no match
2447    ab
2448
2449/a[]*+b/allow_empty_class,match_unset_backref,dupnames
2450\= Expect no match
2451    ab
2452
2453/a[^]b/allow_empty_class,match_unset_backref,dupnames
2454    aXb
2455    a\nb
2456\= Expect no match
2457    ab
2458
2459/a[^]+b/allow_empty_class,match_unset_backref,dupnames
2460    aXb
2461    a\nX\nXb
2462\= Expect no match
2463    ab
2464
2465/a(?!)b/B
2466
2467/(?!)?a/B
2468    ab
2469
2470/a(*FAIL)+b/
2471
2472/(abc|pqr|123){0}[xyz]/I
2473
2474/(?(?=.*b)b|^)/I,auto_callout
2475   adc
2476   abc
2477
2478/(?(?=b).*b|^d)/I
2479
2480/(?(?=.*b).*b|^d)/I
2481
2482/xyz/auto_callout
2483  xyz
2484  abcxyz
2485\= Expect no match
2486  abc
2487  abcxypqr
2488
2489/xyz/auto_callout,no_start_optimize
2490  abcxyz
2491\= Expect no match
2492  abc
2493  abcxypqr
2494
2495/(*NO_START_OPT)xyz/auto_callout
2496  abcxyz
2497
2498/(*NO_AUTO_POSSESS)a+b/B
2499
2500/xyz/auto_callout,no_start_optimize
2501  abcxyz
2502
2503/^"((?(?=[a])[^"])|b)*"$/auto_callout
2504    "ab"
2505
2506/^"((?(?=[a])[^"])|b)*"$/
2507    "ab"
2508
2509/^X(?5)(a)(?|(b)|(q))(c)(d)Y/
2510    XYabcdY
2511
2512/^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)/
2513    XYabcdY
2514
2515/Xa{2,4}b/
2516    X\=ps
2517    Xa\=ps
2518    Xaa\=ps
2519    Xaaa\=ps
2520    Xaaaa\=ps
2521
2522/Xa{2,4}?b/
2523    X\=ps
2524    Xa\=ps
2525    Xaa\=ps
2526    Xaaa\=ps
2527    Xaaaa\=ps
2528
2529/Xa{2,4}+b/
2530    X\=ps
2531    Xa\=ps
2532    Xaa\=ps
2533    Xaaa\=ps
2534    Xaaaa\=ps
2535
2536/X\d{2,4}b/
2537    X\=ps
2538    X3\=ps
2539    X33\=ps
2540    X333\=ps
2541    X3333\=ps
2542
2543/X\d{2,4}?b/
2544    X\=ps
2545    X3\=ps
2546    X33\=ps
2547    X333\=ps
2548    X3333\=ps
2549
2550/X\d{2,4}+b/
2551    X\=ps
2552    X3\=ps
2553    X33\=ps
2554    X333\=ps
2555    X3333\=ps
2556
2557/X\D{2,4}b/
2558    X\=ps
2559    Xa\=ps
2560    Xaa\=ps
2561    Xaaa\=ps
2562    Xaaaa\=ps
2563
2564/X\D{2,4}?b/
2565    X\=ps
2566    Xa\=ps
2567    Xaa\=ps
2568    Xaaa\=ps
2569    Xaaaa\=ps
2570
2571/X\D{2,4}+b/
2572    X\=ps
2573    Xa\=ps
2574    Xaa\=ps
2575    Xaaa\=ps
2576    Xaaaa\=ps
2577
2578/X[abc]{2,4}b/
2579    X\=ps
2580    Xa\=ps
2581    Xaa\=ps
2582    Xaaa\=ps
2583    Xaaaa\=ps
2584
2585/X[abc]{2,4}?b/
2586    X\=ps
2587    Xa\=ps
2588    Xaa\=ps
2589    Xaaa\=ps
2590    Xaaaa\=ps
2591
2592/X[abc]{2,4}+b/
2593    X\=ps
2594    Xa\=ps
2595    Xaa\=ps
2596    Xaaa\=ps
2597    Xaaaa\=ps
2598
2599/X[^a]{2,4}b/
2600    X\=ps
2601    Xz\=ps
2602    Xzz\=ps
2603    Xzzz\=ps
2604    Xzzzz\=ps
2605
2606/X[^a]{2,4}?b/
2607    X\=ps
2608    Xz\=ps
2609    Xzz\=ps
2610    Xzzz\=ps
2611    Xzzzz\=ps
2612
2613/X[^a]{2,4}+b/
2614    X\=ps
2615    Xz\=ps
2616    Xzz\=ps
2617    Xzzz\=ps
2618    Xzzzz\=ps
2619
2620/(Y)X\1{2,4}b/
2621    YX\=ps
2622    YXY\=ps
2623    YXYY\=ps
2624    YXYYY\=ps
2625    YXYYYY\=ps
2626
2627/(Y)X\1{2,4}?b/
2628    YX\=ps
2629    YXY\=ps
2630    YXYY\=ps
2631    YXYYY\=ps
2632    YXYYYY\=ps
2633
2634/(Y)X\1{2,4}+b/
2635    YX\=ps
2636    YXY\=ps
2637    YXYY\=ps
2638    YXYYY\=ps
2639    YXYYYY\=ps
2640
2641/\++\KZ|\d+X|9+Y/startchar
2642    ++++123999\=ps
2643    ++++123999Y\=ps
2644    ++++Z1234\=ps
2645
2646/Z(*F)/
2647\= Expect no match
2648    Z\=ps
2649    ZA\=ps
2650
2651/Z(?!)/
2652\= Expect no match
2653    Z\=ps
2654    ZA\=ps
2655
2656/dog(sbody)?/
2657    dogs\=ps
2658    dogs\=ph
2659
2660/dog(sbody)??/
2661    dogs\=ps
2662    dogs\=ph
2663
2664/dog|dogsbody/
2665    dogs\=ps
2666    dogs\=ph
2667
2668/dogsbody|dog/
2669    dogs\=ps
2670    dogs\=ph
2671
2672/\bthe cat\b/
2673    the cat\=ps
2674    the cat\=ph
2675
2676/abc/
2677   abc\=ps
2678   abc\=ph
2679
2680/abc\K123/startchar
2681    xyzabc123pqr
2682    xyzabc12\=ps
2683    xyzabc12\=ph
2684
2685/(?<=abc)123/
2686    xyzabc123pqr
2687    xyzabc12\=ps
2688    xyzabc12\=ph
2689
2690/\babc\b/
2691    +++abc+++
2692    +++ab\=ps
2693    +++ab\=ph
2694
2695/(?&word)(?&element)(?(DEFINE)(?<element><[^m][^>]>[^<])(?<word>\w*+))/B
2696
2697/(?&word)(?&element)(?(DEFINE)(?<element><[^\d][^>]>[^<])(?<word>\w*+))/B
2698
2699/(ab)(x(y)z(cd(*ACCEPT)))pq/B
2700
2701/abc\K/aftertext,startchar
2702    abcdef
2703    abcdef\=notempty_atstart
2704    xyzabcdef\=notempty_atstart
2705\= Expect no match
2706    abcdef\=notempty
2707    xyzabcdef\=notempty
2708
2709/^(?:(?=abc)|abc\K)/aftertext,startchar
2710    abcdef
2711    abcdef\=notempty_atstart
2712\= Expect no match
2713    abcdef\=notempty
2714
2715/a?b?/aftertext
2716    xyz
2717    xyzabc
2718    xyzabc\=notempty
2719    xyzabc\=notempty_atstart
2720    xyz\=notempty_atstart
2721\= Expect no match
2722    xyz\=notempty
2723
2724/^a?b?/aftertext
2725    xyz
2726    xyzabc
2727\= Expect no match
2728    xyzabc\=notempty
2729    xyzabc\=notempty_atstart
2730    xyz\=notempty_atstart
2731    xyz\=notempty
2732
2733/^(?<name>a|b\g<name>c)/
2734    aaaa
2735    bacxxx
2736    bbaccxxx
2737    bbbacccxx
2738
2739/^(?<name>a|b\g'name'c)/
2740    aaaa
2741    bacxxx
2742    bbaccxxx
2743    bbbacccxx
2744
2745/^(a|b\g<1>c)/
2746    aaaa
2747    bacxxx
2748    bbaccxxx
2749    bbbacccxx
2750
2751/^(a|b\g'1'c)/
2752    aaaa
2753    bacxxx
2754    bbaccxxx
2755    bbbacccxx
2756
2757/^(a|b\g'-1'c)/
2758    aaaa
2759    bacxxx
2760    bbaccxxx
2761    bbbacccxx
2762
2763/(^(a|b\g<-1>c))/
2764    aaaa
2765    bacxxx
2766    bbaccxxx
2767    bbbacccxx
2768
2769/(?-i:\g<name>)(?i:(?<name>a))/
2770    XaaX
2771    XAAX
2772
2773/(?i:\g<name>)(?-i:(?<name>a))/
2774    XaaX
2775\= Expect no match
2776    XAAX
2777
2778/(?-i:\g<+1>)(?i:(a))/
2779    XaaX
2780    XAAX
2781
2782/(?=(?<regex>(?#simplesyntax)\$(?<name>[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)(?:\[(?<index>[a-zA-Z0-9_\x{7f}-\x{ff}]+|\$\g<name>)\]|->\g<name>(\(.*?\))?)?|(?#simple syntax withbraces)\$\{(?:\g<name>(?<indices>\[(?:\g<index>|'(?:\\.|[^'\\])*'|"(?:\g<regex>|\\.|[^"\\])*")\])?|\g<complex>|\$\{\g<complex>\})\}|(?#complexsyntax)\{(?<complex>\$(?<segment>\g<name>(\g<indices>*|\(.*?\))?)(?:->\g<segment>)*|\$\g<complex>|\$\{\g<complex>\})\}))\{/
2783
2784/(?<n>a|b|c)\g<n>*/
2785   abc
2786   accccbbb
2787
2788/^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)/
2789    XYabcdY
2790
2791/(?<=b(?1)|zzz)(a)/
2792    xbaax
2793    xzzzax
2794
2795/(a)(?<=b\1)/
2796
2797/(a)(?<=b+(?1))/
2798
2799/(a+)(?<=b(?1))/
2800
2801/(a(?<=b(?1)))/
2802
2803/(?<=b(?1))xyz/
2804
2805/(?<=b(?1))xyz(b+)pqrstuvew/
2806
2807/(a|bc)\1/I
2808
2809/(a|bc)\1{2,3}/I
2810
2811/(a|bc)(?1)/I
2812
2813/(a|b\1)(a|b\1)/I
2814
2815/(a|b\1){2}/I
2816
2817/(a|bbbb\1)(a|bbbb\1)/I
2818
2819/(a|bbbb\1){2}/I
2820
2821/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/I
2822
2823/<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/Iis
2824
2825"(?>.*/)foo"I
2826
2827/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /Ix
2828
2829/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/Ii
2830
2831/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/I
2832
2833/<a[\s]+href[\s]*=[\s]*          # find <a href=
2834 ([\"\'])?                       # find single or double quote
2835 (?(1) (.*?)\1 | ([^\s]+))       # if quote found, match up to next matching
2836                                 # quote, otherwise match up to next space
2837/Iisx
2838
2839/^(?!:)                       # colon disallowed at start
2840  (?:                         # start of item
2841    (?: [0-9a-f]{1,4} |       # 1-4 hex digits or
2842    (?(1)0 | () ) )           # if null previously matched, fail; else null
2843    :                         # followed by colon
2844  ){1,7}                      # end item; 1-7 of them required
2845  [0-9a-f]{1,4} $             # final hex number at end of string
2846  (?(1)|.)                    # check that there was an empty component
2847  /Iix
2848
2849/(?|(?<a>A)|(?<a>B))/I
2850    AB\=copy=a
2851    BA\=copy=a
2852
2853/(?|(?<a>A)|(?<b>B))/
2854
2855/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |
2856    b(?<quote> (?<apostrophe>')|(?<realquote>")) )
2857    (?('quote')[a-z]+|[0-9]+)/Ix,dupnames
2858    a"aaaaa
2859    b"aaaaa
2860\= Expect no match
2861    b"11111
2862    a"11111
2863
2864/^(?|(a)(b)(c)(?<D>d)|(?<D>e)) (?('D')X|Y)/IBx,dupnames
2865    abcdX
2866    eX
2867\= Expect no match
2868    abcdY
2869    ey
2870
2871/(?<A>a) (b)(c)  (?<A>d  (?(R&A)$ | (?4)) )/IBx,dupnames
2872    abcdd
2873\= Expect no match
2874    abcdde
2875
2876/abcd*/
2877    xxxxabcd\=ps
2878    xxxxabcd\=ph
2879
2880/abcd*/i
2881    xxxxabcd\=ps
2882    xxxxabcd\=ph
2883    XXXXABCD\=ps
2884    XXXXABCD\=ph
2885
2886/abc\d*/
2887    xxxxabc1\=ps
2888    xxxxabc1\=ph
2889
2890/(a)bc\1*/
2891    xxxxabca\=ps
2892    xxxxabca\=ph
2893
2894/abc[de]*/
2895    xxxxabcde\=ps
2896    xxxxabcde\=ph
2897
2898/(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
2899    cat
2900
2901/(\3)(\1)(a)/I,allow_empty_class,match_unset_backref,dupnames
2902    cat
2903
2904/(\3)(\1)(a)/I
2905\= Expect no match
2906    cat
2907
2908/i(?(DEFINE)(?<s>a))/I
2909    i
2910
2911/()i(?(1)a)/I
2912    ia
2913
2914/(?i)a(?-i)b|c/B
2915    XabX
2916    XAbX
2917    CcC
2918\= Expect no match
2919    XABX
2920
2921/(?i)a(?s)b|c/B
2922
2923/(?i)a(?s-i)b|c/B
2924
2925/^(ab(c\1)d|x){2}$/B
2926    xabcxd
2927
2928/^(?&t)*+(?(DEFINE)(?<t>.))$/B
2929
2930/^(?&t)*(?(DEFINE)(?<t>.))$/B
2931
2932# This one is here because Perl gives the match as "b" rather than "ab". I
2933# believe this to be a Perl bug.
2934
2935/(?>a\Kb)z|(ab)/
2936    ab\=startchar
2937
2938/(?P<L1>(?P<L2>0|)|(?P>L2)(?P>L1))/
2939    abcd
2940    0abc
2941
2942/abc(*MARK:)pqr/
2943
2944/abc(*:)pqr/
2945
2946/(*COMMIT:X)/B
2947
2948# This should, and does, fail. In Perl, it does not, which I think is a
2949# bug because replacing the B in the pattern by (B|D) does make it fail.
2950# Turning off Perl's optimization by inserting (??{""}) also makes it fail.
2951
2952/A(*COMMIT)B/aftertext,mark
2953\= Expect no match
2954    ACABX
2955
2956# These should be different, but in Perl they are not, which I think
2957# is a bug in Perl.
2958
2959/A(*THEN)B|A(*THEN)C/mark
2960    AC
2961
2962/A(*PRUNE)B|A(*PRUNE)C/mark
2963\= Expect no match
2964    AC
2965
2966# Mark names can be duplicated. Perl doesn't give a mark for this one,
2967# though PCRE2 does.
2968
2969/^A(*:A)B|^X(*:A)Y/mark
2970\= Expect no match
2971    XAQQ
2972
2973# COMMIT at the start of a pattern should be the same as an anchor. Perl
2974# optimizations defeat this. So does the PCRE2 optimization unless we disable
2975# it.
2976
2977/(*COMMIT)ABC/
2978    ABCDEFG
2979
2980/(*COMMIT)ABC/no_start_optimize
2981\= Expect no match
2982    DEFGABC
2983
2984/^(ab (c+(*THEN)cd) | xyz)/x
2985\= Expect no match
2986    abcccd
2987
2988/^(ab (c+(*PRUNE)cd) | xyz)/x
2989\= Expect no match
2990    abcccd
2991
2992/^(ab (c+(*FAIL)cd) | xyz)/x
2993\= Expect no match
2994    abcccd
2995
2996# Perl gets some of these wrong
2997
2998/(?>.(*ACCEPT))*?5/
2999    abcde
3000
3001/(.(*ACCEPT))*?5/
3002    abcde
3003
3004/(.(*ACCEPT))5/
3005    abcde
3006
3007/(.(*ACCEPT))*5/
3008    abcde
3009
3010/A\NB./B
3011    ACBD
3012\= Expect no match
3013    A\nB
3014    ACB\n
3015
3016/A\NB./Bs
3017    ACBD
3018    ACB\n
3019\= Expect no match
3020    A\nB
3021
3022/A\NB/newline=crlf
3023    A\nB
3024    A\rB
3025\= Expect no match
3026    A\r\nB
3027
3028/\R+b/B
3029
3030/\R+\n/B
3031
3032/\R+\d/B
3033
3034/\d*\R/B
3035
3036/\s*\R/B
3037    \x20\x0a
3038    \x20\x0d
3039    \x20\x0d\x0a
3040
3041/\S*\R/B
3042    a\x0a
3043
3044/X\h*\R/B
3045    X\x20\x0a
3046
3047/X\H*\R/B
3048    X\x0d\x0a
3049
3050/X\H+\R/B
3051    X\x0d\x0a
3052
3053/X\H++\R/B
3054\= Expect no match
3055    X\x0d\x0a
3056
3057/(?<=abc)def/
3058    abc\=ph
3059
3060/abc$/
3061    abc
3062    abc\=ps
3063    abc\=ph
3064
3065/abc$/m
3066    abc
3067    abc\n
3068    abc\=ph
3069    abc\n\=ph
3070    abc\=ps
3071    abc\n\=ps
3072
3073/abc\z/
3074    abc
3075    abc\=ps
3076    abc\=ph
3077
3078/abc\Z/
3079    abc
3080    abc\=ps
3081    abc\=ph
3082
3083/abc\b/
3084    abc
3085    abc\=ps
3086    abc\=ph
3087
3088/abc\B/
3089    abc\=ps
3090    abc\=ph
3091\= Expect no match
3092    abc
3093
3094/.+/
3095\= Bad offsets
3096    abc\=offset=4
3097    abc\=offset=-4
3098\= Valid data
3099    abc\=offset=0
3100    abc\=offset=1
3101    abc\=offset=2
3102\= Expect no match
3103    abc\=offset=3
3104
3105/^\cģ/
3106
3107/(?P<abn>(?P=abn)xxx)/B
3108
3109/(a\1z)/B
3110
3111/(?P<abn>(?P=abn)(?<badstufxxx)/B
3112
3113/(?P<abn>(?P=axn)xxx)/B
3114
3115/(?P<abn>(?P=axn)xxx)(?<axn>yy)/B
3116
3117# These tests are here because Perl gets the first one wrong.
3118
3119/(\R*)(.)/s
3120    \r\n
3121    \r\r\n\n\r
3122    \r\r\n\n\r\n
3123
3124/(\R)*(.)/s
3125    \r\n
3126    \r\r\n\n\r
3127    \r\r\n\n\r\n
3128
3129/((?>\r\n|\n|\x0b|\f|\r|\x85)*)(.)/s
3130    \r\n
3131    \r\r\n\n\r
3132    \r\r\n\n\r\n
3133
3134# -------------
3135
3136/^abc$/B
3137
3138/^abc$/Bm
3139
3140/^(a)*+(\w)/
3141    aaaaX
3142\= Expect no match
3143    aaaa
3144
3145/^(?:a)*+(\w)/
3146    aaaaX
3147\= Expect no match
3148    aaaa
3149
3150/(a)++1234/IB
3151
3152/([abc])++1234/I
3153
3154/(?<=(abc)+)X/
3155
3156/(^ab)/I
3157
3158/(^ab)++/I
3159
3160/(^ab|^)+/I
3161
3162/(^ab|^)++/I
3163
3164/(?:^ab)/I
3165
3166/(?:^ab)++/I
3167
3168/(?:^ab|^)+/I
3169
3170/(?:^ab|^)++/I
3171
3172/(.*ab)/I
3173
3174/(.*ab)++/I
3175
3176/(.*ab|.*)+/I
3177
3178/(.*ab|.*)++/I
3179
3180/(?:.*ab)/I
3181
3182/(?:.*ab)++/I
3183
3184/(?:.*ab|.*)+/I
3185
3186/(?:.*ab|.*)++/I
3187
3188/(?=a)[bcd]/I
3189
3190/((?=a))[bcd]/I
3191
3192/((?=a))+[bcd]/I
3193
3194/((?=a))++[bcd]/I
3195
3196/(?=a+)[bcd]/Ii
3197
3198/(?=a+?)[bcd]/Ii
3199
3200/(?=a++)[bcd]/Ii
3201
3202/(?=a{3})[bcd]/Ii
3203
3204/(abc)\1+/
3205
3206# Perl doesn't get these right IMO (the 3rd is PCRE2-specific)
3207
3208/(?1)(?:(b(*ACCEPT))){0}/
3209    b
3210
3211/(?1)(?:(b(*ACCEPT))){0}c/
3212    bc
3213\= Expect no match
3214    b
3215
3216/(?1)(?:((*ACCEPT))){0}c/
3217    c
3218    c\=notempty
3219
3220/^.*?(?(?=a)a|b(*THEN)c)/
3221\= Expect no match
3222    ba
3223
3224/^.*?(?(?=a)a|bc)/
3225    ba
3226
3227/^.*?(?(?=a)a(*THEN)b|c)/
3228\= Expect no match
3229    ac
3230
3231/^.*?(?(?=a)a(*THEN)b)c/
3232\= Expect no match
3233    ac
3234
3235/^.*?(a(*THEN)b)c/
3236\= Expect no match
3237    aabc
3238
3239/^.*? (?1) c (?(DEFINE)(a(*THEN)b))/x
3240    aabc
3241
3242/^.*?(a(*THEN)b|z)c/
3243    aabc
3244
3245/^.*?(z|a(*THEN)b)c/
3246    aabc
3247
3248# These are here because they are not Perl-compatible; the studying means the
3249# mark is not seen.
3250
3251/(*MARK:A)(*SKIP:B)(C|X)/mark
3252    C
3253\= Expect no match
3254    D
3255
3256/(*:A)A+(*SKIP:A)(B|Z)/mark
3257\= Expect no match
3258    AAAC
3259
3260# ----------------------------
3261
3262"(?=a*(*ACCEPT)b)c"
3263    c
3264    c\=notempty
3265
3266/(?1)c(?(DEFINE)((*ACCEPT)b))/
3267    c
3268    c\=notempty
3269
3270/(?>(*ACCEPT)b)c/
3271    c
3272\= Expect no match
3273    c\=notempty
3274
3275/(?:(?>(a)))+a%/allaftertext
3276    %aa%
3277
3278/(a)b|ac/allaftertext
3279    ac\=ovector=1
3280
3281/(a)(b)x|abc/allaftertext
3282     abc\=ovector=2
3283
3284/(a)bc|(a)(b)\2/
3285    abc\=ovector=1
3286    abc\=ovector=2
3287    aba\=ovector=1
3288    aba\=ovector=2
3289    aba\=ovector=3
3290    aba\=ovector=4
3291
3292/(?(DEFINE)(a(?2)|b)(b(?1)|a))(?:(?1)|(?2))/I
3293
3294/(a(?2)|b)(b(?1)|a)(?:(?1)|(?2))/I
3295
3296/(a(?2)|b)(b(?1)|a)(?1)(?2)/I
3297
3298/(abc)(?1)/I
3299
3300/(?:(foo)|(bar)|(baz))X/allcaptures
3301    bazfooX
3302    foobazbarX
3303    barfooX
3304    bazX
3305    foobarbazX
3306    bazfooX\=ovector=0
3307    bazfooX\=ovector=1
3308    bazfooX\=ovector=2
3309    bazfooX\=ovector=3
3310
3311/(?=abc){3}abc/B
3312
3313/(?=abc)+abc/B
3314
3315/(?=abc)++abc/B
3316
3317/(?=abc){0}xyz/B
3318
3319/(?=(a))?./B
3320
3321/(?=(a))??./B
3322
3323/^(?=(a)){0}b(?1)/B
3324
3325/(?(DEFINE)(a))?b(?1)/B
3326
3327/^(?=(?1))?[az]([abc])d/B
3328
3329/^(?!a){0}\w+/B
3330
3331/(?<=(abc))?xyz/B
3332
3333/[:a[:abc]b:]/B
3334
3335/^(a(*:A)(d|e(*:B))z|aeq)/auto_callout
3336    adz
3337    aez
3338    aeqwerty
3339
3340/.(*F)/
3341\= Expect no match
3342    abc\=ph
3343
3344/\btype\b\W*?\btext\b\W*?\bjavascript\b/I
3345
3346/\btype\b\W*?\btext\b\W*?\bjavascript\b|\burl\b\W*?\bshell:|<input\b.*?\btype\b\W*?\bimage\b|\bonkeyup\b\W*?\=/I
3347
3348/a(*SKIP)c|b(*ACCEPT)|/I,aftertext
3349    a
3350
3351/a(*SKIP)c|b(*ACCEPT)cd(*ACCEPT)|x/I
3352    ax
3353
3354'a*(*ACCEPT)b'aftertext
3355    abc\=notempty_atstart
3356    bbb\=notempty_atstart
3357\= Expect no match
3358    \=notempty_atstart
3359
3360/(*ACCEPT)a/I,aftertext
3361    bax
3362
3363/z(*ACCEPT)a/I,aftertext
3364    baxzbx
3365
3366/^(?>a+)(?>(z+))\w/B
3367    aaaazzzzb
3368\= Expect no match
3369    aazz
3370
3371/(.)(\1|a(?2))/
3372    bab
3373
3374/\1|(.)(?R)\1/
3375    cbbbc
3376
3377/(.)((?(1)c|a)|a(?2))/
3378\= Expect no match
3379    baa
3380
3381/(?P<abn>(?P=abn)xxx)/B
3382
3383/(a\1z)/B
3384
3385/^a\x41z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3386    aAz
3387\= Expect no match
3388    ax41z
3389
3390/^a[m\x41]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3391    aAz
3392
3393/^a\x1z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3394    ax1z
3395
3396/^a\u0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3397    aAz
3398\= Expect no match
3399    au0041z
3400
3401/^a[m\u0041]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3402    aAz
3403
3404/^a\u041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3405    au041z
3406\= Expect no match
3407    aAz
3408
3409/^a\U0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3410    aU0041z
3411\= Expect no match
3412    aAz
3413
3414/^\u{7a}/alt_bsux
3415    u{7a}
3416\= Expect no match
3417    zoo
3418
3419/^\u{7a}/extra_alt_bsux
3420    zoo
3421
3422/(?(?=c)c|d)++Y/B
3423
3424/(?(?=c)c|d)*+Y/B
3425
3426/a[\NB]c/
3427    aNc
3428
3429/a[B-\Nc]/
3430
3431/a[B\Nc]/
3432
3433/(a)(?2){0,1999}?(b)/
3434
3435/(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/
3436
3437# This test, with something more complicated than individual letters, causes
3438# different behaviour in Perl. Perhaps it disables some optimization; no tag is
3439# passed back for the failures, whereas in PCRE2 there is a tag.
3440
3441/(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/x,mark
3442    AABC
3443    XXYZ
3444\= Expect no match
3445    XAQQ
3446    XAQQXZZ
3447    AXQQQ
3448    AXXQQQ
3449
3450# Perl doesn't give marks for these, though it does if the alternatives are
3451# replaced by single letters.
3452
3453/(b|q)(*:m)f|a(*:n)w/mark
3454    aw
3455\= Expect no match
3456    abc
3457
3458/(q|b)(*:m)f|a(*:n)w/mark
3459    aw
3460\= Expect no match
3461    abc
3462
3463# After a partial match, the behaviour is as for a failure.
3464
3465/^a(*:X)bcde/mark
3466   abc\=ps
3467
3468# These are here because Perl doesn't return a mark, except for the first.
3469
3470/(?=(*:x))(q|)/aftertext,mark
3471    abc
3472
3473/(?=(*:x))((*:y)q|)/aftertext,mark
3474    abc
3475
3476/(?=(*:x))(?:(*:y)q|)/aftertext,mark
3477    abc
3478
3479/(?=(*:x))(?>(*:y)q|)/aftertext,mark
3480    abc
3481
3482/(?=a(*:x))(?!a(*:y)c)/aftertext,mark
3483    ab
3484
3485/(?=a(*:x))(?=a(*:y)c|)/aftertext,mark
3486    ab
3487
3488/(..)\1/
3489    ab\=ps
3490    aba\=ps
3491    abab\=ps
3492
3493/(..)\1/i
3494    ab\=ps
3495    abA\=ps
3496    aBAb\=ps
3497
3498/(..)\1{2,}/
3499    ab\=ps
3500    aba\=ps
3501    abab\=ps
3502    ababa\=ps
3503    ababab\=ps
3504    ababab\=ph
3505    abababa\=ps
3506    abababa\=ph
3507
3508/(..)\1{2,}/i
3509    ab\=ps
3510    aBa\=ps
3511    aBAb\=ps
3512    AbaBA\=ps
3513    abABAb\=ps
3514    aBAbaB\=ph
3515    abABabA\=ps
3516    abaBABa\=ph
3517
3518/(..)\1{2,}?x/i
3519    ab\=ps
3520    abA\=ps
3521    aBAb\=ps
3522    abaBA\=ps
3523    abAbaB\=ps
3524    abaBabA\=ps
3525    abAbABaBx\=ps
3526
3527/^(..)\1/
3528    aba\=ps
3529
3530/^(..)\1{2,3}x/
3531    aba\=ps
3532    ababa\=ps
3533    ababa\=ph
3534    abababx
3535    ababababx
3536
3537/^(..)\1{2,3}?x/
3538    aba\=ps
3539    ababa\=ps
3540    ababa\=ph
3541    abababx
3542    ababababx
3543
3544/^(..)(\1{2,3})ab/
3545    abababab
3546
3547/^\R/
3548    \r\=ps
3549    \r\=ph
3550
3551/^\R{2,3}x/
3552    \r\=ps
3553    \r\=ph
3554    \r\r\=ps
3555    \r\r\=ph
3556    \r\r\r\=ps
3557    \r\r\r\=ph
3558    \r\rx
3559    \r\r\rx
3560
3561/^\R{2,3}?x/
3562    \r\=ps
3563    \r\=ph
3564    \r\r\=ps
3565    \r\r\=ph
3566    \r\r\r\=ps
3567    \r\r\r\=ph
3568    \r\rx
3569    \r\r\rx
3570
3571/^\R?x/
3572    \r\=ps
3573    \r\=ph
3574    x
3575    \rx
3576
3577/^\R+x/
3578    \r\=ps
3579    \r\=ph
3580    \r\n\=ps
3581    \r\n\=ph
3582    \rx
3583
3584/^a$/newline=crlf
3585    a\r\=ps
3586    a\r\=ph
3587
3588/^a$/m,newline=crlf
3589    a\r\=ps
3590    a\r\=ph
3591
3592/^(a$|a\r)/newline=crlf
3593    a\r\=ps
3594    a\r\=ph
3595
3596/^(a$|a\r)/m,newline=crlf
3597    a\r\=ps
3598    a\r\=ph
3599
3600/./newline=crlf
3601    \r\=ps
3602    \r\=ph
3603
3604/.{2,3}/newline=crlf
3605    \r\=ps
3606    \r\=ph
3607    \r\r\=ps
3608    \r\r\=ph
3609    \r\r\r\=ps
3610    \r\r\r\=ph
3611
3612/.{2,3}?/newline=crlf
3613    \r\=ps
3614    \r\=ph
3615    \r\r\=ps
3616    \r\r\=ph
3617    \r\r\r\=ps
3618    \r\r\r\=ph
3619
3620"AB(C(D))(E(F))?(?(?=\2)(?=\4))"
3621    ABCDGHI\=ovector=01
3622
3623# These are all run as real matches in test 1; here we are just checking the
3624# settings of the anchored and startline bits.
3625
3626/(?>.*?a)(?<=ba)/I
3627
3628/(?:.*?a)(?<=ba)/I
3629
3630/.*?a(*PRUNE)b/I
3631
3632/.*?a(*PRUNE)b/Is
3633
3634/^a(*PRUNE)b/Is
3635
3636/.*?a(*SKIP)b/I
3637
3638/(?>.*?a)b/Is
3639
3640/(?>.*?a)b/I
3641
3642/(?>^a)b/Is
3643
3644/(?>.*?)(?<=(abcd)|(wxyz))/I
3645
3646/(?>.*)(?<=(abcd)|(wxyz))/I
3647
3648"(?>.*)foo"I
3649
3650"(?>.*?)foo"I
3651
3652/(?>^abc)/Im
3653
3654/(?>.*abc)/Im
3655
3656/(?:.*abc)/Im
3657
3658/(?:(a)+(?C1)bb|aa(?C2)b)/
3659    aab\=callout_capture
3660
3661/(?:(a)++(?C1)bb|aa(?C2)b)/
3662    aab\=callout_capture
3663
3664/(?:(?>(a))(?C1)bb|aa(?C2)b)/
3665    aab\=callout_capture
3666
3667/(?:(?1)(?C1)x|ab(?C2))((a)){0}/
3668    aab\=callout_capture
3669
3670/(?1)(?C1)((a)(?C2)){0}/
3671    aab\=callout_capture
3672
3673/(?:(a)+(?C1)bb|aa(?C2)b)++/
3674    aab\=callout_capture
3675    aab\=callout_capture,ovector=1
3676
3677/(ab)x|ab/
3678    ab\=ovector=0
3679    ab\=ovector=1
3680
3681/(?<=123)(*MARK:xx)abc/mark
3682    xxxx123a\=ph
3683    xxxx123a\=ps
3684
3685/123\Kabc/startchar
3686    xxxx123a\=ph
3687    xxxx123a\=ps
3688
3689/^(?(?=a)aa|bb)/auto_callout
3690    bb
3691
3692/(?C1)^(?C2)(?(?C99)(?=(?C3)a(?C4))(?C5)a(?C6)a(?C7)|(?C8)b(?C9)b(?C10))(?C11)/
3693    bb
3694
3695# Perl seems to have a bug with this one.
3696
3697/aaaaa(*COMMIT)(*PRUNE)b|a+c/
3698    aaaaaac
3699
3700# Here are some that Perl treats differently because of the way it handles
3701# backtracking verbs.
3702
3703/(?!a(*COMMIT)b)ac|ad/
3704     ac
3705     ad
3706
3707/^(?!a(*THEN)b|ac)../
3708     ad
3709\= Expect no match
3710     ac
3711
3712/^(?=a(*THEN)b|ac)/
3713    ac
3714
3715/\A.*?(?:a|b(*THEN)c)/
3716    ba
3717
3718/\A.*?(?:a|b(*THEN)c)++/
3719    ba
3720
3721/\A.*?(?:a|b(*THEN)c|d)/
3722    ba
3723
3724/(?:(a(*MARK:X)a+(*SKIP:X)b)){0}(?:(?1)|aac)/
3725    aac
3726
3727/\A.*?(a|b(*THEN)c)/
3728    ba
3729
3730/^(A(*THEN)B|A(*THEN)D)/
3731    AD
3732
3733/(?!b(*THEN)a)bn|bnn/
3734    bnn
3735
3736/(?(?=b(*SKIP)a)bn|bnn)/
3737    bnn
3738
3739/(?=b(*THEN)a|)bn|bnn/
3740    bnn
3741
3742# This test causes a segfault with Perl 5.18.0
3743
3744/^(?=(a)){0}b(?1)/
3745    backgammon
3746
3747/(?|(?<n>f)|(?<n>b))/I,dupnames
3748
3749/(?<a>abc)(?<a>z)\k<a>()/IB,dupnames
3750
3751/a*[bcd]/B
3752
3753/[bcd]*a/B
3754
3755# A complete set of tests for auto-possessification of character types, but
3756# omitting \C because it might be disabled (it has its own tests).
3757
3758/\D+\D \D+\d \D+\S \D+\s \D+\W \D+\w \D+. \D+\R \D+\H \D+\h \D+\V \D+\v \D+\Z \D+\z \D+$/Bx
3759
3760/\d+\D \d+\d \d+\S \d+\s \d+\W \d+\w \d+. \d+\R \d+\H \d+\h \d+\V \d+\v \d+\Z \d+\z \d+$/Bx
3761
3762/\S+\D \S+\d \S+\S \S+\s \S+\W \S+\w \S+. \S+\R \S+\H \S+\h \S+\V \S+\v \S+\Z \S+\z \S+$/Bx
3763
3764/\s+\D \s+\d \s+\S \s+\s \s+\W \s+\w \s+. \s+\R \s+\H \s+\h \s+\V \s+\v \s+\Z \s+\z \s+$/Bx
3765
3766/\W+\D \W+\d \W+\S \W+\s \W+\W \W+\w \W+. \W+\R \W+\H \W+\h \W+\V \W+\v \W+\Z \W+\z \W+$/Bx
3767
3768/\w+\D \w+\d \w+\S \w+\s \w+\W \w+\w \w+. \w+\R \w+\H \w+\h \w+\V \w+\v \w+\Z \w+\z \w+$/Bx
3769
3770/\R+\D \R+\d \R+\S \R+\s \R+\W \R+\w \R+. \R+\R \R+\H \R+\h \R+\V \R+\v \R+\Z \R+\z \R+$/Bx
3771
3772/\H+\D \H+\d \H+\S \H+\s \H+\W \H+\w \H+. \H+\R \H+\H \H+\h \H+\V \H+\v \H+\Z \H+\z \H+$/Bx
3773
3774/\h+\D \h+\d \h+\S \h+\s \h+\W \h+\w \h+. \h+\R \h+\H \h+\h \h+\V \h+\v \h+\Z \h+\z \h+$/Bx
3775
3776/\V+\D \V+\d \V+\S \V+\s \V+\W \V+\w \V+. \V+\R \V+\H \V+\h \V+\V \V+\v \V+\Z \V+\z \V+$/Bx
3777
3778/\v+\D \v+\d \v+\S \v+\s \v+\W \v+\w \v+. \v+\R \v+\H \v+\h \v+\V \v+\v \v+\Z \v+\z \v+$/Bx
3779
3780/ a+\D  a+\d  a+\S  a+\s  a+\W  a+\w  a+.  a+\R  a+\H  a+\h  a+\V  a+\v  a+\Z  a+\z  a+$/Bx
3781
3782/\n+\D \n+\d \n+\S \n+\s \n+\W \n+\w \n+. \n+\R \n+\H \n+\h \n+\V \n+\v \n+\Z \n+\z \n+$/Bx
3783
3784/ .+\D  .+\d  .+\S  .+\s  .+\W  .+\w  .+.  .+\R  .+\H  .+\h  .+\V  .+\v  .+\Z  .+\z  .+$/Bx
3785
3786/ .+\D  .+\d  .+\S  .+\s  .+\W  .+\w  .+.  .+\R  .+\H  .+\h  .+\V  .+\v  .+\Z  .+\z  .+$/Bsx
3787
3788/ \D+$  \d+$  \S+$  \s+$  \W+$  \w+$  \R+$  \H+$  \h+$  \V+$ \v+$  a+$   \n+$  .+$  .+$/Bmx
3789
3790/(?=a+)a(a+)++a/B
3791
3792/a+(bb|cc)a+(?:bb|cc)a+(?>bb|cc)a+(?:bb|cc)+a+(aa)a+(?:bb|aa)/B
3793
3794/a+(bb|cc)?#a+(?:bb|cc)??#a+(?:bb|cc)?+#a+(?:bb|cc)*#a+(bb|cc)?a#a+(?:aa)?/B
3795
3796/a+(?:bb)?a#a+(?:|||)#a+(?:|b)a#a+(?:|||)?a/B
3797
3798/[ab]*/B
3799    aaaa
3800
3801/[ab]*?/B
3802    aaaa
3803
3804/[ab]?/B
3805    aaaa
3806
3807/[ab]??/B
3808    aaaa
3809
3810/[ab]+/B
3811    aaaa
3812
3813/[ab]+?/B
3814    aaaa
3815
3816/[ab]{2,3}/B
3817    aaaa
3818
3819/[ab]{2,3}?/B
3820    aaaa
3821
3822/[ab]{2,}/B
3823    aaaa
3824
3825/[ab]{2,}?/B
3826    aaaa
3827
3828/\d+\s{0,5}=\s*\S?=\w{0,4}\W*/B
3829
3830/[a-d]{5,12}[e-z0-9]*#[^a-z]+[b-y]*a[2-7]?[^0-9a-z]+/B
3831
3832/[a-z]*\s#[ \t]?\S#[a-c]*\S#[C-G]+?\d#[4-8]*\D#[4-9,]*\D#[!$]{0,5}\w#[M-Xf-l]+\W#[a-c,]?\W/B
3833
3834/a+(aa|bb)*c#a*(bb|cc)*a#a?(bb|cc)*d#[a-f]*(g|hh)*f/B
3835
3836/[a-f]*(g|hh|i)*i#[a-x]{4,}(y{0,6})*y#[a-k]+(ll|mm)+n/B
3837
3838/[a-f]*(?>gg|hh)+#[a-f]*(?>gg|hh)?#[a-f]*(?>gg|hh)*a#[a-f]*(?>gg|hh)*h/B
3839
3840/[a-c]*d/IB
3841
3842/[a-c]+d/IB
3843
3844/[a-c]?d/IB
3845
3846/[a-c]{4,6}d/IB
3847
3848/[a-c]{0,6}d/IB
3849
3850# End of special auto-possessive tests
3851
3852/^A\o{1239}B/
3853    A\123B
3854
3855/^A\oB/
3856
3857/^A\x{zz}B/
3858
3859/^A\x{12Z/
3860
3861/^A\x{/
3862
3863/[ab]++/B,no_auto_possess
3864
3865/[^ab]*+/B,no_auto_possess
3866
3867/a{4}+/B,no_auto_possess
3868
3869/a{4}+/Bi,no_auto_possess
3870
3871/[a-[:digit:]]+/
3872
3873/[A-[:digit:]]+/
3874
3875/[a-[.xxx.]]+/
3876
3877/[a-[=xxx=]]+/
3878
3879/[a-[!xxx!]]+/
3880
3881/[A-[!xxx!]]+/
3882    A]]]
3883
3884/[a-\d]+/
3885
3886/(?<0abc>xx)/
3887
3888/(?&1abc)xx(?<1abc>y)/
3889
3890/(?<ab-cd>xx)/
3891
3892/(?'0abc'xx)/
3893
3894/(?P<0abc>xx)/
3895
3896/\k<5ghj>/
3897
3898/\k'5ghj'/
3899
3900/\k{2fgh}/
3901
3902/(?P=8yuki)/
3903
3904/\g{4df}/
3905
3906/(?&1abc)xx(?<1abc>y)/
3907
3908/(?P>1abc)xx(?<1abc>y)/
3909
3910/\g'3gh'/
3911
3912/\g<5fg>/
3913
3914/(?(<4gh>)abc)/
3915
3916/(?('4gh')abc)/
3917
3918/(?(4gh)abc)/
3919
3920/(?(R&6yh)abc)/
3921
3922/(((a\2)|(a*)\g<-1>))*a?/B
3923
3924# Test the ugly "start or end of word" compatibility syntax.
3925
3926/[[:<:]]red[[:>:]]/B
3927    little red riding hood
3928    a /red/ thing
3929    red is a colour
3930    put it all on red
3931\= Expect no match
3932    no reduction
3933    Alfred Winifred
3934
3935/[a[:<:]] should give error/
3936
3937/(?=ab\K)/aftertext
3938    abcd\=startchar
3939
3940/abcd/newline=lf,firstline
3941\= Expect no match
3942    xx\nxabcd
3943
3944# Test stack guard external calls.
3945
3946/(((a)))/stackguard=1
3947
3948/(((a)))/stackguard=2
3949
3950/(((a)))/stackguard=3
3951
3952/(((((a)))))/
3953
3954# End stack guard tests
3955
3956/^\w+(?>\s*)(?<=\w)/B
3957
3958/\othing/
3959
3960/\o{}/
3961
3962/\o{whatever}/
3963
3964/\xthing/
3965
3966/\x{}/
3967
3968/\x{whatever}/
3969
3970/A\8B/
3971
3972/A\9B/
3973
3974# This one is here because Perl fails to match "12" for this pattern when the $
3975# is present.
3976
3977/^(?(?=abc)\w{3}:|\d\d)$/
3978    abc:
3979    12
3980\= Expect no match
3981    123
3982    xyz
3983
3984# Perl gets this one wrong, giving "a" as the after text for ca and failing to
3985# match for cd.
3986
3987/(?(?=ab)ab)/aftertext
3988    abxxx
3989    ca
3990    cd
3991
3992# This should test both paths for processing OP_RECURSE.
3993
3994/(?(R)a+|(?R)b)/
3995    aaaabcde
3996    aaaabcde\=ovector=100
3997
3998/a*?b*?/
3999    ab
4000
4001/(*NOTEMPTY)a*?b*?/
4002    ab
4003    ba
4004    cb
4005
4006/(*NOTEMPTY_ATSTART)a*?b*?/aftertext
4007    ab
4008    cdab
4009
4010/(?(VERSION>=10.0)yes|no)/I
4011    yesno
4012
4013/(?(VERSION>=10.04)yes|no)/
4014    yesno
4015
4016/(?(VERSION=8)yes){3}/BI,aftertext
4017    yesno
4018
4019/(?(VERSION=8)yes|no){3}/I
4020    yesnononoyes
4021\= Expect no match
4022    yesno
4023
4024/(?:(?<VERSION>abc)|xyz)(?(VERSION)yes|no)/I
4025    abcyes
4026    xyzno
4027\= Expect no match
4028    abcno
4029    xyzyes
4030
4031/(?(VERSION<10)yes|no)/
4032
4033/(?(VERSION>10)yes|no)/
4034
4035/(?(VERSION>=10.0.0)yes|no)/
4036
4037/(?(VERSION=10.101)yes|no)/
4038
4039/abcd/I
4040
4041/abcd/I,no_start_optimize
4042
4043/(|ab)*?d/I
4044   abd
4045   xyd
4046
4047/(|ab)*?d/I,no_start_optimize
4048   abd
4049   xyd
4050
4051/\k<A>*(?<A>aa)(?<A>bb)/match_unset_backref,dupnames
4052    aabb
4053
4054/(((((a)))))/parens_nest_limit=2
4055
4056/abc/replace=XYZ
4057    123123
4058    123abc123
4059    123abc123abc123
4060    123123\=zero_terminate
4061    123abc123\=zero_terminate
4062    123abc123abc123\=zero_terminate
4063
4064/abc/g,replace=XYZ
4065    123abc123
4066    123abc123abc123
4067
4068/abc/replace=X$$Z
4069    123abc123
4070
4071/abc/g,replace=X$$Z
4072    123abc123abc123
4073
4074/a(b)c(d)e/replace=X$1Y${2}Z
4075    "abcde"
4076
4077/a(b)c(d)e/replace=X$1Y${2}Z,global
4078    "abcde-abcde"
4079
4080/a(?<ONE>b)c(?<TWO>d)e/replace=X$ONE+${TWO}Z
4081    "abcde"
4082
4083/a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z
4084    "abcde-abcde-"
4085
4086/abc/replace=a$++
4087    123abc
4088
4089/abc/replace=a$bad
4090    123abc
4091
4092/abc/replace=a${A234567890123456789_123456789012}z
4093    123abc
4094
4095/abc/replace=a${A23456789012345678901234567890123}z
4096    123abc
4097
4098/abc/replace=a${bcd
4099    123abc
4100
4101/abc/replace=a${b+d}z
4102    123abc
4103
4104/abc/replace=[10]XYZ
4105    123abc123
4106
4107/abc/replace=[9]XYZ
4108    123abc123
4109
4110/abc/replace=xyz
4111    1abc2\=partial_hard
4112
4113/abc/replace=xyz
4114    123abc456
4115    123abc456\=replace=pqr
4116    123abc456abc789
4117    123abc456abc789\=g
4118
4119/(?<=abc)(|def)/g,replace=<$0>
4120    123abcxyzabcdef789abcpqr
4121
4122/./replace=$0
4123    a
4124
4125/(.)(.)/replace=$2+$1
4126    abc
4127
4128/(?<A>.)(?<B>.)/replace=$B+$A
4129    abc
4130
4131/(.)(.)/g,replace=$2$1
4132    abcdefgh
4133
4134/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=${*MARK}
4135    apple lemon blackberry
4136    apple strudel
4137    fruitless
4138
4139/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} sauce,
4140    apple lemon blackberry
4141
4142/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK>
4143    apple lemon blackberry
4144    apple strudel
4145    fruitless
4146
4147/(*:pear)apple/g,replace=${*MARKING}
4148    apple lemon blackberry
4149
4150/(*:pear)apple/g,replace=${*MARK-time
4151    apple lemon blackberry
4152
4153/(*:pear)apple/g,replace=${*mark}
4154    apple lemon blackberry
4155
4156/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARKET>
4157    apple lemon blackberry
4158
4159/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[22]${*MARK}
4160    apple lemon blackberry
4161    apple lemon blackberry\=substitute_overflow_length
4162
4163/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[23]${*MARK}
4164    apple lemon blackberry
4165
4166/abc/
4167    123abc123\=replace=[9]XYZ
4168    123abc123\=substitute_overflow_length,replace=[9]XYZ
4169    123abc123\=substitute_overflow_length,replace=[6]XYZ
4170    123abc123\=substitute_overflow_length,replace=[1]XYZ
4171    123abc123\=substitute_overflow_length,replace=[0]XYZ
4172
4173/a(b)c/
4174    123abc123\=replace=[9]x$1z
4175    123abc123\=substitute_overflow_length,replace=[9]x$1z
4176    123abc123\=substitute_overflow_length,replace=[6]x$1z
4177    123abc123\=substitute_overflow_length,replace=[1]x$1z
4178    123abc123\=substitute_overflow_length,replace=[0]x$1z
4179
4180"((?=(?(?=(?(?=(?(?=()))))))))"
4181    a
4182
4183"(?(?=)==)(((((((((?=)))))))))"
4184\= Expect no match
4185    a
4186
4187/(a)(b)|(c)/
4188    XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
4189
4190/x(?=ab\K)/
4191    xab\=get=0
4192    xab\=copy=0
4193    xab\=getall
4194
4195/(?<A>a)|(?<A>b)/dupnames
4196    a\=ovector=1,copy=A,get=A,get=2
4197    a\=ovector=2,copy=A,get=A,get=2
4198    b\=ovector=2,copy=A,get=A,get=2
4199
4200/a(b)c(d)/
4201    abc\=ph,copy=0,copy=1,getall
4202
4203/^abc/info
4204
4205/^abc/info,no_dotstar_anchor
4206
4207/.*\d/info,auto_callout
4208\= Expect no match
4209    aaa
4210
4211/.*\d/info,no_dotstar_anchor,auto_callout
4212\= Expect no match
4213    aaa
4214
4215/.*\d/dotall,info
4216
4217/.*\d/dotall,no_dotstar_anchor,info
4218
4219/(*NO_DOTSTAR_ANCHOR)(?s).*\d/info
4220
4221'^(?:(a)|b)(?(1)A|B)'
4222    aA123\=ovector=1
4223    aA123\=ovector=2
4224
4225'^(?:(?<AA>a)|b)(?(<AA>)A|B)'
4226    aA123\=ovector=1
4227    aA123\=ovector=2
4228
4229'^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'dupnames
4230    aA123\=ovector=1
4231    aA123\=ovector=2
4232    aA123\=ovector=3
4233
4234'^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'dupnames
4235    aa123\=ovector=1
4236    aa123\=ovector=2
4237    aa123\=ovector=3
4238
4239/(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
4240
4241/(?<N>(?J)(?<N>))(?-J)\k<N>/
4242
4243# Quantifiers are not allowed on condition assertions, but are otherwise
4244# OK in conditions.
4245
4246/(?(?=0)?)+/
4247
4248/(?(?=0)(?=00)?00765)/
4249     00765
4250
4251/(?(?=0)(?=00)?00765|(?!3).56)/
4252     00765
4253     456
4254\= Expect no match
4255     356
4256
4257'^(a)*+(\w)'
4258    g
4259    g\=ovector=1
4260
4261'^(?:a)*+(\w)'
4262    g
4263    g\=ovector=1
4264
4265# These two pattern showeds up compile-time bugs
4266
4267"((?2){0,1999}())?"
4268
4269/((?+1)(\1))/B
4270
4271# Callouts with string arguments
4272
4273/a(?C"/
4274
4275/a(?C"a/
4276
4277/a(?C"a"/
4278
4279/a(?C"a"bcde(?C"b")xyz/
4280
4281/a(?C"a)b""c")/B
4282
4283/ab(?C" any text with spaces ")cde/B
4284    abcde
4285    12abcde
4286
4287/^a(b)c(?C1)def/
4288      abcdef
4289
4290/^a(b)c(?C"AB")def/
4291      abcdef
4292
4293/^a(b)c(?C1)def/
4294      abcdef\=callout_capture
4295
4296/^a(b)c(?C{AB})def/B
4297      abcdef\=callout_capture
4298
4299/(?C`a``b`)(?C'a''b')(?C"a""b")(?C^a^^b^)(?C%a%%b%)(?C#a##b#)(?C$a$$b$)(?C{a}}b})/B,callout_info
4300
4301/(?:a(?C`code`)){3}/B
4302
4303/^(?(?C25)(?=abc)abcd|xyz)/B,callout_info
4304    abcdefg
4305    xyz123
4306
4307/^(?(?C$abc$)(?=abc)abcd|xyz)/B
4308    abcdefg
4309    xyz123
4310
4311/^ab(?C'first')cd(?C"second")ef/
4312    abcdefg
4313
4314/(?:a(?C`code`)){3}X/
4315    aaaXY
4316
4317# Binary zero in callout string
4318#  a  (  ?  C  '  x     z  '  )  b
4319/ 61 28 3f 43 27 78 00 7a 27 29 62/hex,callout_info
4320    abcdefgh
4321
4322/(?(?!)^)/
4323
4324/(?(?!)a|b)/
4325    bbb
4326\= Expect no match
4327    aaa
4328
4329# JIT gives a different error message for the infinite recursion
4330
4331"(*NO_JIT)((?2)+)((?1)){"
4332    abcd{
4333
4334# Perl fails to diagnose the absence of an assertion
4335
4336"(?(?<E>.*!.*)?)"
4337
4338"X((?2)()*+){2}+"B
4339
4340"X((?2)()*+){2}"B
4341
4342/(?<=\bABQ(3(?-7)))/
4343
4344/(?<=\bABQ(3(?+7)))/
4345
4346";(?<=()((?3))((?2)))"
4347
4348# Perl loops on this (PCRE2 used to!)
4349
4350/(?<=\Ka)/g,aftertext
4351    aaaaa
4352
4353/(?<=\Ka)/altglobal,aftertext
4354    aaaaa
4355
4356/((?2){73}(?2))((?1))/info
4357
4358/abc/
4359\= Expect no match
4360    \[9x!xxx(]{9999}
4361
4362/(abc)*/
4363    \[abc]{5}
4364
4365/^/gm
4366    \n\n\n
4367
4368/^/gm,alt_circumflex
4369    \n\n\n
4370
4371/((((((((x))))))))\81/
4372    xx1
4373
4374/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\80/
4375    xx
4376
4377/\80/
4378
4379/A\8B\9C/
4380    A8B9C
4381
4382/(?x:((?'a')) # comment (with parentheses) and | vertical
4383(?-x:#not a comment (?'b')) # this is a comment ()
4384(?'c')) # not a comment (?'d')/info
4385
4386/(?|(?'a')(2)(?'b')|(?'a')(?'a')(3))/I,dupnames
4387    A23B
4388    B32A
4389
4390# These are some patterns that used to cause buffer overflows or other errors
4391# while compiling.
4392
4393/.((?2)(?R)|\1|$)()/B
4394
4395/.((?3)(?R)()(?2)|\1|$)()/B
4396
4397/(\9*+(?2);\3++()2|)++{/
4398
4399/\V\x85\9*+((?2)\3++()2)*:2/
4400
4401/(((?(R)){0,2}) (?'x'((?'R')((?'R')))))/dupnames
4402
4403/(((?(X)){0,2}) (?'x'((?'X')((?'X')))))/dupnames
4404
4405/(((?(R)){0,2}) (?'x'((?'X')((?'R')))))/
4406
4407"(?J)(?'d'(?'d'\g{d}))"
4408
4409"(?=!((?2)(?))({8(?<=(?1){29}8bbbb\x16\xd\xc6^($(\xa9H4){4}h}?1)B))\x15')"
4410
4411/A(?'')Z/
4412
4413"(?J:(?|(?'R')(\k'R')|((?'R'))))"
4414
4415/(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
4416
4417/^(?:(?(1)x|)+)+$()/B
4418
4419/[[:>:]](?<)/
4420
4421/((?x)(*:0))#(?'/
4422
4423/(?C$[$)(?<]/
4424
4425/(?C$)$)(?<]/
4426
4427/(?(R))*+/B
4428    abcd
4429
4430/((?x)(?#))#(?'/
4431
4432/((?x)(?#))#(?'abc')/I
4433
4434/[[:\\](?<[::]/
4435
4436/[[:\\](?'abc')[a:]/I
4437
4438"[[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[:::::::::::::::::[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[[[:::E[[[:[:[[:[:::[[:::E[[[:[:[[:'[:::::E[[[:[::::::[[[:[[[[[[[::E[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
4439
4440/()(?(R)0)*+/B
4441
4442/(?R-:(?</
4443
4444/(?R-:(?<)/
4445
4446/(?(?C{\Q})(?!(?'/
4447
4448/(?(?C{\Q})(?!(?'abc')))/I
4449
4450/(?1){3918}(((((0(\k'R'))))(?J)(?'R'(?'R'\3){99})))/I
4451
4452/(?|(aaa)|(b))\g{1}/I
4453
4454/(?|(aaa)|(b))(?1)/I
4455
4456/(?|(aaa)|(b))/I
4457
4458/(?|(?'a'aaa)|(?'a'b))\k'a'/I
4459
4460/(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/I,dupnames
4461
4462/ab{3cd/
4463    ab{3cd
4464
4465/ab{3,cd/
4466    ab{3,cd
4467
4468/ab{3,4a}cd/
4469    ab{3,4a}cd
4470
4471/{4,5a}bc/
4472    {4,5a}bc
4473
4474/\x0{ab}/
4475    \0{ab}
4476
4477/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
4478    ababababbbabZXXXX
4479
4480/.*?a(*PRUNE)b/
4481    aab
4482
4483/.*?a(*PRUNE)b/s
4484    aab
4485
4486/^a(*PRUNE)b/s
4487\= Expect no match
4488    aab
4489
4490/.*?a(*SKIP)b/
4491    aab
4492
4493/(?(8000000000/
4494
4495/((?(R8000000000)))/
4496
4497/0(?0)|(1)(*THEN)(*SKIP:0)(*FAIL)/
4498\= Expect no match
4499    01
4500
4501/(?(1)()\983040\2)/
4502
4503/(*LIMIT_MATCH=)abc/
4504
4505/(*CRLF)(*LIMIT_MATCH=)abc/
4506
4507/(?:ab)?(?:ab)(?:ab)/
4508    abab
4509    ababab
4510\= Expect no match
4511    aba
4512
4513/((*MARK:A))++a(*SKIP:B)b/
4514\= Expect no match
4515    aacb
4516
4517/(*MARK:a\zb)z/alt_verbnames
4518
4519/(*:ab\t(d\)c)xxx/
4520
4521/(*:ab\t(d\)c)xxx/alt_verbnames,mark
4522    cxxxz
4523
4524/(*:A\Qxx)x\EB)x/alt_verbnames,mark
4525    x
4526
4527/(*:A\ExxxB)x/alt_verbnames,mark
4528    x
4529
4530/(*: A \ and #comment
4531     \ B)x/x,alt_verbnames,mark
4532    x
4533
4534/(*: A \ and #comment
4535     \ B)x/alt_verbnames,mark
4536    x
4537
4538/(*: A \ and #comment
4539     \ B)x/x,mark
4540    x
4541
4542/(*: A \ and #comment
4543     \ B)x/mark
4544    x
4545
4546/(*:A
4547B)x/alt_verbnames,mark
4548    x
4549
4550/(*:abc\Qpqr)/alt_verbnames
4551
4552/abc/use_offset_limit
4553    1234abcde\=offset_limit=100
4554    1234abcde\=offset_limit=9
4555    1234abcde\=offset_limit=4
4556    1234abcde\=offset_limit=4,offset=4
4557\= Expect no match
4558    1234abcde\=offset_limit=4,offset=5
4559    1234abcde\=offset_limit=3
4560
4561/(?<=abc)/use_offset_limit
4562    1234abc\=offset_limit=7
4563\= Expect no match
4564    1234abc\=offset_limit=6
4565
4566/A/g,replace=-,use_offset_limit
4567    XAXAXAXAXA\=offset_limit=4
4568
4569/abc/
4570\= Expect error
4571    1234abcde\=offset_limit=4
4572
4573/^\w/m,use_offset_limit
4574    \n..\naa\=offset_limit=3
4575    \n..\naa\=offset_limit=4
4576
4577/abcd/null_context
4578    abcd\=null_context
4579\= Expect error - not allowed together
4580    abcd\=null_context,find_limits
4581    abcd\=allusedtext,startchar
4582
4583/abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended
4584    abcd
4585
4586/abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended,substitute_literal
4587    >>abcd<<
4588
4589/abcd/g,replace=\$1$2\,substitute_literal
4590    XabcdYabcdZ
4591
4592/a(bc)(DE)/replace=a\u$1\U$1\E$1\l$2\L$2\Eab\Uab\LYZ\EDone,substitute_extended
4593    abcDE
4594
4595/abcd/replace=xy\kz,substitute_extended
4596    abcd
4597
4598/a(?:(b)|(c))/substitute_extended,replace=X${1:+1:-1}X${2:+2:-2}
4599    ab
4600    ac
4601    ab\=replace=${1:+$1\:$1:$2}
4602    ac\=replace=${1:+$1\:$1:$2}
4603    >>ac<<\=replace=${1:+$1\:$1:$2},substitute_literal
4604
4605/a(?:(b)|(c))/substitute_extended,replace=X${1:-1:-1}X${2:-2:-2}
4606    ab
4607    ac
4608
4609/(a)/substitute_extended,replace=>${1:+\Q$1:{}$$\E+\U$1}<
4610    a
4611
4612/X(b)Y/substitute_extended
4613    XbY\=replace=x${1:+$1\U$1}y
4614    XbY\=replace=\Ux${1:+$1$1}y
4615
4616/a/substitute_extended,replace=${*MARK:+a:b}
4617    a
4618
4619/(abcd)/replace=${1:+xy\kz},substitute_extended
4620    abcd
4621
4622/(abcd)/
4623    abcd\=replace=${1:+xy\kz},substitute_extended
4624
4625/abcd/substitute_extended,replace=>$1<
4626    abcd
4627
4628/abcd/substitute_extended,replace=>xxx${xyz}<<<
4629    abcd
4630
4631/(?J)(?:(?<A>a)|(?<A>b))/replace=<$A>
4632    [a]
4633    [b]
4634\= Expect error
4635    (a)\=ovector=1
4636
4637/(a)|(b)/replace=<$1>
4638\= Expect error
4639    b
4640
4641/(aa)(BB)/substitute_extended,replace=\U$1\L$2\E$1..\U$1\l$2$1
4642    aaBB
4643
4644/abcd/replace=wxyz,substitute_matched
4645    abcd
4646    pqrs
4647
4648/abcd/g
4649    >abcd1234abcd5678<\=replace=wxyz,substitute_matched
4650
4651/^(o(\1{72}{\"{\\{00000059079}\d*){74}}){19}/I
4652
4653/((p(?'K/
4654
4655/((p(?'K/no_auto_capture
4656
4657/abc/replace=A$3123456789Z
4658    abc
4659
4660/(?<!a{65535}a{5})x/I
4661
4662/(?<!a{65535})x/I
4663
4664/(?=a\K)/replace=z
4665    BaCaD
4666
4667/(?<=\K.)/g,replace=-
4668    ab
4669
4670/(?'abcdefghijklmnopqrstuvwxyzABCDEFG'toolong)/
4671
4672/(?'abcdefghijklmnopqrstuvwxyzABCDEF'justright)/
4673
4674# These two use zero-termination
4675/abcd/max_pattern_length=3
4676
4677/abc/max_pattern_length=3
4678
4679# These two, being hex, pass the length
4680/abcdefab/hex,max_pattern_length=3
4681
4682/abcdef/hex,max_pattern_length=3
4683
4684# These patterns used to take a long time to compile
4685
4686"(.*)
4687((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4688((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4689((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
4690
4691"(?<=a()
4692((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4693((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4694((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4695a)"xI
4696
4697"(?|()|())(.*)
4698((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4699((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4700((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
4701
4702"(?|()|())(?<=a()
4703((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4704((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4705((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4706a)"xI
4707
4708# Test the use of malloc for caching group information when there are more
4709# groups than fit into the on-stack workspace.
4710
4711/\[()]{1024}/I,expand
4712
4713# Test minlength capped at 65535
4714
4715/(A{65000})\1{65000}/I
4716
4717# Test group scans when numbers are not unique
4718
4719/(?|()+|(a)+)/BI
4720
4721/(?|(a)+|()+)/BI
4722
4723/(?|()|(a))/BI
4724
4725/(?|(a)|())/BI
4726
4727# Test CRLF handling in empty string substitutions
4728
4729/^$/gm,newline=anycrlf,replace=-
4730    X\r\n\r\nY
4731
4732/^$/gm,newline=crlf,replace=-
4733    X\r\n\r\nY
4734
4735/^$/gm,newline=any,replace=-
4736    X\r\n\r\nY
4737
4738"(*ANYCRLF)(?m)^(.*[^0-9\r\n].*|)$"g,replace=NaN
4739    15\r\nfoo\r\n20\r\nbar\r\nbaz\r\n\r\n20
4740
4741/a[[:punct:]b]/bincode
4742
4743/a[b[:punct:]]/bincode
4744
4745/L(?#(|++<!(2)?/B
4746
4747/L(?#(|++<!(2)?/B,no_auto_possess
4748
4749/L(?#(|++<!(2)?/B,auto_callout
4750
4751/L(?#(|++<!(2)?/B,no_auto_possess,auto_callout
4752
4753/(A*)\E+/B,auto_callout
4754
4755/()\Q\E*]/B,auto_callout
4756    a[bc]d
4757
4758/\x8a+f|;T?(*:;.'?`(\xeap ){![^()!y*''C*(?';]{1;(\x08)/B,alt_verbnames,dupnames,extended
4759
4760# Tests for NULL characters in comments and verb "names" and callouts
4761
4762# /A#B\x00C\x0aZ/
4763/41 23 42 00 43 0a 5a/Bx,hex
4764
4765# /A+#B\x00C\x0a+/
4766/41 2b 23 42 00 43 0a 2b/Bx,hex
4767
4768# /A(*:B\x00W#X\00Y\x0aC)Z/
4769/41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex,alt_verbnames
4770
4771# /A(*:B\x00W#X\00Y\x0aC)Z/
4772/41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex
4773
4774# /A(?C{X\x00Y})B/
4775/41 28 3f 43 7b 58 00 59 7d 29 42/B,hex
4776
4777# /A(?#X\x00Y)B/
4778/41 28 3f 23 7b 00 7d 29 42/B,hex
4779
4780# Tests for leading comment in extended patterns
4781
4782/ (?-x):?/extended
4783
4784/(?-x):?/extended
4785
4786/0b 28 3f 2d 78 29 3a/hex,extended
4787
4788/#comment
4789(?-x):?/extended
4790
4791/(8(*:6^\x09x\xa6l\)6!|\xd0:[^:|)\x09d\Z\d{85*m(?'(?<1!)*\W[*\xff]!!h\w]*\xbe;/alt_bsux,alt_verbnames,allow_empty_class,dollar_endonly,extended,multiline,never_utf,no_dotstar_anchor,no_start_optimize
4792
4793/a|(b)c/replace=>$1<,substitute_unset_empty
4794    cat
4795    xbcom
4796
4797/a|(b)c/
4798    cat\=replace=>$1<
4799    cat\=replace=>$1<,substitute_unset_empty
4800    xbcom\=replace=>$1<,substitute_unset_empty
4801
4802/a|(b)c/substitute_extended
4803    cat\=replace=>${2:-xx}<
4804    cat\=replace=>${2:-xx}<,substitute_unknown_unset
4805    cat\=replace=>${X:-xx}<,substitute_unknown_unset
4806
4807/a|(?'X'b)c/replace=>$X<,substitute_unset_empty
4808    cat
4809    xbcom
4810
4811/a|(?'X'b)c/replace=>$Y<,substitute_unset_empty
4812    cat
4813    cat\=substitute_unknown_unset
4814    cat\=substitute_unknown_unset,-substitute_unset_empty
4815
4816/a|(b)c/replace=>$2<,substitute_unset_empty
4817    cat
4818    cat\=substitute_unknown_unset
4819    cat\=substitute_unknown_unset,-substitute_unset_empty
4820
4821/()()()/use_offset_limit
4822    \=ovector=11000000000
4823    \=callout_fail=11000000000
4824    \=callout_fail=1:11000000000
4825    \=callout_data=11000000000
4826    \=callout_data=-11000000000
4827    \=offset_limit=1100000000000000000000
4828    \=copy=11000000000
4829
4830/(*MARK:A\x00b)/mark
4831    abc
4832
4833/(*MARK:A\x00b)/mark,alt_verbnames
4834    abc
4835
4836/"(*MARK:A" 00 "b)"/mark,hex
4837    abc
4838
4839/"(*MARK:A" 00 "b)"/mark,hex,alt_verbnames
4840    abc
4841
4842/efg/hex
4843
4844/eff/hex
4845
4846/effg/hex
4847
4848/(?J)(?'a'))(?'a')/
4849
4850/(?<=((?C)0))/
4851    9010
4852\= Expect no match
4853    abc
4854
4855/aaa/
4856\[abc]{10000000000000000000000000000}
4857\[a]{3}
4858
4859/\[AB]{6000000000000000000000}/expand
4860
4861# Hex uses pattern length, not zero-terminated. This tests for overrunning
4862# the given length of a pattern.
4863
4864/'(*U'/hex
4865
4866/'(*'/hex
4867
4868/'('/hex
4869
4870//hex
4871
4872# These tests are here because Perl never allows a back reference in a
4873# lookbehind. PCRE2 supports some limited cases.
4874
4875/([ab])...(?<=\1)z/
4876    a11az
4877    b11bz
4878\= Expect no match
4879    b11az
4880
4881/(?|([ab]))...(?<=\1)z/
4882
4883/([ab])(\1)...(?<=\2)z/
4884    aa11az
4885
4886/(a\2)(b\1)(?<=\2)/
4887
4888/(?<A>[ab])...(?<=\k'A')z/
4889    a11az
4890    b11bz
4891\= Expect no match
4892    b11az
4893
4894/(?<A>[ab])...(?<=\k'A')(?<A>)z/dupnames
4895
4896# Perl does not support \g+n
4897
4898/((\g+1X)?([ab]))+/
4899    aaXbbXa
4900
4901/ab(?C1)c/auto_callout
4902    abc
4903
4904/'ab(?C1)c'/hex,auto_callout
4905    abc
4906
4907# Perl accepts these, but gives a warning. We can't warn, so give an error.
4908
4909/[a-[:digit:]]+/
4910    a-a9-a
4911
4912/[A-[:digit:]]+/
4913    A-A9-A
4914
4915/[a-\d]+/
4916    a-a9-a
4917
4918/(?<RA>abc)(?(R)xyz)/B
4919
4920/(?<R>abc)(?(R)xyz)/B
4921
4922/(?=.*[A-Z])/I
4923
4924/()(?<=(?0))/
4925
4926/(?<!|!(?<!))/
4927
4928/(?<!|!|!||||||(?<!)||(?<!)!|!||(?<!)!|!(?<!)!|!|!|!||||!!|<!)!|!||||!|/
4929
4930/{2,2{2,2/use_length
4931
4932/.>*?\g'0/use_length
4933
4934/.>*?\g'0/
4935
4936/{�̈́�̈́�{'{22{2{{2{'{22{{22{2{'{22{2{{2{{222{{2{'{22{2{22{2{'{22{2{{2{'{22{2{22{2{'{'{22{2{22{2{'{22{2{{2{'{22{2{22{2{'{222{2Ą̈́�̈́�{'{22{2{{2{'{22{{11{2{'{22{2{{2{{'{22{2{{2{'{22{{22{1{'{22{2{{2{{222{{2{'{22{2{22{2{'{/auto_callout
4937
4938//
4939\=get=i00000000000000000000000000000000
4940\=get=i2345678901234567890123456789012,get=i1245678901234567890123456789012
4941
4942"(?(?C))"
4943
4944/(?(?(?(?(?(?))))))/
4945
4946/(?<=(?1))((?s))/anchored
4947
4948/(*:ab)*/
4949
4950%(*:(:(svvvvvvvvvv:]*[   Z!*;[]*[^[]*!^[+.+{{2,7}'      _\\\\\\\\\\\\\)?.:..    *w////\\\Q\\\\\\\\\\\\\\\T\\\\\+/?/////'+\\\EEE?/////'+/*+/[^K]?]//(w)%never_backslash_c,alt_verbnames,auto_callout
4951
4952/./newline=crlf
4953    \=ph
4954
4955/(\x0e00\000000\xc)/replace=\P,substitute_extended
4956    \x0e00\000000\xc
4957
4958//replace=0
4959    \=offset=7
4960
4961/(?<=\G.)/g,replace=+
4962    abc
4963
4964".+\QX\E+"B,no_auto_possess
4965
4966".+\QX\E+"B,auto_callout,no_auto_possess
4967
4968# This one is here because Perl gives an 'unmatched )' error which goes away
4969# if one of the \) sequences is removed - which is weird. PCRE finds it too
4970# complicated to find a minimum matching length.
4971
4972"()X|((((((((()))))))((((())))))\2())((((((\2\2)))\2)(\22((((\2\2)2))\2)))(2\ZZZ)+:)Z^|91ZiZZnter(ZZ |91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z+:)Z|91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z((Z*(\2(Z\':))\0)i|||||||||||||||loZ\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0nte!rnal errpr\2\\21r(2\ZZZ)+:)Z!|91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0(2\ZZZ)+:)Z^|91ZiZZnter(ZZ |91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0(2\ZZZ)+:)Z^)))int \)\0(2\ZZZ)+:)Z^|91ZiZZnter(ZZernZal ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \))\ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)))\2))))((((((\2\2))))))"I
4973
4974# This checks that new code for handling groups that may match an empty string
4975# works on a very large number of alternatives. This pattern used to provoke a
4976# complaint that it was too complicated.
4977
4978/(?:\[A|B|C|D|E|F|G|H|I|J|]{200}Z)/expand
4979
4980# This one used to compile rubbish instead of a compile error, and then
4981# behave unpredictably at match time.
4982
4983/.+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X/
4984    .+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X
4985
4986/[:[:alnum:]-[[a:lnum:]+/
4987
4988/((?(?C'')\QX\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
4989
4990/((?(?C'')\Q\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
4991
4992/abcd/auto_callout
4993    abcd\=callout_error=255:2
4994
4995/()(\g+65534)/
4996
4997/()(\g+65533)/
4998
4999/�\x00\x00\x00�(\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\x00k\d+\x00‎\x00\x00\x00\x00\x00\2*\x00\x00\1*.){36}int^\x00\x00��\x00�(\1{50779}?)J\w2/I
5000
5001/(a)(b)\2\1\1\1\1/I
5002
5003/(?<a>a)(?<b>b)\g{b}\g{a}\g{a}\g{a}\g{a}(?<a>xx)(?<b>zz)/I,dupnames
5004
5005//
5006    \=ovector=7777777777
5007
5008# This is here because Perl matches, even though a COMMIT is encountered
5009# outside of the recursion.
5010
5011/(?1)(A(*COMMIT)|B)D/
5012    BAXBAD
5013
5014"(?1){2}(a)"B
5015
5016"(?1){2,4}(a)"B
5017
5018# This test differs from Perl for the first subject. Perl ends up with
5019# $1 set to 'B'; PCRE2 has it unset (which I think is right).
5020
5021/^(?:
5022(?:A| (?:B|B(*ACCEPT)) (?<=(.)) D)
5023(Z)
5024)+$/x
5025    AZB
5026    AZBDZ
5027
5028# The first of these, when run by Perl, gives the mark 'aa', which is wrong.
5029
5030'(?>a(*:aa))b|ac' mark
5031    ac
5032
5033'(?:a(*:aa))b|ac' mark
5034    ac
5035
5036/(R?){65}/
5037    (R?){65}
5038
5039/\[(a)]{60}/expand
5040    aaaa
5041
5042/(?<!\1((?U)1((?U))))(*F)/never_backslash_c,alt_bsux,anchored,extended
5043
5044/\g{3/
5045
5046/(a(?C1)(b)(c)d)+/
5047  abcdabcd\=callout_capture
5048
5049# Perl matches this one, but PCRE does not because (*ACCEPT) clears out any
5050# pending backtracks in the recursion.
5051
5052/^ (?(DEFINE) (..(*ACCEPT)|...) ) (?1)$/x
5053\= Expect no match
5054    abc
5055
5056# Perl gives no match for this one
5057
5058/(a(*MARK:m)(*ACCEPT)){0}(?1)/mark
5059    abc
5060
5061/abc/endanchored
5062    xyzabc
5063\= Expect no match
5064    xyzabcdef
5065\= Expect error
5066    xyzabc\=ph
5067
5068/abc/
5069    xyzabc\=endanchored
5070\= Expect no match
5071    xyzabcdef\=endanchored
5072\= Expect error
5073    xyzabc\=ps,endanchored
5074
5075/abc(*ACCEPT)d/endanchored
5076    xyzabc
5077\= Expect no match
5078    xyzabcdef
5079
5080/abc|bcd/endanchored
5081    xyzabcd
5082\= Expect no match
5083    xyzabcdef
5084
5085/a(*ACCEPT)x|aa/endanchored
5086    aaa
5087
5088# Check auto-anchoring when there is a group that is never obeyed at
5089# the start of a branch.
5090
5091/(?(DEFINE)(a))^bc/I
5092
5093/(a){0}.*bc/sI
5094
5095# This should be anchored, as the condition is always false and there is
5096# no alternative branch.
5097
5098/(?(VERSION>=999)yes)^bc/I
5099
5100# This should not be anchored.
5101
5102/(?(VERSION>=999)yes|no)^bc/I
5103
5104/(*LIMIT_HEAP=0)xxx/I
5105
5106/\d{0,3}(*:abc)(?C1)xxx/callout_info
5107
5108# ----------------------------------------------------------------------
5109
5110# These are a whole pile of tests that touch lines of code that are not
5111# used by any other tests (at least when these were created).
5112
5113/^a+?x/i,no_start_optimize,no_auto_possess
5114\= Expect no match
5115    aaa
5116
5117/^[^a]{3,}?x/i,no_start_optimize,no_auto_possess
5118\= Expect no match
5119    bbb
5120    cc
5121
5122/^X\S/no_start_optimize,no_auto_possess
5123\= Expect no match
5124    X
5125
5126/^X\W/no_start_optimize,no_auto_possess
5127\= Expect no match
5128    X
5129
5130/^X\H/no_start_optimize,no_auto_possess
5131\= Expect no match
5132    X
5133
5134/^X\h/no_start_optimize,no_auto_possess
5135\= Expect no match
5136    X
5137
5138/^X\V/no_start_optimize,no_auto_possess
5139\= Expect no match
5140    X
5141
5142/^X\v/no_start_optimize,no_auto_possess
5143\= Expect no match
5144    X
5145
5146/^X\h/no_start_optimize,no_auto_possess
5147\= Expect no match
5148    XY
5149
5150/^X\V/no_start_optimize,no_auto_possess
5151\= Expect no match
5152    X\n
5153
5154/^X\v/no_start_optimize,no_auto_possess
5155\= Expect no match
5156    XX
5157
5158/^X.+?/s,no_start_optimize,no_auto_possess
5159\= Expect no match
5160    X
5161
5162/^X\R+?/no_start_optimize,no_auto_possess
5163\= Expect no match
5164    XX
5165
5166/^X\H+?/no_start_optimize,no_auto_possess
5167\= Expect no match
5168    X
5169
5170/^X\h+?/no_start_optimize,no_auto_possess
5171\= Expect no match
5172    X
5173
5174/^X\V+?/no_start_optimize,no_auto_possess
5175\= Expect no match
5176    X
5177    X\n
5178
5179/^X\D+?/no_start_optimize,no_auto_possess
5180\= Expect no match
5181    X
5182    X9
5183
5184/^X\S+?/no_start_optimize,no_auto_possess
5185\= Expect no match
5186    X
5187    X\n
5188
5189/^X\W+?/no_start_optimize,no_auto_possess
5190\= Expect no match
5191    X
5192    XX
5193
5194/^X.+?Z/no_start_optimize,no_auto_possess
5195\= Expect no match
5196    XY\n
5197
5198/(*CRLF)^X.+?Z/no_start_optimize,no_auto_possess
5199\= Expect no match
5200    XY\r\=ps
5201
5202/^X\R+?Z/no_start_optimize,no_auto_possess
5203\= Expect no match
5204    X\nX
5205    X\n\r\n
5206    X\n\rY
5207    X\n\nY
5208    X\n\x{0c}Y
5209
5210/(*BSR_ANYCRLF)^X\R+?Z/no_start_optimize,no_auto_possess
5211\= Expect no match
5212    X\nX
5213    X\n\r\n
5214    X\n\rY
5215    X\n\nY
5216    X\n\x{0c}Y
5217
5218/^X\H+?Z/no_start_optimize,no_auto_possess
5219\= Expect no match
5220    XY\t
5221    XYY
5222
5223/^X\h+?Z/no_start_optimize,no_auto_possess
5224\= Expect no match
5225    X\t\t
5226    X\tY
5227
5228/^X\V+?Z/no_start_optimize,no_auto_possess
5229\= Expect no match
5230    XY\n
5231    XYY
5232
5233/^X\v+?Z/no_start_optimize,no_auto_possess
5234\= Expect no match
5235    X\n\n
5236    X\nY
5237
5238/^X\D+?Z/no_start_optimize,no_auto_possess
5239\= Expect no match
5240    XY9
5241    XYY
5242
5243/^X\d+?Z/no_start_optimize,no_auto_possess
5244\= Expect no match
5245    X99
5246    X9Y
5247
5248/^X\S+?Z/no_start_optimize,no_auto_possess
5249\= Expect no match
5250    XY\n
5251    XYY
5252
5253/^X\s+?Z/no_start_optimize,no_auto_possess
5254\= Expect no match
5255    X\n\n
5256    X\nY
5257
5258/^X\W+?Z/no_start_optimize,no_auto_possess
5259\= Expect no match
5260    X.A
5261    X++
5262
5263/^X\w+?Z/no_start_optimize,no_auto_possess
5264\= Expect no match
5265    Xa.
5266    Xaa
5267
5268/^X.{1,3}Z/s,no_start_optimize,no_auto_possess
5269\= Expect no match
5270    Xa.bd
5271
5272/^X\h+Z/no_start_optimize,no_auto_possess
5273\= Expect no match
5274    X\t\t
5275    X\tY
5276
5277/^X\V+Z/no_start_optimize,no_auto_possess
5278\= Expect no match
5279    XY\n
5280    XYY
5281
5282/^(X(*THEN)Y|AB){0}(?1)/
5283    ABX
5284\= Expect no match
5285    XAB
5286
5287/^(?!A(?C1)B)C/
5288    ABC\=callout_error=1,no_jit
5289
5290/^(?!A(?C1)B)C/no_start_optimize
5291    ABC\=callout_error=1
5292
5293/^(?(?!A(?C1)B)C)/
5294    ABC\=callout_error=1
5295
5296# ----------------------------------------------------------------------
5297
5298/[a b c]/BxxI
5299
5300/[a b c]/BxxxI
5301
5302/[a b c]/B,extended_more
5303
5304/[ a b c ]/B,extended_more
5305
5306/[a b](?xx: [ 12 ] (?-xx:[ 34 ]) )y z/B
5307
5308# Unsetting /x also unsets /xx
5309
5310/[a b](?xx: [ 12 ] (?-x:[ 34 ]) )y z/B
5311
5312/(a)(?-n:(b))(c)/nB
5313
5314# ----------------------------------------------------------------------
5315# These test the dangerous PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL option.
5316
5317/\j\x{z}\o{82}\L\uabcd\u\U\g{\g/B,\bad_escape_is_literal
5318
5319/\N{\c/IB,bad_escape_is_literal
5320
5321/[\j\x{z}\o\gAb\g]/B,bad_escape_is_literal
5322
5323/[Q-\N]/B,bad_escape_is_literal
5324
5325/[\s-_]/bad_escape_is_literal
5326
5327/[_-\s]/bad_escape_is_literal
5328
5329/[\B\R\X]/B
5330
5331/[\B\R\X]/B,bad_escape_is_literal
5332
5333/[A-\BP-\RV-\X]/B
5334
5335/[A-\BP-\RV-\X]/B,bad_escape_is_literal
5336
5337# ----------------------------------------------------------------------
5338
5339/a\b(c/literal
5340    a\\b(c
5341
5342/a\b(c/literal,caseless
5343    a\\b(c
5344    a\\B(c
5345
5346/a\b(c/literal,firstline
5347    XYYa\\b(c
5348\= Expect no match
5349    X\na\\b(c
5350
5351/a\b?c/literal,use_offset_limit
5352    XXXXa\\b?c\=offset_limit=4
5353\= Expect no match
5354    XXXXa\\b?c\=offset_limit=3
5355
5356/a\b(c/literal,anchored,endanchored
5357    a\\b(c
5358\= Expect no match
5359    Xa\\b(c
5360    a\\b(cX
5361    Xa\\b(cX
5362
5363//literal,extended
5364
5365/a\b(c/literal,auto_callout,no_start_optimize
5366    XXXXa\\b(c
5367
5368/a\b(c/literal,auto_callout
5369    XXXXa\\b(c
5370
5371/(*CR)abc/literal
5372    (*CR)abc
5373
5374/cat|dog/I,match_word
5375    the cat sat
5376\= Expect no match
5377    caterpillar
5378    snowcat
5379    syndicate
5380
5381/(cat)|dog/I,match_line,literal
5382    (cat)|dog
5383\= Expect no match
5384    the cat sat
5385    caterpillar
5386    snowcat
5387    syndicate
5388
5389/a whole line/match_line,multiline
5390    Rhubarb \na whole line\n custard
5391\= Expect no match
5392    Not a whole line
5393
5394# Perl gets this wrong, failing to capture 'b' in group 1.
5395
5396/^(b+|a){1,2}?bc/
5397    bbc
5398
5399# And again here, for the "babc" subject string.
5400
5401/^(b*|ba){1,2}?bc/
5402    babc
5403    bbabc
5404    bababc
5405\= Expect no match
5406    bababbc
5407    babababc
5408
5409/[[:digit:]-a]/
5410
5411/[[:digit:]-[:print:]]/
5412
5413/[\d-a]/
5414
5415/[\H-z]/
5416
5417/[\d-[:print:]]/
5418
5419# Perl gets the second of these wrong, giving no match.
5420
5421"(?<=(a))\1?b"I
5422    ab
5423    aaab
5424
5425"(?=(a))\1?b"I
5426    ab
5427    aaab
5428
5429# JIT does not support callout_extra
5430
5431/(*NO_JIT)(a+)b/auto_callout,no_start_optimize,no_auto_possess
5432\= Expect no match
5433    aac\=callout_extra
5434
5435/(*NO_JIT)a+(?C'XXX')b/no_start_optimize,no_auto_possess
5436\= Expect no match
5437    aac\=callout_extra
5438
5439/\n/firstline
5440    xyz\nabc
5441
5442/\nabc/firstline
5443    xyz\nabc
5444
5445/\x{0a}abc/firstline,newline=crlf
5446\= Expect no match
5447    xyz\r\nabc
5448
5449/[abc]/firstline
5450\= Expect no match
5451    \na
5452
5453# These tests are matched in test 1 as they are Perl compatible. Here we are
5454# looking at what does and does not get auto-possessified.
5455
5456/(?(DEFINE)(?<optional_a>a?))^(?&optional_a)a$/B
5457
5458/(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/B
5459
5460/^(a?)b(?1)a/B
5461
5462/^(a?)+b(?1)a/B
5463
5464/^(a?)++b(?1)a/B
5465
5466/^(a?)+b/B
5467
5468/(?=a+)a(a+)++b/B
5469
5470/(?<=(?=.){4,5}x)/B
5471
5472# Perl behaves differently with these when optimization is turned off
5473
5474/a(*PRUNE:X)bc|qq/mark,no_start_optimize
5475\= Expect no match
5476    axy
5477
5478/a(*THEN:X)bc|qq/mark,no_start_optimize
5479\= Expect no match
5480    axy
5481
5482/(?^x-i)AB/
5483
5484/(?^-i)AB/
5485
5486/(?x-i-i)/
5487
5488/(?(?=^))b/I
5489    abc
5490
5491/(?(?=^)|)b/I
5492    abc
5493
5494/(?(?=^)|^)b/I
5495    bbc
5496\= Expect no match
5497    abc
5498
5499/(?(1)^|^())/I
5500
5501/(?(1)^())b/I
5502
5503/(?(1)^())+b/I,aftertext
5504    abc
5505
5506/(?(1)^()|^)+b/I,aftertext
5507    bbc
5508\= Expect no match
5509    abc
5510
5511/(?(1)^()|^)*b/I,aftertext
5512    bbc
5513    abc
5514    xbc
5515
5516/(?(1)^())+b/I,aftertext
5517    abc
5518
5519/(?(1)^a()|^a)+b/I,aftertext
5520    abc
5521\= Expect no match
5522    bbc
5523
5524/(?(1)^|^(a))+b/I,aftertext
5525    abc
5526\= Expect no match
5527    bbc
5528
5529/(?(1)^a()|^a)*b/I,aftertext
5530    abc
5531    bbc
5532    xbc
5533
5534/a(b)c|xyz/g,allvector,replace=<$0>
5535    abcdefabcpqr\=ovector=4
5536    abxyz\=ovector=4
5537    abcdefxyz\=ovector=4
5538
5539/a(b)c|xyz/allvector
5540    abcdef\=ovector=4
5541    abxyz\=ovector=4
5542
5543/a(b)c|xyz/g,replace=<$0>,substitute_callout
5544    abcdefabcpqr
5545    abxyzpqrabcxyz
5546    12abc34xyz99abc55\=substitute_stop=2
5547    12abc34xyz99abc55\=substitute_skip=1
5548    12abc34xyz99abc55\=substitute_skip=2
5549
5550/a(b)c|xyz/g,replace=<$0>
5551    abcdefabcpqr
5552    abxyzpqrabcxyz
5553    12abc34xyz\=substitute_stop=2
5554    12abc34xyz\=substitute_skip=1
5555
5556/a(b)c|xyz/replace=<$0>
5557    abcdefabcpqr
5558    12abc34xyz\=substitute_skip=1
5559    12abc34xyz\=substitute_stop=1
5560
5561/abc\rdef/
5562    abc\ndef
5563
5564/abc\rdef\x{0d}xyz/escaped_cr_is_lf
5565    abc\ndef\rxyz
5566\= Expect no match
5567    abc\ndef\nxyz
5568
5569/(?(*ACCEPT)xxx)/
5570
5571/(?(*atomic:xx)xxx)/
5572
5573/(?(*script_run:xxx)zzz)/
5574
5575/foobar/
5576    the foobar thing\=copy_matched_subject
5577    the foobar thing\=copy_matched_subject,zero_terminate
5578
5579/foobar/g
5580    the foobar thing foobar again\=copy_matched_subject
5581
5582/(*:XX)^abc/I
5583
5584/(*COMMIT:XX)^abc/I
5585
5586/(*ACCEPT:XX)^abc/I
5587
5588/abc/replace=xyz
5589    abc\=null_context
5590
5591/abc/replace=xyz,substitute_callout
5592    abc
5593\= Expect error message
5594    abc\=null_context
5595
5596/\[()]{65535}()/expand
5597
5598/\[()]{65535}(?<A>)/expand
5599
5600/a(?:(*ACCEPT))??bc/
5601    abc
5602    axy
5603
5604/a(*ACCEPT)??bc/
5605    abc
5606    axy
5607
5608/a(*ACCEPT:XX)??bc/mark
5609    abc
5610    axy
5611
5612/(*:\)?/
5613
5614/(*:\Q \E){5}/alt_verbnames
5615
5616/(?=abc)/I
5617
5618/(?|(X)|(XY))\1abc/I
5619
5620/(?|(a)|(bcde))(c)\2/I
5621
5622/(?|(a)|(bcde))(c)\1/I
5623
5624/(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'B'(?'A')/I,dupnames
5625
5626/(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'A'(?'A')/I,dupnames
5627
5628/((a|)+)+Z/I
5629
5630/((?=a))[abcd]/I
5631
5632/A(?:(*ACCEPT))?B/info
5633
5634/(A(*ACCEPT)??B)C/
5635    ABC
5636    AXY
5637
5638/(?<=(?<=a)b)c.*/I
5639    abc\=ph
5640\= Expect no match
5641    xbc\=ph
5642
5643/(?<=ab)c.*/I
5644    abc\=ph
5645\= Expect no match
5646    xbc\=ph
5647
5648/(?<=a(?<=a|a)c)/I
5649
5650/(?<=a(?<=a|ba)c)/I
5651
5652/(?<=(?<=a)b)(?<!abcd)/I
5653
5654/(?<=(?<=a)b)(?<!abcd)(?<=(?<=a)bcde)/I
5655
5656# Addition overflow
5657/( {32742} {42})(?<!\1{65481})/
5658
5659# Multiplication overflow
5660/(X{65535})(?<=\1{32770})/
5661
5662# ---- Non-atomic assertion tests ----
5663
5664# Expect error: not allowed as a condition
5665/(?(*napla:xx)bc)/
5666
5667/\A(*pla:.*\b(\w++))(?>.*?\b\1\b){3}/
5668    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
5669
5670/\A(*napla:.*\b(\w++))(?>.*?\b\1\b){3}/
5671    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
5672
5673/\A(?*.*\b(\w++))(?>.*?\b\1\b){3}/
5674    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
5675
5676/(*plb:(.)..|(.)...)(\1|\2)/
5677    abcdb\=offset=4
5678    abcda\=offset=4
5679
5680/(*naplb:(.)..|(.)...)(\1|\2)/
5681    abcdb\=offset=4
5682    abcda\=offset=4
5683
5684/(?<*(.)..|(.)...)(\1|\2)/
5685    abcdb\=offset=4
5686    abcda\=offset=4
5687
5688/(*non_atomic_positive_lookahead:ab)/B
5689
5690/(*non_atomic_positive_lookbehind:ab)/B
5691
5692/(*pla:ab+)/B
5693
5694/(*napla:ab+)/B
5695
5696/(*napla:)+/
5697
5698/(*naplb:)+/
5699
5700/(*napla:^x|^y)/I
5701
5702/(*napla:abc|abd)/I
5703
5704/(*napla:a|(.)(*ACCEPT)zz)\1../
5705    abcd
5706
5707/(*napla:a(*ACCEPT)zz|(.))\1../
5708    abcd
5709
5710/(*napla:a|(*COMMIT)(.))\1\1/
5711    aabc
5712\= Expect no match
5713    abbc
5714
5715/(*napla:a|(.))\1\1/
5716    aabc
5717    abbc
5718
5719# ----
5720
5721# Expect error (recursion => not fixed length)
5722/(\2)((?=(?<=\1)))/
5723
5724/c*+(?<=[bc])/
5725    abc\=ph
5726    ab\=ph
5727    abc\=ps
5728    ab\=ps
5729
5730/c++(?<=[bc])/
5731    abc\=ph
5732    ab\=ph
5733
5734/(?<=(?=.(?<=x)))/
5735    abx
5736    ab\=ph
5737    bxyz
5738    xyz
5739
5740/\z/
5741   abc\=ph
5742   abc\=ps
5743
5744/\Z/
5745   abc\=ph
5746   abc\=ps
5747   abc\n\=ph
5748   abc\n\=ps
5749
5750/(?![ab]).*/
5751    ab\=ph
5752
5753/c*+/
5754    ab\=ph,offset=2
5755
5756/\A\s*(a|(?:[^`]{28500}){4})/I
5757    a
5758
5759/\A\s*((?:[^`]{28500}){4})/I
5760
5761/\A\s*((?:[^`]{28500}){4}|a)/I
5762    a
5763
5764/(?<A>a)(?(<A>)b)((?<=b).*)/B
5765
5766/(?(1)b)((?<=b).*)/B
5767
5768/(?(R1)b)((?<=b).*)/B
5769
5770/(?(DEFINE)b)((?<=b).*)/B
5771
5772/(?(VERSION=10.4)b)((?<=b).*)/B
5773
5774/[aA]b[cC]/IB
5775
5776/[cc]abcd/I
5777
5778/[Cc]abcd/I
5779
5780/[c]abcd/I
5781
5782/(?:c|C)abcd/I
5783
5784/(a)?a/I
5785    manm
5786
5787/^(?|(\*)(*napla:\S*_(\2?+.+))|(\w)(?=\S*_(\2?+\1)))+_\2$/
5788    *abc_12345abc
5789
5790/^(?|(\*)(*napla:\S*_(\3?+.+))|(\w)(?=\S*_((\2?+\1))))+_\2$/
5791    *abc_12345abc
5792
5793/^((\1+)(?C)|\d)+133X$/
5794    111133X\=callout_capture
5795
5796/abc/replace=xyz,substitute_replacement_only
5797    123abc456
5798
5799/a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z,substitute_replacement_only
5800    "abcde-abcde-"
5801
5802/a(b)c|xyz/g,replace=<$0>,substitute_callout,substitute_replacement_only
5803    abcdefabcpqr
5804    abxyzpqrabcxyz
5805    12abc34xyz99abc55\=substitute_stop=2
5806    12abc34xyz99abc55\=substitute_skip=1
5807    12abc34xyz99abc55\=substitute_skip=2
5808
5809/a(..)d/replace=>$1<,substitute_matched
5810    xyzabcdxyzabcdxyz
5811    xyzabcdxyzabcdxyz\=ovector=2
5812\= Expect error
5813    xyzabcdxyzabcdxyz\=ovector=1
5814
5815/a(..)d/g,replace=>$1<,substitute_matched
5816    xyzabcdxyzabcdxyz
5817    xyzabcdxyzabcdxyz\=ovector=2
5818\= Expect error
5819    xyzabcdxyzabcdxyz\=ovector=1
5820    xyzabcdxyzabcdxyz\=ovector=1,substitute_unset_empty
5821
5822/55|a(..)d/g,replace=>$1<,substitute_matched
5823    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
5824\= Expect error
5825    xyz55abcdxyzabcdxyz\=ovector=2
5826
5827/55|a(..)d/replace=>$1<,substitute_matched
5828    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
5829
5830/55|a(..)d/replace=>$1<
5831    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
5832
5833/55|a(..)d/g,replace=>$1<
5834    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
5835
5836# Expect non-fixed-length error
5837
5838"(?<=X(?(DEFINE)(.*))(?1))."
5839
5840/\sxxx\s/tables=1
5841\= Expect no match
5842    AB\x{85}xxx\x{a0}XYZ
5843
5844/\sxxx\s/tables=2
5845    AB\x{85}xxx\x{a0}XYZ
5846
5847/^\w+/tables=2
5848    École
5849
5850/^\w+/tables=3
5851    École
5852
5853#loadtables ./testbtables
5854
5855/^\w+/tables=3
5856    École
5857
5858/"(*MARK:>" 00 "<).."/hex,mark,no_start_optimize
5859    AB
5860    A\=ph
5861\= Expect no match
5862    A
5863
5864/"(*MARK:>" 00 "<).(?C1)."/hex,mark,no_start_optimize
5865    AB
5866
5867/(?(VERSION=0.0/
5868
5869# Perl has made \K in lookarounds an error. At the moment PCRE2 still accepts.
5870
5871/(?=a\Kb)ab/
5872    ab
5873
5874/(?!a\Kb)ac/
5875    ac
5876
5877/^abc(?<=b\Kc)d/
5878    abcd
5879
5880/^abc(?<!b\Kq)d/
5881    abcd
5882
5883# ---------
5884
5885# End of testinput2
5886