• 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/\g6666666666/
2193
2194/[\g6666666666]/B
2195
2196/(?1)\c[/
2197
2198/.+A/newline=crlf
2199\= Expect no match
2200    \r\nA
2201
2202/\nA/newline=crlf
2203    \r\nA
2204
2205/[\r\n]A/newline=crlf
2206    \r\nA
2207
2208/(\r|\n)A/newline=crlf
2209    \r\nA
2210
2211/a(*CR)b/
2212
2213/(*CR)a.b/
2214    a\nb
2215\= Expect no match
2216    a\rb
2217
2218/(*CR)a.b/newline=lf
2219    a\nb
2220\= Expect no match
2221    a\rb
2222
2223/(*LF)a.b/newline=CRLF
2224    a\rb
2225\= Expect no match
2226    a\nb
2227
2228/(*CRLF)a.b/
2229    a\rb
2230    a\nb
2231\= Expect no match
2232    a\r\nb
2233
2234/(*ANYCRLF)a.b/newline=CR
2235\= Expect no match
2236    a\rb
2237    a\nb
2238    a\r\nb
2239
2240/(*ANY)a.b/newline=cr
2241\= Expect no match
2242    a\rb
2243    a\nb
2244    a\r\nb
2245    a\x85b
2246
2247/(*ANY).*/g
2248    abc\r\ndef
2249
2250/(*ANYCRLF).*/g
2251    abc\r\ndef
2252
2253/(*CRLF).*/g
2254    abc\r\ndef
2255
2256/(*NUL)^.*/
2257    a\nb\x00ccc
2258
2259/(*NUL)^.*/s
2260    a\nb\x00ccc
2261
2262/^x/m,newline=NUL
2263    ab\x00xy
2264
2265/'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex
2266    x\nyz
2267
2268/(*NUL)^X\NY/
2269    X\nY
2270    X\rY
2271\= Expect no match
2272    X\x00Y
2273
2274/a\Rb/I,bsr=anycrlf
2275    a\rb
2276    a\nb
2277    a\r\nb
2278\= Expect no match
2279    a\x85b
2280    a\x0bb
2281
2282/a\Rb/I,bsr=unicode
2283    a\rb
2284    a\nb
2285    a\r\nb
2286    a\x85b
2287    a\x0bb
2288
2289/a\R?b/I,bsr=anycrlf
2290    a\rb
2291    a\nb
2292    a\r\nb
2293\= Expect no match
2294    a\x85b
2295    a\x0bb
2296
2297/a\R?b/I,bsr=unicode
2298    a\rb
2299    a\nb
2300    a\r\nb
2301    a\x85b
2302    a\x0bb
2303
2304/a\R{2,4}b/I,bsr=anycrlf
2305    a\r\n\nb
2306    a\n\r\rb
2307    a\r\n\r\n\r\n\r\nb
2308\= Expect no match
2309    a\x85\x85b
2310    a\x0b\x0bb
2311
2312/a\R{2,4}b/I,bsr=unicode
2313    a\r\rb
2314    a\n\n\nb
2315    a\r\n\n\r\rb
2316    a\x85\x85b
2317    a\x0b\x0bb
2318\= Expect no match
2319    a\r\r\r\r\rb
2320
2321/(*BSR_ANYCRLF)a\Rb/I
2322    a\nb
2323    a\rb
2324
2325/(*BSR_UNICODE)a\Rb/I
2326    a\x85b
2327
2328/(*BSR_ANYCRLF)(*CRLF)a\Rb/I
2329    a\nb
2330    a\rb
2331
2332/(*CRLF)(*BSR_UNICODE)a\Rb/I
2333    a\x85b
2334
2335/(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
2336
2337/(?<a>)(?&)/
2338
2339/(?<abc>)(?&a)/
2340
2341/(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
2342
2343/(?+-a)/
2344
2345/(?-+a)/
2346
2347/(?(-1))/
2348
2349/(?(+10))/
2350
2351/(?(10))/
2352
2353/(?(+2))()()/
2354
2355/(?(2))()()/
2356
2357/\k''/
2358
2359/\k<>/
2360
2361/\k{}/
2362
2363/\k/
2364
2365/\kabc/
2366
2367/(?P=)/
2368
2369/(?P>)/
2370
2371/[[:foo:]]/
2372
2373/[[:1234:]]/
2374
2375/[[:f\oo:]]/
2376
2377/[[: :]]/
2378
2379/[[:...:]]/
2380
2381/[[:l\ower:]]/
2382
2383/[[:abc\:]]/
2384
2385/[abc[:x\]pqr:]]/
2386
2387/[[:a\dz:]]/
2388
2389/(^(a|b\g<-1'c))/
2390
2391/^(?+1)(?<a>x|y){0}z/
2392    xzxx
2393    yzyy
2394\= Expect no match
2395    xxz
2396
2397/(\3)(\1)(a)/
2398\= Expect no match
2399    cat
2400
2401/(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
2402    cat
2403
2404/TA]/
2405    The ACTA] comes
2406
2407/TA]/allow_empty_class,match_unset_backref,dupnames
2408    The ACTA] comes
2409
2410/(?2)[]a()b](abc)/
2411    abcbabc
2412
2413/(?2)[^]a()b](abc)/
2414    abcbabc
2415
2416/(?1)[]a()b](abc)/
2417    abcbabc
2418\= Expect no match
2419    abcXabc
2420
2421/(?1)[^]a()b](abc)/
2422    abcXabc
2423\= Expect no match
2424    abcbabc
2425
2426/(?2)[]a()b](abc)(xyz)/
2427    xyzbabcxyz
2428
2429/(?&N)[]a(?<N>)](?<M>abc)/
2430   abc<abc
2431
2432/(?&N)[]a(?<N>)](abc)/
2433   abc<abc
2434
2435/a[]b/
2436
2437/a[^]b/
2438
2439/a[]b/allow_empty_class,match_unset_backref,dupnames
2440\= Expect no match
2441    ab
2442
2443/a[]+b/allow_empty_class,match_unset_backref,dupnames
2444\= Expect no match
2445    ab
2446
2447/a[]*+b/allow_empty_class,match_unset_backref,dupnames
2448\= Expect no match
2449    ab
2450
2451/a[^]b/allow_empty_class,match_unset_backref,dupnames
2452    aXb
2453    a\nb
2454\= Expect no match
2455    ab
2456
2457/a[^]+b/allow_empty_class,match_unset_backref,dupnames
2458    aXb
2459    a\nX\nXb
2460\= Expect no match
2461    ab
2462
2463/a(?!)b/B
2464
2465/(?!)?a/B
2466    ab
2467
2468/a(*FAIL)+b/
2469
2470/(abc|pqr|123){0}[xyz]/I
2471
2472/(?(?=.*b)b|^)/I,auto_callout
2473   adc
2474   abc
2475
2476/(?(?=b).*b|^d)/I
2477
2478/(?(?=.*b).*b|^d)/I
2479
2480/xyz/auto_callout
2481  xyz
2482  abcxyz
2483\= Expect no match
2484  abc
2485  abcxypqr
2486
2487/xyz/auto_callout,no_start_optimize
2488  abcxyz
2489\= Expect no match
2490  abc
2491  abcxypqr
2492
2493/(*NO_START_OPT)xyz/auto_callout
2494  abcxyz
2495
2496/(*NO_AUTO_POSSESS)a+b/B
2497
2498/xyz/auto_callout,no_start_optimize
2499  abcxyz
2500
2501/^"((?(?=[a])[^"])|b)*"$/auto_callout
2502    "ab"
2503
2504/^"((?(?=[a])[^"])|b)*"$/
2505    "ab"
2506
2507/^X(?5)(a)(?|(b)|(q))(c)(d)Y/
2508    XYabcdY
2509
2510/^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)/
2511    XYabcdY
2512
2513/Xa{2,4}b/
2514    X\=ps
2515    Xa\=ps
2516    Xaa\=ps
2517    Xaaa\=ps
2518    Xaaaa\=ps
2519
2520/Xa{2,4}?b/
2521    X\=ps
2522    Xa\=ps
2523    Xaa\=ps
2524    Xaaa\=ps
2525    Xaaaa\=ps
2526
2527/Xa{2,4}+b/
2528    X\=ps
2529    Xa\=ps
2530    Xaa\=ps
2531    Xaaa\=ps
2532    Xaaaa\=ps
2533
2534/X\d{2,4}b/
2535    X\=ps
2536    X3\=ps
2537    X33\=ps
2538    X333\=ps
2539    X3333\=ps
2540
2541/X\d{2,4}?b/
2542    X\=ps
2543    X3\=ps
2544    X33\=ps
2545    X333\=ps
2546    X3333\=ps
2547
2548/X\d{2,4}+b/
2549    X\=ps
2550    X3\=ps
2551    X33\=ps
2552    X333\=ps
2553    X3333\=ps
2554
2555/X\D{2,4}b/
2556    X\=ps
2557    Xa\=ps
2558    Xaa\=ps
2559    Xaaa\=ps
2560    Xaaaa\=ps
2561
2562/X\D{2,4}?b/
2563    X\=ps
2564    Xa\=ps
2565    Xaa\=ps
2566    Xaaa\=ps
2567    Xaaaa\=ps
2568
2569/X\D{2,4}+b/
2570    X\=ps
2571    Xa\=ps
2572    Xaa\=ps
2573    Xaaa\=ps
2574    Xaaaa\=ps
2575
2576/X[abc]{2,4}b/
2577    X\=ps
2578    Xa\=ps
2579    Xaa\=ps
2580    Xaaa\=ps
2581    Xaaaa\=ps
2582
2583/X[abc]{2,4}?b/
2584    X\=ps
2585    Xa\=ps
2586    Xaa\=ps
2587    Xaaa\=ps
2588    Xaaaa\=ps
2589
2590/X[abc]{2,4}+b/
2591    X\=ps
2592    Xa\=ps
2593    Xaa\=ps
2594    Xaaa\=ps
2595    Xaaaa\=ps
2596
2597/X[^a]{2,4}b/
2598    X\=ps
2599    Xz\=ps
2600    Xzz\=ps
2601    Xzzz\=ps
2602    Xzzzz\=ps
2603
2604/X[^a]{2,4}?b/
2605    X\=ps
2606    Xz\=ps
2607    Xzz\=ps
2608    Xzzz\=ps
2609    Xzzzz\=ps
2610
2611/X[^a]{2,4}+b/
2612    X\=ps
2613    Xz\=ps
2614    Xzz\=ps
2615    Xzzz\=ps
2616    Xzzzz\=ps
2617
2618/(Y)X\1{2,4}b/
2619    YX\=ps
2620    YXY\=ps
2621    YXYY\=ps
2622    YXYYY\=ps
2623    YXYYYY\=ps
2624
2625/(Y)X\1{2,4}?b/
2626    YX\=ps
2627    YXY\=ps
2628    YXYY\=ps
2629    YXYYY\=ps
2630    YXYYYY\=ps
2631
2632/(Y)X\1{2,4}+b/
2633    YX\=ps
2634    YXY\=ps
2635    YXYY\=ps
2636    YXYYY\=ps
2637    YXYYYY\=ps
2638
2639/\++\KZ|\d+X|9+Y/startchar
2640    ++++123999\=ps
2641    ++++123999Y\=ps
2642    ++++Z1234\=ps
2643
2644/Z(*F)/
2645\= Expect no match
2646    Z\=ps
2647    ZA\=ps
2648
2649/Z(?!)/
2650\= Expect no match
2651    Z\=ps
2652    ZA\=ps
2653
2654/dog(sbody)?/
2655    dogs\=ps
2656    dogs\=ph
2657
2658/dog(sbody)??/
2659    dogs\=ps
2660    dogs\=ph
2661
2662/dog|dogsbody/
2663    dogs\=ps
2664    dogs\=ph
2665
2666/dogsbody|dog/
2667    dogs\=ps
2668    dogs\=ph
2669
2670/\bthe cat\b/
2671    the cat\=ps
2672    the cat\=ph
2673
2674/abc/
2675   abc\=ps
2676   abc\=ph
2677
2678/abc\K123/startchar
2679    xyzabc123pqr
2680    xyzabc12\=ps
2681    xyzabc12\=ph
2682
2683/(?<=abc)123/
2684    xyzabc123pqr
2685    xyzabc12\=ps
2686    xyzabc12\=ph
2687
2688/\babc\b/
2689    +++abc+++
2690    +++ab\=ps
2691    +++ab\=ph
2692
2693/(?&word)(?&element)(?(DEFINE)(?<element><[^m][^>]>[^<])(?<word>\w*+))/B
2694
2695/(?&word)(?&element)(?(DEFINE)(?<element><[^\d][^>]>[^<])(?<word>\w*+))/B
2696
2697/(ab)(x(y)z(cd(*ACCEPT)))pq/B
2698
2699/abc\K/aftertext,startchar
2700    abcdef
2701    abcdef\=notempty_atstart
2702    xyzabcdef\=notempty_atstart
2703\= Expect no match
2704    abcdef\=notempty
2705    xyzabcdef\=notempty
2706
2707/^(?:(?=abc)|abc\K)/aftertext,startchar
2708    abcdef
2709    abcdef\=notempty_atstart
2710\= Expect no match
2711    abcdef\=notempty
2712
2713/a?b?/aftertext
2714    xyz
2715    xyzabc
2716    xyzabc\=notempty
2717    xyzabc\=notempty_atstart
2718    xyz\=notempty_atstart
2719\= Expect no match
2720    xyz\=notempty
2721
2722/^a?b?/aftertext
2723    xyz
2724    xyzabc
2725\= Expect no match
2726    xyzabc\=notempty
2727    xyzabc\=notempty_atstart
2728    xyz\=notempty_atstart
2729    xyz\=notempty
2730
2731/^(?<name>a|b\g<name>c)/
2732    aaaa
2733    bacxxx
2734    bbaccxxx
2735    bbbacccxx
2736
2737/^(?<name>a|b\g'name'c)/
2738    aaaa
2739    bacxxx
2740    bbaccxxx
2741    bbbacccxx
2742
2743/^(a|b\g<1>c)/
2744    aaaa
2745    bacxxx
2746    bbaccxxx
2747    bbbacccxx
2748
2749/^(a|b\g'1'c)/
2750    aaaa
2751    bacxxx
2752    bbaccxxx
2753    bbbacccxx
2754
2755/^(a|b\g'-1'c)/
2756    aaaa
2757    bacxxx
2758    bbaccxxx
2759    bbbacccxx
2760
2761/(^(a|b\g<-1>c))/
2762    aaaa
2763    bacxxx
2764    bbaccxxx
2765    bbbacccxx
2766
2767/(?-i:\g<name>)(?i:(?<name>a))/
2768    XaaX
2769    XAAX
2770
2771/(?i:\g<name>)(?-i:(?<name>a))/
2772    XaaX
2773\= Expect no match
2774    XAAX
2775
2776/(?-i:\g<+1>)(?i:(a))/
2777    XaaX
2778    XAAX
2779
2780/(?=(?<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>\})\}))\{/
2781
2782/(?<n>a|b|c)\g<n>*/
2783   abc
2784   accccbbb
2785
2786/^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)/
2787    XYabcdY
2788
2789/(?<=b(?1)|zzz)(a)/
2790    xbaax
2791    xzzzax
2792
2793/(a)(?<=b\1)/
2794
2795/(a)(?<=b+(?1))/
2796
2797/(a+)(?<=b(?1))/
2798
2799/(a(?<=b(?1)))/
2800
2801/(?<=b(?1))xyz/
2802
2803/(?<=b(?1))xyz(b+)pqrstuvew/
2804
2805/(a|bc)\1/I
2806
2807/(a|bc)\1{2,3}/I
2808
2809/(a|bc)(?1)/I
2810
2811/(a|b\1)(a|b\1)/I
2812
2813/(a|b\1){2}/I
2814
2815/(a|bbbb\1)(a|bbbb\1)/I
2816
2817/(a|bbbb\1){2}/I
2818
2819/^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
2820
2821/<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
2822
2823"(?>.*/)foo"I
2824
2825/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /Ix
2826
2827/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/Ii
2828
2829/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/I
2830
2831/<a[\s]+href[\s]*=[\s]*          # find <a href=
2832 ([\"\'])?                       # find single or double quote
2833 (?(1) (.*?)\1 | ([^\s]+))       # if quote found, match up to next matching
2834                                 # quote, otherwise match up to next space
2835/Iisx
2836
2837/^(?!:)                       # colon disallowed at start
2838  (?:                         # start of item
2839    (?: [0-9a-f]{1,4} |       # 1-4 hex digits or
2840    (?(1)0 | () ) )           # if null previously matched, fail; else null
2841    :                         # followed by colon
2842  ){1,7}                      # end item; 1-7 of them required
2843  [0-9a-f]{1,4} $             # final hex number at end of string
2844  (?(1)|.)                    # check that there was an empty component
2845  /Iix
2846
2847/(?|(?<a>A)|(?<a>B))/I
2848    AB\=copy=a
2849    BA\=copy=a
2850
2851/(?|(?<a>A)|(?<b>B))/
2852
2853/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |
2854    b(?<quote> (?<apostrophe>')|(?<realquote>")) )
2855    (?('quote')[a-z]+|[0-9]+)/Ix,dupnames
2856    a"aaaaa
2857    b"aaaaa
2858\= Expect no match
2859    b"11111
2860    a"11111
2861
2862/^(?|(a)(b)(c)(?<D>d)|(?<D>e)) (?('D')X|Y)/IBx,dupnames
2863    abcdX
2864    eX
2865\= Expect no match
2866    abcdY
2867    ey
2868
2869/(?<A>a) (b)(c)  (?<A>d  (?(R&A)$ | (?4)) )/IBx,dupnames
2870    abcdd
2871\= Expect no match
2872    abcdde
2873
2874/abcd*/
2875    xxxxabcd\=ps
2876    xxxxabcd\=ph
2877
2878/abcd*/i
2879    xxxxabcd\=ps
2880    xxxxabcd\=ph
2881    XXXXABCD\=ps
2882    XXXXABCD\=ph
2883
2884/abc\d*/
2885    xxxxabc1\=ps
2886    xxxxabc1\=ph
2887
2888/(a)bc\1*/
2889    xxxxabca\=ps
2890    xxxxabca\=ph
2891
2892/abc[de]*/
2893    xxxxabcde\=ps
2894    xxxxabcde\=ph
2895
2896/(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
2897    cat
2898
2899/(\3)(\1)(a)/I,allow_empty_class,match_unset_backref,dupnames
2900    cat
2901
2902/(\3)(\1)(a)/I
2903\= Expect no match
2904    cat
2905
2906/i(?(DEFINE)(?<s>a))/I
2907    i
2908
2909/()i(?(1)a)/I
2910    ia
2911
2912/(?i)a(?-i)b|c/B
2913    XabX
2914    XAbX
2915    CcC
2916\= Expect no match
2917    XABX
2918
2919/(?i)a(?s)b|c/B
2920
2921/(?i)a(?s-i)b|c/B
2922
2923/^(ab(c\1)d|x){2}$/B
2924    xabcxd
2925
2926/^(?&t)*+(?(DEFINE)(?<t>.))$/B
2927
2928/^(?&t)*(?(DEFINE)(?<t>.))$/B
2929
2930# This one is here because Perl gives the match as "b" rather than "ab". I
2931# believe this to be a Perl bug.
2932
2933/(?>a\Kb)z|(ab)/
2934    ab\=startchar
2935
2936/(?P<L1>(?P<L2>0|)|(?P>L2)(?P>L1))/
2937    abcd
2938    0abc
2939
2940/abc(*MARK:)pqr/
2941
2942/abc(*:)pqr/
2943
2944/(*COMMIT:X)/B
2945
2946# This should, and does, fail. In Perl, it does not, which I think is a
2947# bug because replacing the B in the pattern by (B|D) does make it fail.
2948# Turning off Perl's optimization by inserting (??{""}) also makes it fail.
2949
2950/A(*COMMIT)B/aftertext,mark
2951\= Expect no match
2952    ACABX
2953
2954# These should be different, but in Perl they are not, which I think
2955# is a bug in Perl.
2956
2957/A(*THEN)B|A(*THEN)C/mark
2958    AC
2959
2960/A(*PRUNE)B|A(*PRUNE)C/mark
2961\= Expect no match
2962    AC
2963
2964# Mark names can be duplicated. Perl doesn't give a mark for this one,
2965# though PCRE2 does.
2966
2967/^A(*:A)B|^X(*:A)Y/mark
2968\= Expect no match
2969    XAQQ
2970
2971# COMMIT at the start of a pattern should be the same as an anchor. Perl
2972# optimizations defeat this. So does the PCRE2 optimization unless we disable
2973# it.
2974
2975/(*COMMIT)ABC/
2976    ABCDEFG
2977
2978/(*COMMIT)ABC/no_start_optimize
2979\= Expect no match
2980    DEFGABC
2981
2982/^(ab (c+(*THEN)cd) | xyz)/x
2983\= Expect no match
2984    abcccd
2985
2986/^(ab (c+(*PRUNE)cd) | xyz)/x
2987\= Expect no match
2988    abcccd
2989
2990/^(ab (c+(*FAIL)cd) | xyz)/x
2991\= Expect no match
2992    abcccd
2993
2994# Perl gets some of these wrong
2995
2996/(?>.(*ACCEPT))*?5/
2997    abcde
2998
2999/(.(*ACCEPT))*?5/
3000    abcde
3001
3002/(.(*ACCEPT))5/
3003    abcde
3004
3005/(.(*ACCEPT))*5/
3006    abcde
3007
3008/A\NB./B
3009    ACBD
3010\= Expect no match
3011    A\nB
3012    ACB\n
3013
3014/A\NB./Bs
3015    ACBD
3016    ACB\n
3017\= Expect no match
3018    A\nB
3019
3020/A\NB/newline=crlf
3021    A\nB
3022    A\rB
3023\= Expect no match
3024    A\r\nB
3025
3026/\R+b/B
3027
3028/\R+\n/B
3029
3030/\R+\d/B
3031
3032/\d*\R/B
3033
3034/\s*\R/B
3035    \x20\x0a
3036    \x20\x0d
3037    \x20\x0d\x0a
3038
3039/\S*\R/B
3040    a\x0a
3041
3042/X\h*\R/B
3043    X\x20\x0a
3044
3045/X\H*\R/B
3046    X\x0d\x0a
3047
3048/X\H+\R/B
3049    X\x0d\x0a
3050
3051/X\H++\R/B
3052\= Expect no match
3053    X\x0d\x0a
3054
3055/(?<=abc)def/
3056    abc\=ph
3057
3058/abc$/
3059    abc
3060    abc\=ps
3061    abc\=ph
3062
3063/abc$/m
3064    abc
3065    abc\n
3066    abc\=ph
3067    abc\n\=ph
3068    abc\=ps
3069    abc\n\=ps
3070
3071/abc\z/
3072    abc
3073    abc\=ps
3074    abc\=ph
3075
3076/abc\Z/
3077    abc
3078    abc\=ps
3079    abc\=ph
3080
3081/abc\b/
3082    abc
3083    abc\=ps
3084    abc\=ph
3085
3086/abc\B/
3087    abc\=ps
3088    abc\=ph
3089\= Expect no match
3090    abc
3091
3092/.+/
3093\= Bad offsets
3094    abc\=offset=4
3095    abc\=offset=-4
3096\= Valid data
3097    abc\=offset=0
3098    abc\=offset=1
3099    abc\=offset=2
3100\= Expect no match
3101    abc\=offset=3
3102
3103/^\cģ/
3104
3105/(?P<abn>(?P=abn)xxx)/B
3106
3107/(a\1z)/B
3108
3109/(?P<abn>(?P=abn)(?<badstufxxx)/B
3110
3111/(?P<abn>(?P=axn)xxx)/B
3112
3113/(?P<abn>(?P=axn)xxx)(?<axn>yy)/B
3114
3115# These tests are here because Perl gets the first one wrong.
3116
3117/(\R*)(.)/s
3118    \r\n
3119    \r\r\n\n\r
3120    \r\r\n\n\r\n
3121
3122/(\R)*(.)/s
3123    \r\n
3124    \r\r\n\n\r
3125    \r\r\n\n\r\n
3126
3127/((?>\r\n|\n|\x0b|\f|\r|\x85)*)(.)/s
3128    \r\n
3129    \r\r\n\n\r
3130    \r\r\n\n\r\n
3131
3132# -------------
3133
3134/^abc$/B
3135
3136/^abc$/Bm
3137
3138/^(a)*+(\w)/
3139    aaaaX
3140\= Expect no match
3141    aaaa
3142
3143/^(?:a)*+(\w)/
3144    aaaaX
3145\= Expect no match
3146    aaaa
3147
3148/(a)++1234/IB
3149
3150/([abc])++1234/I
3151
3152/(?<=(abc)+)X/
3153
3154/(^ab)/I
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/(?=a)[bcd]/I
3187
3188/((?=a))[bcd]/I
3189
3190/((?=a))+[bcd]/I
3191
3192/((?=a))++[bcd]/I
3193
3194/(?=a+)[bcd]/Ii
3195
3196/(?=a+?)[bcd]/Ii
3197
3198/(?=a++)[bcd]/Ii
3199
3200/(?=a{3})[bcd]/Ii
3201
3202/(abc)\1+/
3203
3204# Perl doesn't get these right IMO (the 3rd is PCRE2-specific)
3205
3206/(?1)(?:(b(*ACCEPT))){0}/
3207    b
3208
3209/(?1)(?:(b(*ACCEPT))){0}c/
3210    bc
3211\= Expect no match
3212    b
3213
3214/(?1)(?:((*ACCEPT))){0}c/
3215    c
3216    c\=notempty
3217
3218/^.*?(?(?=a)a|b(*THEN)c)/
3219\= Expect no match
3220    ba
3221
3222/^.*?(?(?=a)a|bc)/
3223    ba
3224
3225/^.*?(?(?=a)a(*THEN)b|c)/
3226\= Expect no match
3227    ac
3228
3229/^.*?(?(?=a)a(*THEN)b)c/
3230\= Expect no match
3231    ac
3232
3233/^.*?(a(*THEN)b)c/
3234\= Expect no match
3235    aabc
3236
3237/^.*? (?1) c (?(DEFINE)(a(*THEN)b))/x
3238    aabc
3239
3240/^.*?(a(*THEN)b|z)c/
3241    aabc
3242
3243/^.*?(z|a(*THEN)b)c/
3244    aabc
3245
3246# These are here because they are not Perl-compatible; the studying means the
3247# mark is not seen.
3248
3249/(*MARK:A)(*SKIP:B)(C|X)/mark
3250    C
3251\= Expect no match
3252    D
3253
3254/(*:A)A+(*SKIP:A)(B|Z)/mark
3255\= Expect no match
3256    AAAC
3257
3258# ----------------------------
3259
3260"(?=a*(*ACCEPT)b)c"
3261    c
3262    c\=notempty
3263
3264/(?1)c(?(DEFINE)((*ACCEPT)b))/
3265    c
3266    c\=notempty
3267
3268/(?>(*ACCEPT)b)c/
3269    c
3270\= Expect no match
3271    c\=notempty
3272
3273/(?:(?>(a)))+a%/allaftertext
3274    %aa%
3275
3276/(a)b|ac/allaftertext
3277    ac\=ovector=1
3278
3279/(a)(b)x|abc/allaftertext
3280     abc\=ovector=2
3281
3282/(a)bc|(a)(b)\2/
3283    abc\=ovector=1
3284    abc\=ovector=2
3285    aba\=ovector=1
3286    aba\=ovector=2
3287    aba\=ovector=3
3288    aba\=ovector=4
3289
3290/(?(DEFINE)(a(?2)|b)(b(?1)|a))(?:(?1)|(?2))/I
3291
3292/(a(?2)|b)(b(?1)|a)(?:(?1)|(?2))/I
3293
3294/(a(?2)|b)(b(?1)|a)(?1)(?2)/I
3295
3296/(abc)(?1)/I
3297
3298/(?:(foo)|(bar)|(baz))X/allcaptures
3299    bazfooX
3300    foobazbarX
3301    barfooX
3302    bazX
3303    foobarbazX
3304    bazfooX\=ovector=0
3305    bazfooX\=ovector=1
3306    bazfooX\=ovector=2
3307    bazfooX\=ovector=3
3308
3309/(?=abc){3}abc/B
3310
3311/(?=abc)+abc/B
3312
3313/(?=abc)++abc/B
3314
3315/(?=abc){0}xyz/B
3316
3317/(?=(a))?./B
3318
3319/(?=(a))??./B
3320
3321/^(?=(a)){0}b(?1)/B
3322
3323/(?(DEFINE)(a))?b(?1)/B
3324
3325/^(?=(?1))?[az]([abc])d/B
3326
3327/^(?!a){0}\w+/B
3328
3329/(?<=(abc))?xyz/B
3330
3331/[:a[:abc]b:]/B
3332
3333/^(a(*:A)(d|e(*:B))z|aeq)/auto_callout
3334    adz
3335    aez
3336    aeqwerty
3337
3338/.(*F)/
3339\= Expect no match
3340    abc\=ph
3341
3342/\btype\b\W*?\btext\b\W*?\bjavascript\b/I
3343
3344/\btype\b\W*?\btext\b\W*?\bjavascript\b|\burl\b\W*?\bshell:|<input\b.*?\btype\b\W*?\bimage\b|\bonkeyup\b\W*?\=/I
3345
3346/a(*SKIP)c|b(*ACCEPT)|/I,aftertext
3347    a
3348
3349/a(*SKIP)c|b(*ACCEPT)cd(*ACCEPT)|x/I
3350    ax
3351
3352'a*(*ACCEPT)b'aftertext
3353    abc\=notempty_atstart
3354    bbb\=notempty_atstart
3355\= Expect no match
3356    \=notempty_atstart
3357
3358/(*ACCEPT)a/I,aftertext
3359    bax
3360
3361/z(*ACCEPT)a/I,aftertext
3362    baxzbx
3363
3364/^(?>a+)(?>(z+))\w/B
3365    aaaazzzzb
3366\= Expect no match
3367    aazz
3368
3369/(.)(\1|a(?2))/
3370    bab
3371
3372/\1|(.)(?R)\1/
3373    cbbbc
3374
3375/(.)((?(1)c|a)|a(?2))/
3376\= Expect no match
3377    baa
3378
3379/(?P<abn>(?P=abn)xxx)/B
3380
3381/(a\1z)/B
3382
3383/^a\x41z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3384    aAz
3385\= Expect no match
3386    ax41z
3387
3388/^a[m\x41]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3389    aAz
3390
3391/^a\x1z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3392    ax1z
3393
3394/^a\u0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3395    aAz
3396\= Expect no match
3397    au0041z
3398
3399/^a[m\u0041]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3400    aAz
3401
3402/^a\u041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3403    au041z
3404\= Expect no match
3405    aAz
3406
3407/^a\U0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3408    aU0041z
3409\= Expect no match
3410    aAz
3411
3412/^\u{7a}/alt_bsux
3413    u{7a}
3414\= Expect no match
3415    zoo
3416
3417/^\u{7a}/extra_alt_bsux
3418    zoo
3419
3420/(?(?=c)c|d)++Y/B
3421
3422/(?(?=c)c|d)*+Y/B
3423
3424/a[\NB]c/
3425    aNc
3426
3427/a[B-\Nc]/
3428
3429/a[B\Nc]/
3430
3431/(a)(?2){0,1999}?(b)/
3432
3433/(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/
3434
3435# This test, with something more complicated than individual letters, causes
3436# different behaviour in Perl. Perhaps it disables some optimization; no tag is
3437# passed back for the failures, whereas in PCRE2 there is a tag.
3438
3439/(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/x,mark
3440    AABC
3441    XXYZ
3442\= Expect no match
3443    XAQQ
3444    XAQQXZZ
3445    AXQQQ
3446    AXXQQQ
3447
3448# Perl doesn't give marks for these, though it does if the alternatives are
3449# replaced by single letters.
3450
3451/(b|q)(*:m)f|a(*:n)w/mark
3452    aw
3453\= Expect no match
3454    abc
3455
3456/(q|b)(*:m)f|a(*:n)w/mark
3457    aw
3458\= Expect no match
3459    abc
3460
3461# After a partial match, the behaviour is as for a failure.
3462
3463/^a(*:X)bcde/mark
3464   abc\=ps
3465
3466# These are here because Perl doesn't return a mark, except for the first.
3467
3468/(?=(*:x))(q|)/aftertext,mark
3469    abc
3470
3471/(?=(*:x))((*:y)q|)/aftertext,mark
3472    abc
3473
3474/(?=(*:x))(?:(*:y)q|)/aftertext,mark
3475    abc
3476
3477/(?=(*:x))(?>(*:y)q|)/aftertext,mark
3478    abc
3479
3480/(?=a(*:x))(?!a(*:y)c)/aftertext,mark
3481    ab
3482
3483/(?=a(*:x))(?=a(*:y)c|)/aftertext,mark
3484    ab
3485
3486/(..)\1/
3487    ab\=ps
3488    aba\=ps
3489    abab\=ps
3490
3491/(..)\1/i
3492    ab\=ps
3493    abA\=ps
3494    aBAb\=ps
3495
3496/(..)\1{2,}/
3497    ab\=ps
3498    aba\=ps
3499    abab\=ps
3500    ababa\=ps
3501    ababab\=ps
3502    ababab\=ph
3503    abababa\=ps
3504    abababa\=ph
3505
3506/(..)\1{2,}/i
3507    ab\=ps
3508    aBa\=ps
3509    aBAb\=ps
3510    AbaBA\=ps
3511    abABAb\=ps
3512    aBAbaB\=ph
3513    abABabA\=ps
3514    abaBABa\=ph
3515
3516/(..)\1{2,}?x/i
3517    ab\=ps
3518    abA\=ps
3519    aBAb\=ps
3520    abaBA\=ps
3521    abAbaB\=ps
3522    abaBabA\=ps
3523    abAbABaBx\=ps
3524
3525/^(..)\1/
3526    aba\=ps
3527
3528/^(..)\1{2,3}x/
3529    aba\=ps
3530    ababa\=ps
3531    ababa\=ph
3532    abababx
3533    ababababx
3534
3535/^(..)\1{2,3}?x/
3536    aba\=ps
3537    ababa\=ps
3538    ababa\=ph
3539    abababx
3540    ababababx
3541
3542/^(..)(\1{2,3})ab/
3543    abababab
3544
3545/^\R/
3546    \r\=ps
3547    \r\=ph
3548
3549/^\R{2,3}x/
3550    \r\=ps
3551    \r\=ph
3552    \r\r\=ps
3553    \r\r\=ph
3554    \r\r\r\=ps
3555    \r\r\r\=ph
3556    \r\rx
3557    \r\r\rx
3558
3559/^\R{2,3}?x/
3560    \r\=ps
3561    \r\=ph
3562    \r\r\=ps
3563    \r\r\=ph
3564    \r\r\r\=ps
3565    \r\r\r\=ph
3566    \r\rx
3567    \r\r\rx
3568
3569/^\R?x/
3570    \r\=ps
3571    \r\=ph
3572    x
3573    \rx
3574
3575/^\R+x/
3576    \r\=ps
3577    \r\=ph
3578    \r\n\=ps
3579    \r\n\=ph
3580    \rx
3581
3582/^a$/newline=crlf
3583    a\r\=ps
3584    a\r\=ph
3585
3586/^a$/m,newline=crlf
3587    a\r\=ps
3588    a\r\=ph
3589
3590/^(a$|a\r)/newline=crlf
3591    a\r\=ps
3592    a\r\=ph
3593
3594/^(a$|a\r)/m,newline=crlf
3595    a\r\=ps
3596    a\r\=ph
3597
3598/./newline=crlf
3599    \r\=ps
3600    \r\=ph
3601
3602/.{2,3}/newline=crlf
3603    \r\=ps
3604    \r\=ph
3605    \r\r\=ps
3606    \r\r\=ph
3607    \r\r\r\=ps
3608    \r\r\r\=ph
3609
3610/.{2,3}?/newline=crlf
3611    \r\=ps
3612    \r\=ph
3613    \r\r\=ps
3614    \r\r\=ph
3615    \r\r\r\=ps
3616    \r\r\r\=ph
3617
3618"AB(C(D))(E(F))?(?(?=\2)(?=\4))"
3619    ABCDGHI\=ovector=01
3620
3621# These are all run as real matches in test 1; here we are just checking the
3622# settings of the anchored and startline bits.
3623
3624/(?>.*?a)(?<=ba)/I
3625
3626/(?:.*?a)(?<=ba)/I
3627
3628/.*?a(*PRUNE)b/I
3629
3630/.*?a(*PRUNE)b/Is
3631
3632/^a(*PRUNE)b/Is
3633
3634/.*?a(*SKIP)b/I
3635
3636/(?>.*?a)b/Is
3637
3638/(?>.*?a)b/I
3639
3640/(?>^a)b/Is
3641
3642/(?>.*?)(?<=(abcd)|(wxyz))/I
3643
3644/(?>.*)(?<=(abcd)|(wxyz))/I
3645
3646"(?>.*)foo"I
3647
3648"(?>.*?)foo"I
3649
3650/(?>^abc)/Im
3651
3652/(?>.*abc)/Im
3653
3654/(?:.*abc)/Im
3655
3656/(?:(a)+(?C1)bb|aa(?C2)b)/
3657    aab\=callout_capture
3658
3659/(?:(a)++(?C1)bb|aa(?C2)b)/
3660    aab\=callout_capture
3661
3662/(?:(?>(a))(?C1)bb|aa(?C2)b)/
3663    aab\=callout_capture
3664
3665/(?:(?1)(?C1)x|ab(?C2))((a)){0}/
3666    aab\=callout_capture
3667
3668/(?1)(?C1)((a)(?C2)){0}/
3669    aab\=callout_capture
3670
3671/(?:(a)+(?C1)bb|aa(?C2)b)++/
3672    aab\=callout_capture
3673    aab\=callout_capture,ovector=1
3674
3675/(ab)x|ab/
3676    ab\=ovector=0
3677    ab\=ovector=1
3678
3679/(?<=123)(*MARK:xx)abc/mark
3680    xxxx123a\=ph
3681    xxxx123a\=ps
3682
3683/123\Kabc/startchar
3684    xxxx123a\=ph
3685    xxxx123a\=ps
3686
3687/^(?(?=a)aa|bb)/auto_callout
3688    bb
3689
3690/(?C1)^(?C2)(?(?C99)(?=(?C3)a(?C4))(?C5)a(?C6)a(?C7)|(?C8)b(?C9)b(?C10))(?C11)/
3691    bb
3692
3693# Perl seems to have a bug with this one.
3694
3695/aaaaa(*COMMIT)(*PRUNE)b|a+c/
3696    aaaaaac
3697
3698# Here are some that Perl treats differently because of the way it handles
3699# backtracking verbs.
3700
3701/(?!a(*COMMIT)b)ac|ad/
3702     ac
3703     ad
3704
3705/^(?!a(*THEN)b|ac)../
3706     ad
3707\= Expect no match
3708     ac
3709
3710/^(?=a(*THEN)b|ac)/
3711    ac
3712
3713/\A.*?(?:a|b(*THEN)c)/
3714    ba
3715
3716/\A.*?(?:a|b(*THEN)c)++/
3717    ba
3718
3719/\A.*?(?:a|b(*THEN)c|d)/
3720    ba
3721
3722/(?:(a(*MARK:X)a+(*SKIP:X)b)){0}(?:(?1)|aac)/
3723    aac
3724
3725/\A.*?(a|b(*THEN)c)/
3726    ba
3727
3728/^(A(*THEN)B|A(*THEN)D)/
3729    AD
3730
3731/(?!b(*THEN)a)bn|bnn/
3732    bnn
3733
3734/(?(?=b(*SKIP)a)bn|bnn)/
3735    bnn
3736
3737/(?=b(*THEN)a|)bn|bnn/
3738    bnn
3739
3740# This test causes a segfault with Perl 5.18.0
3741
3742/^(?=(a)){0}b(?1)/
3743    backgammon
3744
3745/(?|(?<n>f)|(?<n>b))/I,dupnames
3746
3747/(?<a>abc)(?<a>z)\k<a>()/IB,dupnames
3748
3749/a*[bcd]/B
3750
3751/[bcd]*a/B
3752
3753# A complete set of tests for auto-possessification of character types, but
3754# omitting \C because it might be disabled (it has its own tests).
3755
3756/\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
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/\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
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/\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
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/\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
3769
3770/\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
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/\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
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/ 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
3779
3780/\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
3781
3782/ .+\D  .+\d  .+\S  .+\s  .+\W  .+\w  .+.  .+\R  .+\H  .+\h  .+\V  .+\v  .+\Z  .+\z  .+$/Bx
3783
3784/ .+\D  .+\d  .+\S  .+\s  .+\W  .+\w  .+.  .+\R  .+\H  .+\h  .+\V  .+\v  .+\Z  .+\z  .+$/Bsx
3785
3786/ \D+$  \d+$  \S+$  \s+$  \W+$  \w+$  \R+$  \H+$  \h+$  \V+$ \v+$  a+$   \n+$  .+$  .+$/Bmx
3787
3788/(?=a+)a(a+)++a/B
3789
3790/a+(bb|cc)a+(?:bb|cc)a+(?>bb|cc)a+(?:bb|cc)+a+(aa)a+(?:bb|aa)/B
3791
3792/a+(bb|cc)?#a+(?:bb|cc)??#a+(?:bb|cc)?+#a+(?:bb|cc)*#a+(bb|cc)?a#a+(?:aa)?/B
3793
3794/a+(?:bb)?a#a+(?:|||)#a+(?:|b)a#a+(?:|||)?a/B
3795
3796/[ab]*/B
3797    aaaa
3798
3799/[ab]*?/B
3800    aaaa
3801
3802/[ab]?/B
3803    aaaa
3804
3805/[ab]??/B
3806    aaaa
3807
3808/[ab]+/B
3809    aaaa
3810
3811/[ab]+?/B
3812    aaaa
3813
3814/[ab]{2,3}/B
3815    aaaa
3816
3817/[ab]{2,3}?/B
3818    aaaa
3819
3820/[ab]{2,}/B
3821    aaaa
3822
3823/[ab]{2,}?/B
3824    aaaa
3825
3826/\d+\s{0,5}=\s*\S?=\w{0,4}\W*/B
3827
3828/[a-d]{5,12}[e-z0-9]*#[^a-z]+[b-y]*a[2-7]?[^0-9a-z]+/B
3829
3830/[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
3831
3832/a+(aa|bb)*c#a*(bb|cc)*a#a?(bb|cc)*d#[a-f]*(g|hh)*f/B
3833
3834/[a-f]*(g|hh|i)*i#[a-x]{4,}(y{0,6})*y#[a-k]+(ll|mm)+n/B
3835
3836/[a-f]*(?>gg|hh)+#[a-f]*(?>gg|hh)?#[a-f]*(?>gg|hh)*a#[a-f]*(?>gg|hh)*h/B
3837
3838/[a-c]*d/IB
3839
3840/[a-c]+d/IB
3841
3842/[a-c]?d/IB
3843
3844/[a-c]{4,6}d/IB
3845
3846/[a-c]{0,6}d/IB
3847
3848# End of special auto-possessive tests
3849
3850/^A\o{1239}B/
3851    A\123B
3852
3853/^A\oB/
3854
3855/^A\x{zz}B/
3856
3857/^A\x{12Z/
3858
3859/^A\x{/
3860
3861/[ab]++/B,no_auto_possess
3862
3863/[^ab]*+/B,no_auto_possess
3864
3865/a{4}+/B,no_auto_possess
3866
3867/a{4}+/Bi,no_auto_possess
3868
3869/[a-[:digit:]]+/
3870
3871/[A-[:digit:]]+/
3872
3873/[a-[.xxx.]]+/
3874
3875/[a-[=xxx=]]+/
3876
3877/[a-[!xxx!]]+/
3878
3879/[A-[!xxx!]]+/
3880    A]]]
3881
3882/[a-\d]+/
3883
3884/(?<0abc>xx)/
3885
3886/(?&1abc)xx(?<1abc>y)/
3887
3888/(?<ab-cd>xx)/
3889
3890/(?'0abc'xx)/
3891
3892/(?P<0abc>xx)/
3893
3894/\k<5ghj>/
3895
3896/\k'5ghj'/
3897
3898/\k{2fgh}/
3899
3900/(?P=8yuki)/
3901
3902/\g{4df}/
3903
3904/(?&1abc)xx(?<1abc>y)/
3905
3906/(?P>1abc)xx(?<1abc>y)/
3907
3908/\g'3gh'/
3909
3910/\g<5fg>/
3911
3912/(?(<4gh>)abc)/
3913
3914/(?('4gh')abc)/
3915
3916/(?(4gh)abc)/
3917
3918/(?(R&6yh)abc)/
3919
3920/(((a\2)|(a*)\g<-1>))*a?/B
3921
3922# Test the ugly "start or end of word" compatibility syntax.
3923
3924/[[:<:]]red[[:>:]]/B
3925    little red riding hood
3926    a /red/ thing
3927    red is a colour
3928    put it all on red
3929\= Expect no match
3930    no reduction
3931    Alfred Winifred
3932
3933/[a[:<:]] should give error/
3934
3935/(?=ab\K)/aftertext,allow_lookaround_bsk
3936    abcd\=startchar
3937
3938/abcd/newline=lf,firstline
3939\= Expect no match
3940    xx\nxabcd
3941
3942# Test stack guard external calls.
3943
3944/(((a)))/stackguard=1
3945
3946/(((a)))/stackguard=2
3947
3948/(((a)))/stackguard=3
3949
3950/(((((a)))))/
3951
3952# End stack guard tests
3953
3954/^\w+(?>\s*)(?<=\w)/B
3955
3956/\othing/
3957
3958/\o{}/
3959
3960/\o{whatever}/
3961
3962/\xthing/
3963
3964/\x{}/
3965
3966/\x{whatever}/
3967
3968/A\8B/
3969
3970/A\9B/
3971
3972# This one is here because Perl fails to match "12" for this pattern when the $
3973# is present.
3974
3975/^(?(?=abc)\w{3}:|\d\d)$/
3976    abc:
3977    12
3978\= Expect no match
3979    123
3980    xyz
3981
3982# Perl gets this one wrong, giving "a" as the after text for ca and failing to
3983# match for cd.
3984
3985/(?(?=ab)ab)/aftertext
3986    abxxx
3987    ca
3988    cd
3989
3990# This should test both paths for processing OP_RECURSE.
3991
3992/(?(R)a+|(?R)b)/
3993    aaaabcde
3994    aaaabcde\=ovector=100
3995
3996/a*?b*?/
3997    ab
3998
3999/(*NOTEMPTY)a*?b*?/
4000    ab
4001    ba
4002    cb
4003
4004/(*NOTEMPTY_ATSTART)a*?b*?/aftertext
4005    ab
4006    cdab
4007
4008/(?(VERSION>=10.0)yes|no)/I
4009    yesno
4010
4011/(?(VERSION>=10.04)yes|no)/
4012    yesno
4013
4014/(?(VERSION=8)yes){3}/BI,aftertext
4015    yesno
4016
4017/(?(VERSION=8)yes|no){3}/I
4018    yesnononoyes
4019\= Expect no match
4020    yesno
4021
4022/(?:(?<VERSION>abc)|xyz)(?(VERSION)yes|no)/I
4023    abcyes
4024    xyzno
4025\= Expect no match
4026    abcno
4027    xyzyes
4028
4029/(?(VERSION<10)yes|no)/
4030
4031/(?(VERSION>10)yes|no)/
4032
4033/(?(VERSION>=10.0.0)yes|no)/
4034
4035/(?(VERSION=10.101)yes|no)/
4036
4037/abcd/I
4038
4039/abcd/I,no_start_optimize
4040
4041/(|ab)*?d/I
4042   abd
4043   xyd
4044
4045/(|ab)*?d/I,no_start_optimize
4046   abd
4047   xyd
4048
4049/\k<A>*(?<A>aa)(?<A>bb)/match_unset_backref,dupnames
4050    aabb
4051
4052/(((((a)))))/parens_nest_limit=2
4053
4054/abc/replace=XYZ
4055    123123
4056    123abc123
4057    123abc123abc123
4058    123123\=zero_terminate
4059    123abc123\=zero_terminate
4060    123abc123abc123\=zero_terminate
4061
4062/abc/g,replace=XYZ
4063    123abc123
4064    123abc123abc123
4065
4066/abc/replace=X$$Z
4067    123abc123
4068
4069/abc/g,replace=X$$Z
4070    123abc123abc123
4071
4072/a(b)c(d)e/replace=X$1Y${2}Z
4073    "abcde"
4074
4075/a(b)c(d)e/replace=X$1Y${2}Z,global
4076    "abcde-abcde"
4077
4078/a(?<ONE>b)c(?<TWO>d)e/replace=X$ONE+${TWO}Z
4079    "abcde"
4080
4081/a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z
4082    "abcde-abcde-"
4083
4084/abc/replace=a$++
4085    123abc
4086
4087/abc/replace=a$bad
4088    123abc
4089
4090/abc/replace=a${A234567890123456789_123456789012}z
4091    123abc
4092
4093/abc/replace=a${A23456789012345678901234567890123}z
4094    123abc
4095
4096/abc/replace=a${bcd
4097    123abc
4098
4099/abc/replace=a${b+d}z
4100    123abc
4101
4102/abc/replace=[10]XYZ
4103    123abc123
4104
4105/abc/replace=[9]XYZ
4106    123abc123
4107
4108/abc/replace=xyz
4109    1abc2\=partial_hard
4110
4111/abc/replace=xyz
4112    123abc456
4113    123abc456\=replace=pqr
4114    123abc456abc789
4115    123abc456abc789\=g
4116
4117/(?<=abc)(|def)/g,replace=<$0>
4118    123abcxyzabcdef789abcpqr
4119
4120/./replace=$0
4121    a
4122
4123/(.)(.)/replace=$2+$1
4124    abc
4125
4126/(?<A>.)(?<B>.)/replace=$B+$A
4127    abc
4128
4129/(.)(.)/g,replace=$2$1
4130    abcdefgh
4131
4132/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=${*MARK}
4133    apple lemon blackberry
4134    apple strudel
4135    fruitless
4136
4137/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} sauce,
4138    apple lemon blackberry
4139
4140/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK>
4141    apple lemon blackberry
4142    apple strudel
4143    fruitless
4144
4145/(*:pear)apple/g,replace=${*MARKING}
4146    apple lemon blackberry
4147
4148/(*:pear)apple/g,replace=${*MARK-time
4149    apple lemon blackberry
4150
4151/(*:pear)apple/g,replace=${*mark}
4152    apple lemon blackberry
4153
4154/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARKET>
4155    apple lemon blackberry
4156
4157/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[22]${*MARK}
4158    apple lemon blackberry
4159    apple lemon blackberry\=substitute_overflow_length
4160
4161/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[23]${*MARK}
4162    apple lemon blackberry
4163
4164/abc/
4165    123abc123\=replace=[9]XYZ
4166    123abc123\=substitute_overflow_length,replace=[9]XYZ
4167    123abc123\=substitute_overflow_length,replace=[6]XYZ
4168    123abc123\=substitute_overflow_length,replace=[1]XYZ
4169    123abc123\=substitute_overflow_length,replace=[0]XYZ
4170
4171/a(b)c/
4172    123abc123\=replace=[9]x$1z
4173    123abc123\=substitute_overflow_length,replace=[9]x$1z
4174    123abc123\=substitute_overflow_length,replace=[6]x$1z
4175    123abc123\=substitute_overflow_length,replace=[1]x$1z
4176    123abc123\=substitute_overflow_length,replace=[0]x$1z
4177
4178"((?=(?(?=(?(?=(?(?=()))))))))"
4179    a
4180
4181"(?(?=)==)(((((((((?=)))))))))"
4182\= Expect no match
4183    a
4184
4185/(a)(b)|(c)/
4186    XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
4187
4188/x(?=ab\K)/allow_lookaround_bsk
4189    xab\=get=0
4190    xab\=copy=0
4191    xab\=getall
4192
4193/(?<A>a)|(?<A>b)/dupnames
4194    a\=ovector=1,copy=A,get=A,get=2
4195    a\=ovector=2,copy=A,get=A,get=2
4196    b\=ovector=2,copy=A,get=A,get=2
4197
4198/a(b)c(d)/
4199    abc\=ph,copy=0,copy=1,getall
4200
4201/^abc/info
4202
4203/^abc/info,no_dotstar_anchor
4204
4205/.*\d/info,auto_callout
4206\= Expect no match
4207    aaa
4208
4209/.*\d/info,no_dotstar_anchor,auto_callout
4210\= Expect no match
4211    aaa
4212
4213/.*\d/dotall,info
4214
4215/.*\d/dotall,no_dotstar_anchor,info
4216
4217/(*NO_DOTSTAR_ANCHOR)(?s).*\d/info
4218
4219'^(?:(a)|b)(?(1)A|B)'
4220    aA123\=ovector=1
4221    aA123\=ovector=2
4222
4223'^(?:(?<AA>a)|b)(?(<AA>)A|B)'
4224    aA123\=ovector=1
4225    aA123\=ovector=2
4226
4227'^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'dupnames
4228    aA123\=ovector=1
4229    aA123\=ovector=2
4230    aA123\=ovector=3
4231
4232'^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'dupnames
4233    aa123\=ovector=1
4234    aa123\=ovector=2
4235    aa123\=ovector=3
4236
4237/(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
4238
4239/(?<N>(?J)(?<N>))(?-J)\k<N>/
4240
4241# Quantifiers are not allowed on condition assertions, but are otherwise
4242# OK in conditions.
4243
4244/(?(?=0)?)+/
4245
4246/(?(?=0)(?=00)?00765)/
4247     00765
4248
4249/(?(?=0)(?=00)?00765|(?!3).56)/
4250     00765
4251     456
4252\= Expect no match
4253     356
4254
4255'^(a)*+(\w)'
4256    g
4257    g\=ovector=1
4258
4259'^(?:a)*+(\w)'
4260    g
4261    g\=ovector=1
4262
4263# These two pattern showeds up compile-time bugs
4264
4265"((?2){0,1999}())?"
4266
4267/((?+1)(\1))/B
4268
4269# Callouts with string arguments
4270
4271/a(?C"/
4272
4273/a(?C"a/
4274
4275/a(?C"a"/
4276
4277/a(?C"a"bcde(?C"b")xyz/
4278
4279/a(?C"a)b""c")/B
4280
4281/ab(?C" any text with spaces ")cde/B
4282    abcde
4283    12abcde
4284
4285/^a(b)c(?C1)def/
4286      abcdef
4287
4288/^a(b)c(?C"AB")def/
4289      abcdef
4290
4291/^a(b)c(?C1)def/
4292      abcdef\=callout_capture
4293
4294/^a(b)c(?C{AB})def/B
4295      abcdef\=callout_capture
4296
4297/(?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
4298
4299/(?:a(?C`code`)){3}/B
4300
4301/^(?(?C25)(?=abc)abcd|xyz)/B,callout_info
4302    abcdefg
4303    xyz123
4304
4305/^(?(?C$abc$)(?=abc)abcd|xyz)/B
4306    abcdefg
4307    xyz123
4308
4309/^ab(?C'first')cd(?C"second")ef/
4310    abcdefg
4311
4312/(?:a(?C`code`)){3}X/
4313    aaaXY
4314
4315# Binary zero in callout string
4316#  a  (  ?  C  '  x     z  '  )  b
4317/ 61 28 3f 43 27 78 00 7a 27 29 62/hex,callout_info
4318    abcdefgh
4319
4320/(?(?!)^)/
4321
4322/(?(?!)a|b)/
4323    bbb
4324\= Expect no match
4325    aaa
4326
4327# JIT gives a different error message for the infinite recursion
4328
4329"(*NO_JIT)((?2)+)((?1)){"
4330    abcd{
4331
4332# Perl fails to diagnose the absence of an assertion
4333
4334"(?(?<E>.*!.*)?)"
4335
4336"X((?2)()*+){2}+"B
4337
4338"X((?2)()*+){2}"B
4339
4340/(?<=\bABQ(3(?-7)))/
4341
4342/(?<=\bABQ(3(?+7)))/
4343
4344";(?<=()((?3))((?2)))"
4345
4346# Perl loops on this (PCRE2 used to!)
4347
4348/(?<=\Ka)/g,aftertext,allow_lookaround_bsk
4349    aaaaa
4350
4351/(?<=\Ka)/altglobal,aftertext,allow_lookaround_bsk
4352    aaaaa
4353
4354/((?2){73}(?2))((?1))/info
4355
4356/abc/
4357\= Expect no match
4358    \[9x!xxx(]{9999}
4359
4360/(abc)*/
4361    \[abc]{5}
4362
4363/^/gm
4364    \n\n\n
4365
4366/^/gm,alt_circumflex
4367    \n\n\n
4368
4369/((((((((x))))))))\81/
4370    xx1
4371
4372/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\80/
4373    xx
4374
4375/\80/
4376
4377/A\8B\9C/
4378    A8B9C
4379
4380/(?x:((?'a')) # comment (with parentheses) and | vertical
4381(?-x:#not a comment (?'b')) # this is a comment ()
4382(?'c')) # not a comment (?'d')/info
4383
4384/(?|(?'a')(2)(?'b')|(?'a')(?'a')(3))/I,dupnames
4385    A23B
4386    B32A
4387
4388# These are some patterns that used to cause buffer overflows or other errors
4389# while compiling.
4390
4391/.((?2)(?R)|\1|$)()/B
4392
4393/.((?3)(?R)()(?2)|\1|$)()/B
4394
4395/(\9*+(?2);\3++()2|)++{/
4396
4397/\V\x85\9*+((?2)\3++()2)*:2/
4398
4399/(((?(R)){0,2}) (?'x'((?'R')((?'R')))))/dupnames
4400
4401/(((?(X)){0,2}) (?'x'((?'X')((?'X')))))/dupnames
4402
4403/(((?(R)){0,2}) (?'x'((?'X')((?'R')))))/
4404
4405"(?J)(?'d'(?'d'\g{d}))"
4406
4407"(?=!((?2)(?))({8(?<=(?1){29}8bbbb\x16\xd\xc6^($(\xa9H4){4}h}?1)B))\x15')"
4408
4409/A(?'')Z/
4410
4411"(?J:(?|(?'R')(\k'R')|((?'R'))))"
4412
4413/(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
4414
4415/^(?:(?(1)x|)+)+$()/B
4416
4417/[[:>:]](?<)/
4418
4419/((?x)(*:0))#(?'/
4420
4421/(?C$[$)(?<]/
4422
4423/(?C$)$)(?<]/
4424
4425/(?(R))*+/B
4426    abcd
4427
4428/((?x)(?#))#(?'/
4429
4430/((?x)(?#))#(?'abc')/I
4431
4432/[[:\\](?<[::]/
4433
4434/[[:\\](?'abc')[a:]/I
4435
4436"[[[.\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[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
4437
4438/()(?(R)0)*+/B
4439
4440/(?R-:(?</
4441
4442/(?R-:(?<)/
4443
4444/(?(?C{\Q})(?!(?'/
4445
4446/(?(?C{\Q})(?!(?'abc')))/I
4447
4448/(?1){3918}(((((0(\k'R'))))(?J)(?'R'(?'R'\3){99})))/I
4449
4450/(?|(aaa)|(b))\g{1}/I
4451
4452/(?|(aaa)|(b))(?1)/I
4453
4454/(?|(aaa)|(b))/I
4455
4456/(?|(?'a'aaa)|(?'a'b))\k'a'/I
4457
4458/(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/I,dupnames
4459
4460/ab{3cd/
4461    ab{3cd
4462
4463/ab{3,cd/
4464    ab{3,cd
4465
4466/ab{3,4a}cd/
4467    ab{3,4a}cd
4468
4469/{4,5a}bc/
4470    {4,5a}bc
4471
4472/\x0{ab}/
4473    \0{ab}
4474
4475/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
4476    ababababbbabZXXXX
4477
4478/.*?a(*PRUNE)b/
4479    aab
4480
4481/.*?a(*PRUNE)b/s
4482    aab
4483
4484/^a(*PRUNE)b/s
4485\= Expect no match
4486    aab
4487
4488/.*?a(*SKIP)b/
4489    aab
4490
4491/(?(8000000000/
4492
4493/((?(R8000000000)))/
4494
4495/0(?0)|(1)(*THEN)(*SKIP:0)(*FAIL)/
4496\= Expect no match
4497    01
4498
4499/(?(1)()\983040\2)/
4500
4501/(*LIMIT_MATCH=)abc/
4502
4503/(*CRLF)(*LIMIT_MATCH=)abc/
4504
4505/(?:ab)?(?:ab)(?:ab)/
4506    abab
4507    ababab
4508\= Expect no match
4509    aba
4510
4511/((*MARK:A))++a(*SKIP:B)b/
4512\= Expect no match
4513    aacb
4514
4515/(*MARK:a\zb)z/alt_verbnames
4516
4517/(*:ab\t(d\)c)xxx/
4518
4519/(*:ab\t(d\)c)xxx/alt_verbnames,mark
4520    cxxxz
4521
4522/(*:A\Qxx)x\EB)x/alt_verbnames,mark
4523    x
4524
4525/(*:A\ExxxB)x/alt_verbnames,mark
4526    x
4527
4528/(*: A \ and #comment
4529     \ B)x/x,alt_verbnames,mark
4530    x
4531
4532/(*: A \ and #comment
4533     \ B)x/alt_verbnames,mark
4534    x
4535
4536/(*: A \ and #comment
4537     \ B)x/x,mark
4538    x
4539
4540/(*: A \ and #comment
4541     \ B)x/mark
4542    x
4543
4544/(*:A
4545B)x/alt_verbnames,mark
4546    x
4547
4548/(*:abc\Qpqr)/alt_verbnames
4549
4550/abc/use_offset_limit
4551    1234abcde\=offset_limit=100
4552    1234abcde\=offset_limit=9
4553    1234abcde\=offset_limit=4
4554    1234abcde\=offset_limit=4,offset=4
4555\= Expect no match
4556    1234abcde\=offset_limit=4,offset=5
4557    1234abcde\=offset_limit=3
4558
4559/(?<=abc)/use_offset_limit
4560    1234abc\=offset_limit=7
4561\= Expect no match
4562    1234abc\=offset_limit=6
4563
4564/A/g,replace=-,use_offset_limit
4565    XAXAXAXAXA\=offset_limit=4
4566
4567/abc/
4568\= Expect error
4569    1234abcde\=offset_limit=4
4570
4571/^\w/m,use_offset_limit
4572    \n..\naa\=offset_limit=3
4573    \n..\naa\=offset_limit=4
4574
4575/abcd/null_context
4576    abcd\=null_context
4577\= Expect error - not allowed together
4578    abcd\=null_context,find_limits
4579    abcd\=allusedtext,startchar
4580
4581/abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended
4582    abcd
4583
4584/abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended,substitute_literal
4585    >>abcd<<
4586
4587/abcd/g,replace=\$1$2\,substitute_literal
4588    XabcdYabcdZ
4589
4590/a(bc)(DE)/replace=a\u$1\U$1\E$1\l$2\L$2\Eab\Uab\LYZ\EDone,substitute_extended
4591    abcDE
4592
4593/abcd/replace=xy\kz,substitute_extended
4594    abcd
4595
4596/a(?:(b)|(c))/substitute_extended,replace=X${1:+1:-1}X${2:+2:-2}
4597    ab
4598    ac
4599    ab\=replace=${1:+$1\:$1:$2}
4600    ac\=replace=${1:+$1\:$1:$2}
4601    >>ac<<\=replace=${1:+$1\:$1:$2},substitute_literal
4602
4603/a(?:(b)|(c))/substitute_extended,replace=X${1:-1:-1}X${2:-2:-2}
4604    ab
4605    ac
4606
4607/(a)/substitute_extended,replace=>${1:+\Q$1:{}$$\E+\U$1}<
4608    a
4609
4610/X(b)Y/substitute_extended
4611    XbY\=replace=x${1:+$1\U$1}y
4612    XbY\=replace=\Ux${1:+$1$1}y
4613
4614/a/substitute_extended,replace=${*MARK:+a:b}
4615    a
4616
4617/(abcd)/replace=${1:+xy\kz},substitute_extended
4618    abcd
4619
4620/(abcd)/
4621    abcd\=replace=${1:+xy\kz},substitute_extended
4622
4623/abcd/substitute_extended,replace=>$1<
4624    abcd
4625
4626/abcd/substitute_extended,replace=>xxx${xyz}<<<
4627    abcd
4628
4629/(?J)(?:(?<A>a)|(?<A>b))/replace=<$A>
4630    [a]
4631    [b]
4632\= Expect error
4633    (a)\=ovector=1
4634
4635/(a)|(b)/replace=<$1>
4636\= Expect error
4637    b
4638
4639/(aa)(BB)/substitute_extended,replace=\U$1\L$2\E$1..\U$1\l$2$1
4640    aaBB
4641
4642/abcd/replace=wxyz,substitute_matched
4643    abcd
4644    pqrs
4645
4646/abcd/g
4647    >abcd1234abcd5678<\=replace=wxyz,substitute_matched
4648
4649/^(o(\1{72}{\"{\\{00000059079}\d*){74}}){19}/I
4650
4651/((p(?'K/
4652
4653/((p(?'K/no_auto_capture
4654
4655/abc/replace=A$3123456789Z
4656    abc
4657
4658/(?<!a{65535}a{5})x/I
4659
4660/(?<!a{65535})x/I
4661
4662/(?=a\K)/replace=z,allow_lookaround_bsk
4663    BaCaD
4664
4665/(?<=\K.)/g,replace=-,allow_lookaround_bsk
4666    ab
4667
4668/(?'abcdefghijklmnopqrstuvwxyzABCDEFG'toolong)/
4669
4670/(?'abcdefghijklmnopqrstuvwxyzABCDEF'justright)/
4671
4672# These two use zero-termination
4673/abcd/max_pattern_length=3
4674
4675/abc/max_pattern_length=3
4676
4677# These two, being hex, pass the length
4678/abcdefab/hex,max_pattern_length=3
4679
4680/abcdef/hex,max_pattern_length=3
4681
4682# These patterns used to take a long time to compile
4683
4684"(.*)
4685((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4686((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4687((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
4688
4689"(?<=a()
4690((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4691((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4692((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4693a)"xI
4694
4695"(?|()|())(.*)
4696((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4697((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4698((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
4699
4700"(?|()|())(?<=a()
4701((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4702((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4703((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4704a)"xI
4705
4706# Test the use of malloc for caching group information when there are more
4707# groups than fit into the on-stack workspace.
4708
4709/\[()]{1024}/I,expand
4710
4711# Test minlength capped at 65535
4712
4713/(A{65000})\1{65000}/I
4714
4715# Test group scans when numbers are not unique
4716
4717/(?|()+|(a)+)/BI
4718
4719/(?|(a)+|()+)/BI
4720
4721/(?|()|(a))/BI
4722
4723/(?|(a)|())/BI
4724
4725# Test CRLF handling in empty string substitutions
4726
4727/^$/gm,newline=anycrlf,replace=-
4728    X\r\n\r\nY
4729
4730/^$/gm,newline=crlf,replace=-
4731    X\r\n\r\nY
4732
4733/^$/gm,newline=any,replace=-
4734    X\r\n\r\nY
4735
4736"(*ANYCRLF)(?m)^(.*[^0-9\r\n].*|)$"g,replace=NaN
4737    15\r\nfoo\r\n20\r\nbar\r\nbaz\r\n\r\n20
4738
4739/a[[:punct:]b]/bincode
4740
4741/a[b[:punct:]]/bincode
4742
4743/L(?#(|++<!(2)?/B
4744
4745/L(?#(|++<!(2)?/B,no_auto_possess
4746
4747/L(?#(|++<!(2)?/B,auto_callout
4748
4749/L(?#(|++<!(2)?/B,no_auto_possess,auto_callout
4750
4751/(A*)\E+/B,auto_callout
4752
4753/()\Q\E*]/B,auto_callout
4754    a[bc]d
4755
4756/\x8a+f|;T?(*:;.'?`(\xeap ){![^()!y*''C*(?';]{1;(\x08)/B,alt_verbnames,dupnames,extended
4757
4758# Tests for NULL characters in comments and verb "names" and callouts
4759
4760# /A#B\x00C\x0aZ/
4761/41 23 42 00 43 0a 5a/Bx,hex
4762
4763# /A+#B\x00C\x0a+/
4764/41 2b 23 42 00 43 0a 2b/Bx,hex
4765
4766# /A(*:B\x00W#X\00Y\x0aC)Z/
4767/41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex,alt_verbnames
4768
4769# /A(*:B\x00W#X\00Y\x0aC)Z/
4770/41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex
4771
4772# /A(?C{X\x00Y})B/
4773/41 28 3f 43 7b 58 00 59 7d 29 42/B,hex
4774
4775# /A(?#X\x00Y)B/
4776/41 28 3f 23 7b 00 7d 29 42/B,hex
4777
4778# Tests for leading comment in extended patterns
4779
4780/ (?-x):?/extended
4781
4782/(?-x):?/extended
4783
4784/0b 28 3f 2d 78 29 3a/hex,extended
4785
4786/#comment
4787(?-x):?/extended
4788
4789/(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
4790
4791/a|(b)c/replace=>$1<,substitute_unset_empty
4792    cat
4793    xbcom
4794
4795/a|(b)c/
4796    cat\=replace=>$1<
4797    cat\=replace=>$1<,substitute_unset_empty
4798    xbcom\=replace=>$1<,substitute_unset_empty
4799
4800/a|(b)c/substitute_extended
4801    cat\=replace=>${2:-xx}<
4802    cat\=replace=>${2:-xx}<,substitute_unknown_unset
4803    cat\=replace=>${X:-xx}<,substitute_unknown_unset
4804
4805/a|(?'X'b)c/replace=>$X<,substitute_unset_empty
4806    cat
4807    xbcom
4808
4809/a|(?'X'b)c/replace=>$Y<,substitute_unset_empty
4810    cat
4811    cat\=substitute_unknown_unset
4812    cat\=substitute_unknown_unset,-substitute_unset_empty
4813
4814/a|(b)c/replace=>$2<,substitute_unset_empty
4815    cat
4816    cat\=substitute_unknown_unset
4817    cat\=substitute_unknown_unset,-substitute_unset_empty
4818
4819/()()()/use_offset_limit
4820    \=ovector=11000000000
4821    \=callout_fail=11000000000
4822    \=callout_fail=1:11000000000
4823    \=callout_data=11000000000
4824    \=callout_data=-11000000000
4825    \=offset_limit=1100000000000000000000
4826    \=copy=11000000000
4827
4828/(*MARK:A\x00b)/mark
4829    abc
4830
4831/(*MARK:A\x00b)/mark,alt_verbnames
4832    abc
4833
4834/"(*MARK:A" 00 "b)"/mark,hex
4835    abc
4836
4837/"(*MARK:A" 00 "b)"/mark,hex,alt_verbnames
4838    abc
4839
4840/efg/hex
4841
4842/eff/hex
4843
4844/effg/hex
4845
4846/(?J)(?'a'))(?'a')/
4847
4848/(?<=((?C)0))/
4849    9010
4850\= Expect no match
4851    abc
4852
4853/aaa/
4854\[abc]{10000000000000000000000000000}
4855\[a]{3}
4856
4857/\[AB]{6000000000000000000000}/expand
4858
4859# Hex uses pattern length, not zero-terminated. This tests for overrunning
4860# the given length of a pattern.
4861
4862/'(*U'/hex
4863
4864/'(*'/hex
4865
4866/'('/hex
4867
4868//hex
4869
4870# These tests are here because Perl never allows a back reference in a
4871# lookbehind. PCRE2 supports some limited cases.
4872
4873/([ab])...(?<=\1)z/
4874    a11az
4875    b11bz
4876\= Expect no match
4877    b11az
4878
4879/(?|([ab]))...(?<=\1)z/
4880
4881/([ab])(\1)...(?<=\2)z/
4882    aa11az
4883
4884/(a\2)(b\1)(?<=\2)/
4885
4886/(?<A>[ab])...(?<=\k'A')z/
4887    a11az
4888    b11bz
4889\= Expect no match
4890    b11az
4891
4892/(?<A>[ab])...(?<=\k'A')(?<A>)z/dupnames
4893
4894# Perl does not support \g+n
4895
4896/((\g+1X)?([ab]))+/
4897    aaXbbXa
4898
4899/ab(?C1)c/auto_callout
4900    abc
4901
4902/'ab(?C1)c'/hex,auto_callout
4903    abc
4904
4905# Perl accepts these, but gives a warning. We can't warn, so give an error.
4906
4907/[a-[:digit:]]+/
4908    a-a9-a
4909
4910/[A-[:digit:]]+/
4911    A-A9-A
4912
4913/[a-\d]+/
4914    a-a9-a
4915
4916/(?<RA>abc)(?(R)xyz)/B
4917
4918/(?<R>abc)(?(R)xyz)/B
4919
4920/(?=.*[A-Z])/I
4921
4922/()(?<=(?0))/
4923
4924/(?<!|!(?<!))/
4925
4926/(?<!|!|!||||||(?<!)||(?<!)!|!||(?<!)!|!(?<!)!|!|!|!||||!!|<!)!|!||||!|/
4927
4928/{2,2{2,2/use_length
4929
4930/.>*?\g'0/use_length
4931
4932/.>*?\g'0/
4933
4934/{�̈́�̈́�{'{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
4935
4936//
4937\=get=i00000000000000000000000000000000
4938\=get=i2345678901234567890123456789012,get=i1245678901234567890123456789012
4939
4940"(?(?C))"
4941
4942/(?(?(?(?(?(?))))))/
4943
4944/(?<=(?1))((?s))/anchored
4945
4946/(*:ab)*/
4947
4948%(*:(:(svvvvvvvvvv:]*[   Z!*;[]*[^[]*!^[+.+{{2,7}'      _\\\\\\\\\\\\\)?.:..    *w////\\\Q\\\\\\\\\\\\\\\T\\\\\+/?/////'+\\\EEE?/////'+/*+/[^K]?]//(w)%never_backslash_c,alt_verbnames,auto_callout
4949
4950/./newline=crlf
4951    \=ph
4952
4953/(\x0e00\000000\xc)/replace=\P,substitute_extended
4954    \x0e00\000000\xc
4955
4956//replace=0
4957    \=offset=7
4958
4959/(?<=\G.)/g,replace=+
4960    abc
4961
4962".+\QX\E+"B,no_auto_possess
4963
4964".+\QX\E+"B,auto_callout,no_auto_possess
4965
4966# This one is here because Perl gives an 'unmatched )' error which goes away
4967# if one of the \) sequences is removed - which is weird. PCRE finds it too
4968# complicated to find a minimum matching length.
4969
4970"()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
4971
4972# This checks that new code for handling groups that may match an empty string
4973# works on a very large number of alternatives. This pattern used to provoke a
4974# complaint that it was too complicated.
4975
4976/(?:\[A|B|C|D|E|F|G|H|I|J|]{200}Z)/expand
4977
4978# This one used to compile rubbish instead of a compile error, and then
4979# behave unpredictably at match time.
4980
4981/.+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X/
4982    .+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X
4983
4984/[:[:alnum:]-[[a:lnum:]+/
4985
4986/((?(?C'')\QX\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
4987
4988/((?(?C'')\Q\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
4989
4990/abcd/auto_callout
4991    abcd\=callout_error=255:2
4992
4993/()(\g+65534)/
4994
4995/()(\g+65533)/
4996
4997/�\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
4998
4999/(a)(b)\2\1\1\1\1/I
5000
5001/(?<a>a)(?<b>b)\g{b}\g{a}\g{a}\g{a}\g{a}(?<a>xx)(?<b>zz)/I,dupnames
5002
5003//
5004    \=ovector=7777777777
5005
5006# This is here because Perl matches, even though a COMMIT is encountered
5007# outside of the recursion.
5008
5009/(?1)(A(*COMMIT)|B)D/
5010    BAXBAD
5011
5012"(?1){2}(a)"B
5013
5014"(?1){2,4}(a)"B
5015
5016# This test differs from Perl for the first subject. Perl ends up with
5017# $1 set to 'B'; PCRE2 has it unset (which I think is right).
5018
5019/^(?:
5020(?:A| (?:B|B(*ACCEPT)) (?<=(.)) D)
5021(Z)
5022)+$/x
5023    AZB
5024    AZBDZ
5025
5026# The first of these, when run by Perl, gives the mark 'aa', which is wrong.
5027
5028'(?>a(*:aa))b|ac' mark
5029    ac
5030
5031'(?:a(*:aa))b|ac' mark
5032    ac
5033
5034/(R?){65}/
5035    (R?){65}
5036
5037/\[(a)]{60}/expand
5038    aaaa
5039
5040/(?<!\1((?U)1((?U))))(*F)/never_backslash_c,alt_bsux,anchored,extended
5041
5042/\g{3/
5043
5044/(a(?C1)(b)(c)d)+/
5045  abcdabcd\=callout_capture
5046
5047# Perl matches this one, but PCRE does not because (*ACCEPT) clears out any
5048# pending backtracks in the recursion.
5049
5050/^ (?(DEFINE) (..(*ACCEPT)|...) ) (?1)$/x
5051\= Expect no match
5052    abc
5053
5054# Perl gives no match for this one
5055
5056/(a(*MARK:m)(*ACCEPT)){0}(?1)/mark
5057    abc
5058
5059/abc/endanchored
5060    xyzabc
5061\= Expect no match
5062    xyzabcdef
5063\= Expect error
5064    xyzabc\=ph
5065
5066/abc/
5067    xyzabc\=endanchored
5068\= Expect no match
5069    xyzabcdef\=endanchored
5070\= Expect error
5071    xyzabc\=ps,endanchored
5072
5073/abc(*ACCEPT)d/endanchored
5074    xyzabc
5075\= Expect no match
5076    xyzabcdef
5077
5078/abc|bcd/endanchored
5079    xyzabcd
5080\= Expect no match
5081    xyzabcdef
5082
5083/a(*ACCEPT)x|aa/endanchored
5084    aaa
5085
5086# Check auto-anchoring when there is a group that is never obeyed at
5087# the start of a branch.
5088
5089/(?(DEFINE)(a))^bc/I
5090
5091/(a){0}.*bc/sI
5092
5093# This should be anchored, as the condition is always false and there is
5094# no alternative branch.
5095
5096/(?(VERSION>=999)yes)^bc/I
5097
5098# This should not be anchored.
5099
5100/(?(VERSION>=999)yes|no)^bc/I
5101
5102/(*LIMIT_HEAP=0)xxx/I
5103
5104/\d{0,3}(*:abc)(?C1)xxx/callout_info
5105
5106# ----------------------------------------------------------------------
5107
5108# These are a whole pile of tests that touch lines of code that are not
5109# used by any other tests (at least when these were created).
5110
5111/^a+?x/i,no_start_optimize,no_auto_possess
5112\= Expect no match
5113    aaa
5114
5115/^[^a]{3,}?x/i,no_start_optimize,no_auto_possess
5116\= Expect no match
5117    bbb
5118    cc
5119
5120/^X\S/no_start_optimize,no_auto_possess
5121\= Expect no match
5122    X
5123
5124/^X\W/no_start_optimize,no_auto_possess
5125\= Expect no match
5126    X
5127
5128/^X\H/no_start_optimize,no_auto_possess
5129\= Expect no match
5130    X
5131
5132/^X\h/no_start_optimize,no_auto_possess
5133\= Expect no match
5134    X
5135
5136/^X\V/no_start_optimize,no_auto_possess
5137\= Expect no match
5138    X
5139
5140/^X\v/no_start_optimize,no_auto_possess
5141\= Expect no match
5142    X
5143
5144/^X\h/no_start_optimize,no_auto_possess
5145\= Expect no match
5146    XY
5147
5148/^X\V/no_start_optimize,no_auto_possess
5149\= Expect no match
5150    X\n
5151
5152/^X\v/no_start_optimize,no_auto_possess
5153\= Expect no match
5154    XX
5155
5156/^X.+?/s,no_start_optimize,no_auto_possess
5157\= Expect no match
5158    X
5159
5160/^X\R+?/no_start_optimize,no_auto_possess
5161\= Expect no match
5162    XX
5163
5164/^X\H+?/no_start_optimize,no_auto_possess
5165\= Expect no match
5166    X
5167
5168/^X\h+?/no_start_optimize,no_auto_possess
5169\= Expect no match
5170    X
5171
5172/^X\V+?/no_start_optimize,no_auto_possess
5173\= Expect no match
5174    X
5175    X\n
5176
5177/^X\D+?/no_start_optimize,no_auto_possess
5178\= Expect no match
5179    X
5180    X9
5181
5182/^X\S+?/no_start_optimize,no_auto_possess
5183\= Expect no match
5184    X
5185    X\n
5186
5187/^X\W+?/no_start_optimize,no_auto_possess
5188\= Expect no match
5189    X
5190    XX
5191
5192/^X.+?Z/no_start_optimize,no_auto_possess
5193\= Expect no match
5194    XY\n
5195
5196/(*CRLF)^X.+?Z/no_start_optimize,no_auto_possess
5197\= Expect no match
5198    XY\r\=ps
5199
5200/^X\R+?Z/no_start_optimize,no_auto_possess
5201\= Expect no match
5202    X\nX
5203    X\n\r\n
5204    X\n\rY
5205    X\n\nY
5206    X\n\x{0c}Y
5207
5208/(*BSR_ANYCRLF)^X\R+?Z/no_start_optimize,no_auto_possess
5209\= Expect no match
5210    X\nX
5211    X\n\r\n
5212    X\n\rY
5213    X\n\nY
5214    X\n\x{0c}Y
5215
5216/^X\H+?Z/no_start_optimize,no_auto_possess
5217\= Expect no match
5218    XY\t
5219    XYY
5220
5221/^X\h+?Z/no_start_optimize,no_auto_possess
5222\= Expect no match
5223    X\t\t
5224    X\tY
5225
5226/^X\V+?Z/no_start_optimize,no_auto_possess
5227\= Expect no match
5228    XY\n
5229    XYY
5230
5231/^X\v+?Z/no_start_optimize,no_auto_possess
5232\= Expect no match
5233    X\n\n
5234    X\nY
5235
5236/^X\D+?Z/no_start_optimize,no_auto_possess
5237\= Expect no match
5238    XY9
5239    XYY
5240
5241/^X\d+?Z/no_start_optimize,no_auto_possess
5242\= Expect no match
5243    X99
5244    X9Y
5245
5246/^X\S+?Z/no_start_optimize,no_auto_possess
5247\= Expect no match
5248    XY\n
5249    XYY
5250
5251/^X\s+?Z/no_start_optimize,no_auto_possess
5252\= Expect no match
5253    X\n\n
5254    X\nY
5255
5256/^X\W+?Z/no_start_optimize,no_auto_possess
5257\= Expect no match
5258    X.A
5259    X++
5260
5261/^X\w+?Z/no_start_optimize,no_auto_possess
5262\= Expect no match
5263    Xa.
5264    Xaa
5265
5266/^X.{1,3}Z/s,no_start_optimize,no_auto_possess
5267\= Expect no match
5268    Xa.bd
5269
5270/^X\h+Z/no_start_optimize,no_auto_possess
5271\= Expect no match
5272    X\t\t
5273    X\tY
5274
5275/^X\V+Z/no_start_optimize,no_auto_possess
5276\= Expect no match
5277    XY\n
5278    XYY
5279
5280/^(X(*THEN)Y|AB){0}(?1)/
5281    ABX
5282\= Expect no match
5283    XAB
5284
5285/^(?!A(?C1)B)C/
5286    ABC\=callout_error=1,no_jit
5287
5288/^(?!A(?C1)B)C/no_start_optimize
5289    ABC\=callout_error=1
5290
5291/^(?(?!A(?C1)B)C)/
5292    ABC\=callout_error=1
5293
5294# ----------------------------------------------------------------------
5295
5296/[a b c]/BxxI
5297
5298/[a b c]/BxxxI
5299
5300/[a b c]/B,extended_more
5301
5302/[ a b c ]/B,extended_more
5303
5304/[a b](?xx: [ 12 ] (?-xx:[ 34 ]) )y z/B
5305
5306# Unsetting /x also unsets /xx
5307
5308/[a b](?xx: [ 12 ] (?-x:[ 34 ]) )y z/B
5309
5310/(a)(?-n:(b))(c)/nB
5311
5312# ----------------------------------------------------------------------
5313# These test the dangerous PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL option.
5314
5315/\j\x{z}\o{82}\L\uabcd\u\U\g{\g/B,\bad_escape_is_literal
5316
5317/\N{\c/IB,bad_escape_is_literal
5318
5319/[\j\x{z}\o\gAb\g]/B,bad_escape_is_literal
5320
5321/[Q-\N]/B,bad_escape_is_literal
5322
5323/[\s-_]/bad_escape_is_literal
5324
5325/[_-\s]/bad_escape_is_literal
5326
5327/[\B\R\X]/B
5328
5329/[\B\R\X]/B,bad_escape_is_literal
5330
5331/[A-\BP-\RV-\X]/B
5332
5333/[A-\BP-\RV-\X]/B,bad_escape_is_literal
5334
5335# ----------------------------------------------------------------------
5336
5337/a\b(c/literal
5338    a\\b(c
5339
5340/a\b(c/literal,caseless
5341    a\\b(c
5342    a\\B(c
5343
5344/a\b(c/literal,firstline
5345    XYYa\\b(c
5346\= Expect no match
5347    X\na\\b(c
5348
5349/a\b?c/literal,use_offset_limit
5350    XXXXa\\b?c\=offset_limit=4
5351\= Expect no match
5352    XXXXa\\b?c\=offset_limit=3
5353
5354/a\b(c/literal,anchored,endanchored
5355    a\\b(c
5356\= Expect no match
5357    Xa\\b(c
5358    a\\b(cX
5359    Xa\\b(cX
5360
5361//literal,extended
5362
5363/a\b(c/literal,auto_callout,no_start_optimize
5364    XXXXa\\b(c
5365
5366/a\b(c/literal,auto_callout
5367    XXXXa\\b(c
5368
5369/(*CR)abc/literal
5370    (*CR)abc
5371
5372/cat|dog/I,match_word
5373    the cat sat
5374\= Expect no match
5375    caterpillar
5376    snowcat
5377    syndicate
5378
5379/(cat)|dog/I,match_line,literal
5380    (cat)|dog
5381\= Expect no match
5382    the cat sat
5383    caterpillar
5384    snowcat
5385    syndicate
5386
5387/a whole line/match_line,multiline
5388    Rhubarb \na whole line\n custard
5389\= Expect no match
5390    Not a whole line
5391
5392# Perl gets this wrong, failing to capture 'b' in group 1.
5393
5394/^(b+|a){1,2}?bc/
5395    bbc
5396
5397# And again here, for the "babc" subject string.
5398
5399/^(b*|ba){1,2}?bc/
5400    babc
5401    bbabc
5402    bababc
5403\= Expect no match
5404    bababbc
5405    babababc
5406
5407/[[:digit:]-a]/
5408
5409/[[:digit:]-[:print:]]/
5410
5411/[\d-a]/
5412
5413/[\H-z]/
5414
5415/[\d-[:print:]]/
5416
5417# Perl gets the second of these wrong, giving no match.
5418
5419"(?<=(a))\1?b"I
5420    ab
5421    aaab
5422
5423"(?=(a))\1?b"I
5424    ab
5425    aaab
5426
5427# JIT does not support callout_extra
5428
5429/(*NO_JIT)(a+)b/auto_callout,no_start_optimize,no_auto_possess
5430\= Expect no match
5431    aac\=callout_extra
5432
5433/(*NO_JIT)a+(?C'XXX')b/no_start_optimize,no_auto_possess
5434\= Expect no match
5435    aac\=callout_extra
5436
5437/\n/firstline
5438    xyz\nabc
5439
5440/\nabc/firstline
5441    xyz\nabc
5442
5443/\x{0a}abc/firstline,newline=crlf
5444\= Expect no match
5445    xyz\r\nabc
5446
5447/[abc]/firstline
5448\= Expect no match
5449    \na
5450
5451# These tests are matched in test 1 as they are Perl compatible. Here we are
5452# looking at what does and does not get auto-possessified.
5453
5454/(?(DEFINE)(?<optional_a>a?))^(?&optional_a)a$/B
5455
5456/(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/B
5457
5458/^(a?)b(?1)a/B
5459
5460/^(a?)+b(?1)a/B
5461
5462/^(a?)++b(?1)a/B
5463
5464/^(a?)+b/B
5465
5466/(?=a+)a(a+)++b/B
5467
5468/(?<=(?=.){4,5}x)/B
5469
5470# Perl behaves differently with these when optimization is turned off
5471
5472/a(*PRUNE:X)bc|qq/mark,no_start_optimize
5473\= Expect no match
5474    axy
5475
5476/a(*THEN:X)bc|qq/mark,no_start_optimize
5477\= Expect no match
5478    axy
5479
5480/(?^x-i)AB/
5481
5482/(?^-i)AB/
5483
5484/(?x-i-i)/
5485
5486/(?(?=^))b/I
5487    abc
5488
5489/(?(?=^)|)b/I
5490    abc
5491
5492/(?(?=^)|^)b/I
5493    bbc
5494\= Expect no match
5495    abc
5496
5497/(?(1)^|^())/I
5498
5499/(?(1)^())b/I
5500
5501/(?(1)^())+b/I,aftertext
5502    abc
5503
5504/(?(1)^()|^)+b/I,aftertext
5505    bbc
5506\= Expect no match
5507    abc
5508
5509/(?(1)^()|^)*b/I,aftertext
5510    bbc
5511    abc
5512    xbc
5513
5514/(?(1)^())+b/I,aftertext
5515    abc
5516
5517/(?(1)^a()|^a)+b/I,aftertext
5518    abc
5519\= Expect no match
5520    bbc
5521
5522/(?(1)^|^(a))+b/I,aftertext
5523    abc
5524\= Expect no match
5525    bbc
5526
5527/(?(1)^a()|^a)*b/I,aftertext
5528    abc
5529    bbc
5530    xbc
5531
5532/a(b)c|xyz/g,allvector,replace=<$0>
5533    abcdefabcpqr\=ovector=4
5534    abxyz\=ovector=4
5535    abcdefxyz\=ovector=4
5536
5537/a(b)c|xyz/allvector
5538    abcdef\=ovector=4
5539    abxyz\=ovector=4
5540
5541/a(b)c|xyz/g,replace=<$0>,substitute_callout
5542    abcdefabcpqr
5543    abxyzpqrabcxyz
5544    12abc34xyz99abc55\=substitute_stop=2
5545    12abc34xyz99abc55\=substitute_skip=1
5546    12abc34xyz99abc55\=substitute_skip=2
5547
5548/a(b)c|xyz/g,replace=<$0>
5549    abcdefabcpqr
5550    abxyzpqrabcxyz
5551    12abc34xyz\=substitute_stop=2
5552    12abc34xyz\=substitute_skip=1
5553
5554/a(b)c|xyz/replace=<$0>
5555    abcdefabcpqr
5556    12abc34xyz\=substitute_skip=1
5557    12abc34xyz\=substitute_stop=1
5558
5559/abc\rdef/
5560    abc\ndef
5561
5562/abc\rdef\x{0d}xyz/escaped_cr_is_lf
5563    abc\ndef\rxyz
5564\= Expect no match
5565    abc\ndef\nxyz
5566
5567/(?(*ACCEPT)xxx)/
5568
5569/(?(*atomic:xx)xxx)/
5570
5571/(?(*script_run:xxx)zzz)/
5572
5573/foobar/
5574    the foobar thing\=copy_matched_subject
5575    the foobar thing\=copy_matched_subject,zero_terminate
5576
5577/foobar/g
5578    the foobar thing foobar again\=copy_matched_subject
5579
5580/(*:XX)^abc/I
5581
5582/(*COMMIT:XX)^abc/I
5583
5584/(*ACCEPT:XX)^abc/I
5585
5586/abc/replace=xyz
5587    abc\=null_context
5588
5589/abc/replace=xyz,substitute_callout
5590    abc
5591\= Expect error message
5592    abc\=null_context
5593
5594/\[()]{65535}()/expand
5595
5596/\[()]{65535}(?<A>)/expand
5597
5598/a(?:(*ACCEPT))??bc/
5599    abc
5600    axy
5601
5602/a(*ACCEPT)??bc/
5603    abc
5604    axy
5605
5606/a(*ACCEPT:XX)??bc/mark
5607    abc
5608    axy
5609
5610/(*:\)?/
5611
5612/(*:\Q \E){5}/alt_verbnames
5613
5614/(?=abc)/I
5615
5616/(?|(X)|(XY))\1abc/I
5617
5618/(?|(a)|(bcde))(c)\2/I
5619
5620/(?|(a)|(bcde))(c)\1/I
5621
5622/(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'B'(?'A')/I,dupnames
5623
5624/(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'A'(?'A')/I,dupnames
5625
5626/((a|)+)+Z/I
5627
5628/((?=a))[abcd]/I
5629
5630/A(?:(*ACCEPT))?B/info
5631
5632/(A(*ACCEPT)??B)C/
5633    ABC
5634    AXY
5635
5636/(?<=(?<=a)b)c.*/I
5637    abc\=ph
5638\= Expect no match
5639    xbc\=ph
5640
5641/(?<=ab)c.*/I
5642    abc\=ph
5643\= Expect no match
5644    xbc\=ph
5645
5646/(?<=a(?<=a|a)c)/I
5647
5648/(?<=a(?<=a|ba)c)/I
5649
5650/(?<=(?<=a)b)(?<!abcd)/I
5651
5652/(?<=(?<=a)b)(?<!abcd)(?<=(?<=a)bcde)/I
5653
5654# Addition overflow
5655/( {32742} {42})(?<!\1{65481})/
5656
5657# Multiplication overflow
5658/(X{65535})(?<=\1{32770})/
5659
5660# ---- Non-atomic assertion tests ----
5661
5662# Expect error: not allowed as a condition
5663/(?(*napla:xx)bc)/
5664
5665/\A(*pla:.*\b(\w++))(?>.*?\b\1\b){3}/
5666    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
5667
5668/\A(*napla:.*\b(\w++))(?>.*?\b\1\b){3}/
5669    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
5670
5671/\A(?*.*\b(\w++))(?>.*?\b\1\b){3}/
5672    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
5673
5674/(*plb:(.)..|(.)...)(\1|\2)/
5675    abcdb\=offset=4
5676    abcda\=offset=4
5677
5678/(*naplb:(.)..|(.)...)(\1|\2)/
5679    abcdb\=offset=4
5680    abcda\=offset=4
5681
5682/(?<*(.)..|(.)...)(\1|\2)/
5683    abcdb\=offset=4
5684    abcda\=offset=4
5685
5686/(*non_atomic_positive_lookahead:ab)/B
5687
5688/(*non_atomic_positive_lookbehind:ab)/B
5689
5690/(*pla:ab+)/B
5691
5692/(*napla:ab+)/B
5693
5694/(*napla:)+/
5695
5696/(*naplb:)+/
5697
5698/(*napla:^x|^y)/I
5699
5700/(*napla:abc|abd)/I
5701
5702/(*napla:a|(.)(*ACCEPT)zz)\1../
5703    abcd
5704
5705/(*napla:a(*ACCEPT)zz|(.))\1../
5706    abcd
5707
5708/(*napla:a|(*COMMIT)(.))\1\1/
5709    aabc
5710\= Expect no match
5711    abbc
5712
5713/(*napla:a|(.))\1\1/
5714    aabc
5715    abbc
5716
5717# ----
5718
5719# Expect error (recursion => not fixed length)
5720/(\2)((?=(?<=\1)))/
5721
5722/c*+(?<=[bc])/
5723    abc\=ph
5724    ab\=ph
5725    abc\=ps
5726    ab\=ps
5727
5728/c++(?<=[bc])/
5729    abc\=ph
5730    ab\=ph
5731
5732/(?<=(?=.(?<=x)))/
5733    abx
5734    ab\=ph
5735    bxyz
5736    xyz
5737
5738/\z/
5739   abc\=ph
5740   abc\=ps
5741
5742/\Z/
5743   abc\=ph
5744   abc\=ps
5745   abc\n\=ph
5746   abc\n\=ps
5747
5748/(?![ab]).*/
5749    ab\=ph
5750
5751/c*+/
5752    ab\=ph,offset=2
5753
5754/\A\s*(a|(?:[^`]{28500}){4})/I
5755    a
5756
5757/\A\s*((?:[^`]{28500}){4})/I
5758
5759/\A\s*((?:[^`]{28500}){4}|a)/I
5760    a
5761
5762/(?<A>a)(?(<A>)b)((?<=b).*)/B
5763
5764/(?(1)b)((?<=b).*)/B
5765
5766/(?(R1)b)((?<=b).*)/B
5767
5768/(?(DEFINE)b)((?<=b).*)/B
5769
5770/(?(VERSION=10.4)b)((?<=b).*)/B
5771
5772/[aA]b[cC]/IB
5773
5774/[cc]abcd/I
5775
5776/[Cc]abcd/I
5777
5778/[c]abcd/I
5779
5780/(?:c|C)abcd/I
5781
5782/(a)?a/I
5783    manm
5784
5785/^(?|(\*)(*napla:\S*_(\2?+.+))|(\w)(?=\S*_(\2?+\1)))+_\2$/
5786    *abc_12345abc
5787
5788/^(?|(\*)(*napla:\S*_(\3?+.+))|(\w)(?=\S*_((\2?+\1))))+_\2$/
5789    *abc_12345abc
5790
5791/^((\1+)(?C)|\d)+133X$/
5792    111133X\=callout_capture
5793
5794/abc/replace=xyz,substitute_replacement_only
5795    123abc456
5796
5797/a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z,substitute_replacement_only
5798    "abcde-abcde-"
5799
5800/a(b)c|xyz/g,replace=<$0>,substitute_callout,substitute_replacement_only
5801    abcdefabcpqr
5802    abxyzpqrabcxyz
5803    12abc34xyz99abc55\=substitute_stop=2
5804    12abc34xyz99abc55\=substitute_skip=1
5805    12abc34xyz99abc55\=substitute_skip=2
5806
5807/a(..)d/replace=>$1<,substitute_matched
5808    xyzabcdxyzabcdxyz
5809    xyzabcdxyzabcdxyz\=ovector=2
5810\= Expect error
5811    xyzabcdxyzabcdxyz\=ovector=1
5812
5813/a(..)d/g,replace=>$1<,substitute_matched
5814    xyzabcdxyzabcdxyz
5815    xyzabcdxyzabcdxyz\=ovector=2
5816\= Expect error
5817    xyzabcdxyzabcdxyz\=ovector=1
5818    xyzabcdxyzabcdxyz\=ovector=1,substitute_unset_empty
5819
5820/55|a(..)d/g,replace=>$1<,substitute_matched
5821    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
5822\= Expect error
5823    xyz55abcdxyzabcdxyz\=ovector=2
5824
5825/55|a(..)d/replace=>$1<,substitute_matched
5826    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
5827
5828/55|a(..)d/replace=>$1<
5829    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
5830
5831/55|a(..)d/g,replace=>$1<
5832    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
5833
5834/abc/replace=,caseless
5835    XabcY
5836    XABCY
5837
5838/abc/replace=[4],caseless
5839    XabcY
5840    XABCY
5841
5842/abc/replace=*,caseless
5843    XabcY
5844    XABCY
5845    XabcY\=replace=
5846
5847# Expect non-fixed-length error
5848
5849"(?<=X(?(DEFINE)(.*))(?1))."
5850
5851/\sxxx\s/tables=1
5852\= Expect no match
5853    AB\x{85}xxx\x{a0}XYZ
5854
5855/\sxxx\s/tables=2
5856    AB\x{85}xxx\x{a0}XYZ
5857
5858/^\w+/tables=2
5859    École
5860
5861/^\w+/tables=3
5862    École
5863
5864#loadtables ./testbtables
5865
5866/^\w+/tables=3
5867    École
5868
5869/"(*MARK:>" 00 "<).."/hex,mark,no_start_optimize
5870    AB
5871    A\=ph
5872\= Expect no match
5873    A
5874
5875/"(*MARK:>" 00 "<).(?C1)."/hex,mark,no_start_optimize
5876    AB
5877
5878/(?(VERSION=0.0/
5879
5880# Perl has made \K in lookarounds an error. PCRE2 now rejects as well, unless
5881# explicitly authorized.
5882
5883/(?=a\Kb)ab/
5884
5885/(?=a\Kb)ab/allow_lookaround_bsk
5886    ab
5887
5888/(?!a\Kb)ac/
5889
5890/(?!a\Kb)ac/allow_lookaround_bsk
5891    ac
5892
5893/^abc(?<=b\Kc)d/
5894
5895/^abc(?<=b\Kc)d/allow_lookaround_bsk
5896    abcd
5897
5898/^abc(?<!b\Kq)d/
5899
5900/^abc(?<!b\Kq)d/,allow_lookaround_bsk
5901    abcd
5902
5903# ---------
5904
5905# End of testinput2
5906