• Home
  • History
  • Annotate
  • 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/(?<=a+)b/
193
194/(?<=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# This one is here because Perl behaves differently; see also the following.
328
329/^(a\1?){4}$/I
330\= Expect no match
331    aaaa
332    aaaaaa
333
334# Perl does not fail these two for the final subjects. Neither did PCRE until
335# release 8.01. The problem is in backtracking into a subpattern that contains
336# a recursive reference to itself. PCRE has now made these into atomic patterns.
337
338/^(xa|=?\1a){2}$/
339    xa=xaa
340\= Expect no match
341    xa=xaaa
342
343/^(xa|=?\1a)+$/
344    xa=xaa
345\= Expect no match
346    xa=xaaa
347
348# These are syntax tests from Perl 5.005
349
350/a[b-a]/
351
352/a[]b/
353
354/a[/
355
356/*a/
357
358/(*)b/
359
360/abc)/
361
362/(abc/
363
364/a**/
365
366/)(/
367
368/\1/
369
370/\2/
371
372/(a)|\2/
373
374/a[b-a]/Ii
375
376/a[]b/Ii
377
378/a[/Ii
379
380/*a/Ii
381
382/(*)b/Ii
383
384/abc)/Ii
385
386/(abc/Ii
387
388/a**/Ii
389
390/)(/Ii
391
392/:(?:/
393
394/(?<%)b/
395
396/a(?{)b/
397
398/a(?{{})b/
399
400/a(?{}})b/
401
402/a(?{"{"})b/
403
404/a(?{"{"}})b/
405
406/(?(1?)a|b)/
407
408/[a[:xyz:/
409
410/(?<=x+)y/
411
412/a{37,17}/
413
414/abc/\
415
416/abc/\i
417
418/(a)bc(d)/I
419    abcd
420    abcd\=copy=2
421    abcd\=copy=5
422
423/(.{20})/I
424    abcdefghijklmnopqrstuvwxyz
425    abcdefghijklmnopqrstuvwxyz\=copy=1
426    abcdefghijklmnopqrstuvwxyz\=get=1
427
428/(.{15})/I
429    abcdefghijklmnopqrstuvwxyz
430    abcdefghijklmnopqrstuvwxyz\=copy=1,get=1
431
432/(.{16})/I
433    abcdefghijklmnopqrstuvwxyz
434    abcdefghijklmnopqrstuvwxyz\=copy=1,get=1,getall
435
436/^(a|(bc))de(f)/I
437    adef\=get=1,get=2,get=3,get=4,getall
438    bcdef\=get=1,get=2,get=3,get=4,getall
439    adefghijk\=copy=0
440
441/^abc\00def/I
442    abc\00def\=copy=0,getall
443
444/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
445)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
446)?)?)?)?)?)?)?)?)?otherword/I
447
448/.*X/IB
449
450/.*X/IBs
451
452/(.*X|^B)/IB
453
454/(.*X|^B)/IBs
455
456/(?s)(.*X|^B)/IB
457
458/(?s:.*X|^B)/IB
459
460/\Biss\B/I,aftertext
461    Mississippi
462
463/iss/I,aftertext,altglobal
464    Mississippi
465
466/\Biss\B/I,aftertext,altglobal
467    Mississippi
468
469/\Biss\B/Ig,aftertext
470    Mississippi
471\= Expect no match
472    Mississippi\=anchored
473
474/(?<=[Ms])iss/Ig,aftertext
475    Mississippi
476
477/(?<=[Ms])iss/I,aftertext,altglobal
478    Mississippi
479
480/^iss/Ig,aftertext
481    ississippi
482
483/.*iss/Ig,aftertext
484    abciss\nxyzisspqr
485
486/.i./Ig,aftertext
487    Mississippi
488    Mississippi\=anchored
489    Missouri river
490    Missouri river\=anchored
491
492/^.is/Ig,aftertext
493    Mississippi
494
495/^ab\n/Ig,aftertext
496    ab\nab\ncd
497
498/^ab\n/Igm,aftertext
499    ab\nab\ncd
500
501/^/gm,newline=any
502    a\rb\nc\r\nxyz\=aftertext
503
504/abc/I
505
506/abc|bac/I
507
508/(abc|bac)/I
509
510/(abc|(c|dc))/I
511
512/(abc|(d|de)c)/I
513
514/a*/I
515
516/a+/I
517
518/(baa|a+)/I
519
520/a{0,3}/I
521
522/baa{3,}/I
523
524/"([^\\"]+|\\.)*"/I
525
526/(abc|ab[cd])/I
527
528/(a|.)/I
529
530/a|ba|\w/I
531
532/abc(?=pqr)/I
533
534/...(?<=abc)/I
535
536/abc(?!pqr)/I
537
538/ab./I
539
540/ab[xyz]/I
541
542/abc*/I
543
544/ab.c*/I
545
546/a.c*/I
547
548/.c*/I
549
550/ac*/I
551
552/(a.c*|b.c*)/I
553
554/a.c*|aba/I
555
556/.+a/I
557
558/(?=abcda)a.*/I
559
560/(?=a)a.*/I
561
562/a(b)*/I
563
564/a\d*/I
565
566/ab\d*/I
567
568/a(\d)*/I
569
570/abcde{0,0}/I
571
572/ab\d+/I
573
574/a(?(1)b)(.)/I
575
576/a(?(1)bag|big)(.)/I
577
578/a(?(1)bag|big)*(.)/I
579
580/a(?(1)bag|big)+(.)/I
581
582/a(?(1)b..|b..)(.)/I
583
584/ab\d{0}e/I
585
586/a?b?/I
587    a
588    b
589    ab
590    \
591\= Expect no match
592    \=notempty
593
594/|-/I
595    abcd
596    -abc
597    ab-c\=notempty
598\= Expect no match
599    abc\=notempty
600
601/^.?abcd/I
602
603/\(             # ( at start
604  (?:           # Non-capturing bracket
605  (?>[^()]+)    # Either a sequence of non-brackets (no backtracking)
606  |             # Or
607  (?R)          # Recurse - i.e. nested bracketed string
608  )*            # Zero or more contents
609  \)            # Closing )
610  /Ix
611    (abcd)
612    (abcd)xyz
613    xyz(abcd)
614    (ab(xy)cd)pqr
615    (ab(xycd)pqr
616    () abc ()
617    12(abcde(fsh)xyz(foo(bar))lmno)89
618\= Expect no match
619    abcd
620    abcd)
621    (abcd
622
623/\(  ( (?>[^()]+) | (?R) )* \) /Igx
624    (ab(xy)cd)pqr
625    1(abcd)(x(y)z)pqr
626
627/\(  (?: (?>[^()]+) | (?R) ) \) /Ix
628    (abcd)
629    (ab(xy)cd)
630    (a(b(c)d)e)
631    ((ab))
632\= Expect no match
633    ()
634
635/\(  (?: (?>[^()]+) | (?R) )? \) /Ix
636    ()
637    12(abcde(fsh)xyz(foo(bar))lmno)89
638
639/\(  ( (?>[^()]+) | (?R) )* \) /Ix
640    (ab(xy)cd)
641
642/\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
643    (ab(xy)cd)
644
645/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix
646    (ab(xy)cd)
647    (123ab(xy)cd)
648
649/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix
650    (ab(xy)cd)
651    (123ab(xy)cd)
652
653/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
654    (ab(xy)cd)
655
656/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
657    (abcd(xyz<p>qrs)123)
658
659/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
660    (ab(cd)ef)
661    (ab(cd(ef)gh)ij)
662
663/^[[:alnum:]]/IB
664
665/^[[:^alnum:]]/IB
666
667/^[[:alpha:]]/IB
668
669/^[[:^alpha:]]/IB
670
671/[_[:alpha:]]/I
672
673/^[[:ascii:]]/IB
674
675/^[[:^ascii:]]/IB
676
677/^[[:blank:]]/IB
678
679/^[[:^blank:]]/IB
680
681/[\n\x0b\x0c\x0d[:blank:]]/I
682
683/^[[:cntrl:]]/IB
684
685/^[[:digit:]]/IB
686
687/^[[:graph:]]/IB
688
689/^[[:lower:]]/IB
690
691/^[[:print:]]/IB
692
693/^[[:punct:]]/IB
694
695/^[[:space:]]/IB
696
697/^[[:upper:]]/IB
698
699/^[[:xdigit:]]/IB
700
701/^[[:word:]]/IB
702
703/^[[:^cntrl:]]/IB
704
705/^[12[:^digit:]]/IB
706
707/^[[:^blank:]]/IB
708
709/[01[:alpha:]%]/IB
710
711/[[.ch.]]/I
712
713/[[=ch=]]/I
714
715/[[:rhubarb:]]/I
716
717/[[:upper:]]/Ii
718    A
719    a
720
721/[[:lower:]]/Ii
722    A
723    a
724
725/((?-i)[[:lower:]])[[:lower:]]/Ii
726    ab
727    aB
728\= Expect no match
729    Ab
730    AB
731
732/[\200-\110]/I
733
734/^(?(0)f|b)oo/I
735
736# This one's here because of the large output vector needed
737
738/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\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
739     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
740
741# This one's here because Perl does this differently and PCRE2 can't at present
742
743/(main(O)?)+/I
744    mainmain
745    mainOmain
746
747# These are all cases where Perl does it differently (nested captures)
748
749/^(a(b)?)+$/I
750    aba
751
752/^(aa(bb)?)+$/I
753    aabbaa
754
755/^(aa|aa(bb))+$/I
756    aabbaa
757
758/^(aa(bb)??)+$/I
759    aabbaa
760
761/^(?:aa(bb)?)+$/I
762    aabbaa
763
764/^(aa(b(b))?)+$/I
765    aabbaa
766
767/^(?:aa(b(b))?)+$/I
768    aabbaa
769
770/^(?:aa(b(?:b))?)+$/I
771    aabbaa
772
773/^(?:aa(bb(?:b))?)+$/I
774    aabbbaa
775
776/^(?:aa(b(?:bb))?)+$/I
777    aabbbaa
778
779/^(?:aa(?:b(b))?)+$/I
780    aabbaa
781
782/^(?:aa(?:b(bb))?)+$/I
783    aabbbaa
784
785/^(aa(b(bb))?)+$/I
786    aabbbaa
787
788/^(aa(bb(bb))?)+$/I
789    aabbbbaa
790
791# ----------------
792
793/#/IBx
794
795/a#/IBx
796
797/[\s]/IB
798
799/[\S]/IB
800
801/a(?i)b/IB
802    ab
803    aB
804\= Expect no match
805    AB
806
807/(a(?i)b)/IB
808    ab
809    aB
810\= Expect no match
811    AB
812
813/   (?i)abc/IBx
814
815/#this is a comment
816  (?i)abc/IBx
817
818/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB
819
820/\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB
821
822/\Q\E/IB
823    \
824
825/\Q\Ex/IB
826
827/ \Q\E/IB
828
829/a\Q\E/IB
830  abc
831  bca
832  bac
833
834/a\Q\Eb/IB
835  abc
836
837/\Q\Eabc/IB
838
839/x*+\w/IB
840\= Expect no match
841    xxxxx
842
843/x?+/IB
844
845/x++/IB
846
847/x{1,3}+/B,no_auto_possess
848
849/x{1,3}+/Bi,no_auto_possess
850
851/[^x]{1,3}+/B,no_auto_possess
852
853/[^x]{1,3}+/Bi,no_auto_possess
854
855/(x)*+/IB
856
857/^(\w++|\s++)*$/I
858    now is the time for all good men to come to the aid of the party
859\= Expect no match
860    this is not a line with only words and spaces!
861
862/(\d++)(\w)/I
863    12345a
864\= Expect no match
865    12345+
866
867/a++b/I
868    aaab
869
870/(a++b)/I
871    aaab
872
873/(a++)b/I
874    aaab
875
876/([^()]++|\([^()]*\))+/I
877    ((abc(ade)ufh()()x
878
879/\(([^()]++|\([^()]+\))+\)/I
880    (abc)
881    (abc(def)xyz)
882\= Expect no match
883    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
884
885/(abc){1,3}+/IB
886
887/a+?+/I
888
889/a{2,3}?+b/I
890
891/(?U)a+?+/I
892
893/a{2,3}?+b/I,ungreedy
894
895/x(?U)a++b/IB
896    xaaaab
897
898/(?U)xa++b/IB
899    xaaaab
900
901/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/IB
902
903/^x(?U)a+b/IB
904
905/^x(?U)(a+)b/IB
906
907/[.x.]/I
908
909/[=x=]/I
910
911/[:x:]/I
912
913/\l/I
914
915/\L/I
916
917/\N{name}/I
918
919/\u/I
920
921/\U/I
922
923/a{1,3}b/ungreedy
924    ab
925
926/[/I
927
928/[a-/I
929
930/[[:space:]/I
931
932/[\s]/IB
933
934/[[:space:]]/IB
935
936/[[:space:]abcde]/IB
937
938/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/Ix
939    <>
940    <abcd>
941    <abc <123> hij>
942    <abc <def> hij>
943    <abc<>def>
944    <abc<>
945\= Expect no match
946    <abc
947
948/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
949
950/\$\<\.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
951
952/(.*)\d+\1/I
953
954/(.*)\d+/I
955
956/(.*)\d+\1/Is
957
958/(.*)\d+/Is
959
960/(.*(xyz))\d+\2/I
961
962/((.*))\d+\1/I
963    abc123bc
964
965/a[b]/I
966
967/(?=a).*/I
968
969/(?=abc).xyz/Ii
970
971/(?=abc)(?i).xyz/I
972
973/(?=a)(?=b)/I
974
975/(?=.)a/I
976
977/((?=abcda)a)/I
978
979/((?=abcda)ab)/I
980
981/()a/I
982
983/(?:(?=.)|(?<!x))a/I
984
985/(?(1)ab|ac)(.)/I
986
987/(?(1)abz|acz)(.)/I
988
989/(?(1)abz)(.)/I
990
991/(?(1)abz)(1)23/I
992
993/(a)+/I
994
995/(a){2,3}/I
996
997/(a)*/I
998
999/[a]/I
1000
1001/[ab]/I
1002
1003/[ab]/I
1004
1005/[^a]/I
1006
1007/\d456/I
1008
1009/\d456/I
1010
1011/a^b/I
1012
1013/^a/Im
1014  abcde
1015  xy\nabc
1016\= Expect no match
1017  xyabc
1018
1019/c|abc/I
1020
1021/(?i)[ab]/I
1022
1023/[ab](?i)cd/I
1024
1025/abc(?C)def/I
1026    abcdef
1027    1234abcdef
1028\= Expect no match
1029    abcxyz
1030    abcxyzf
1031
1032/abc(?C)de(?C1)f/I
1033    123abcdef
1034
1035/(?C1)\dabc(?C2)def/I
1036    1234abcdef
1037\= Expect no match
1038    abcdef
1039
1040/(?C1)\dabc(?C2)def/I
1041    1234abcdef
1042\= Expect no match
1043    abcdef
1044
1045/(?C255)ab/I
1046
1047/(?C256)ab/I
1048
1049/(?Cab)xx/I
1050
1051/(?C12vr)x/I
1052
1053/abc(?C)def/I
1054    \x83\x0\x61bcdef
1055
1056/(abc)(?C)de(?C1)f/I
1057    123abcdef
1058    123abcdef\=callout_capture
1059    123abcdefC-\=callout_none
1060\= Expect no match
1061    123abcdef\=callout_fail=1
1062
1063/(?C0)(abc(?C1))*/I
1064    abcabcabc
1065    abcabc\=callout_fail=1:3
1066    abcabcabc\=callout_fail=1:3
1067
1068/(\d{3}(?C))*/I
1069    123\=callout_capture
1070    123456\=callout_capture
1071    123456789\=callout_capture
1072
1073/((xyz)(?C)p|(?C1)xyzabc)/I
1074    xyzabc\=callout_capture
1075
1076/(X)((xyz)(?C)p|(?C1)xyzabc)/I
1077    Xxyzabc\=callout_capture
1078
1079/(?=(abc))(?C)abcdef/I
1080    abcdef\=callout_capture
1081
1082/(?!(abc)(?C1)d)(?C2)abcxyz/I
1083    abcxyz\=callout_capture
1084
1085/(?<=(abc)(?C))xyz/I
1086   abcxyz\=callout_capture
1087
1088/a(b+)(c*)(?C1)/I
1089\= Expect no match
1090    abbbbbccc\=callout_data=1
1091
1092/a(b+?)(c*?)(?C1)/I
1093\= Expect no match
1094    abbbbbccc\=callout_data=1
1095
1096/(?C)abc/I
1097
1098/(?C)^abc/I
1099
1100/(?C)a|b/I
1101
1102/x(ab|(bc|(de|(?R))))/I
1103    xab
1104    xbc
1105    xde
1106    xxab
1107    xxxab
1108\= Expect no match
1109    xyab
1110
1111/^([^()]|\((?1)*\))*$/I
1112    abc
1113    a(b)c
1114    a(b(c))d
1115\= Expect no match)
1116    a(b(c)d
1117
1118/^>abc>([^()]|\((?1)*\))*<xyz<$/I
1119   >abc>123<xyz<
1120   >abc>1(2)3<xyz<
1121   >abc>(1(2)3)<xyz<
1122
1123/(a(?1)b)/IB
1124
1125/(a(?1)+b)/IB
1126
1127/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/I
1128    12
1129    (((2+2)*-3)-7)
1130    -12
1131\= Expect no match
1132    ((2+2)*-3)-7)
1133
1134/^(x(y|(?1){2})z)/I
1135    xyz
1136    xxyzxyzz
1137\= Expect no match
1138    xxyzz
1139    xxyzxyzxyzz
1140
1141/((< (?: (?(R) \d++  | [^<>]*+) | (?2)) * >))/Ix
1142    <>
1143    <abcd>
1144    <abc <123> hij>
1145    <abc <def> hij>
1146    <abc<>def>
1147    <abc<>
1148\= Expect no match
1149    <abc
1150
1151/(?1)/I
1152
1153/((?2)(abc)/I
1154
1155/^(abc)def(?1)/I
1156    abcdefabc
1157
1158/^(a|b|c)=(?1)+/I
1159    a=a
1160    a=b
1161    a=bc
1162
1163/^(a|b|c)=((?1))+/I
1164    a=a
1165    a=b
1166    a=bc
1167
1168/a(?P<name1>b|c)d(?P<longername2>e)/IB
1169    abde
1170    acde
1171
1172/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/IB
1173
1174/(?P<a>a)...(?P=a)bbb(?P>a)d/IB
1175
1176/^\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
1177    1221
1178    Satan, oscillate my metallic sonatas!
1179    A man, a plan, a canal: Panama!
1180    Able was I ere I saw Elba.
1181\= Expect no match
1182    The quick brown fox
1183
1184/((?(R)a|b))\1(?1)?/I
1185  bb
1186  bbaa
1187
1188/(.*)a/Is
1189
1190/(.*)a\1/Is
1191
1192/(.*)a(b)\2/Is
1193
1194/((.*)a|(.*)b)z/Is
1195
1196/((.*)a|(.*)b)z\1/Is
1197
1198/((.*)a|(.*)b)z\2/Is
1199
1200/((.*)a|(.*)b)z\3/Is
1201
1202/((.*)a|^(.*)b)z\3/Is
1203
1204/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is
1205
1206/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is
1207
1208/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is
1209
1210/(a)(bc)/IB,no_auto_capture
1211  abc
1212
1213/(?P<one>a)(bc)/IB,no_auto_capture
1214  abc
1215
1216/(a)(?P<named>bc)/IB,no_auto_capture
1217
1218/(aaa(?C1)bbb|ab)/I
1219   aaabbb
1220   aaabbb\=callout_data=0
1221   aaabbb\=callout_data=1
1222\= Expect no match
1223   aaabbb\=callout_data=-1
1224
1225/ab(?P<one>cd)ef(?P<two>gh)/I
1226    abcdefgh
1227    abcdefgh\=copy=1,get=two
1228    abcdefgh\=copy=one,copy=two
1229    abcdefgh\=copy=three
1230
1231/(?P<Tes>)(?P<Test>)/IB
1232
1233/(?P<Test>)(?P<Tes>)/IB
1234
1235/(?P<Z>zz)(?P<A>aa)/I
1236    zzaa\=copy=Z
1237    zzaa\=copy=A
1238
1239/(?P<x>eks)(?P<x>eccs)/I
1240
1241/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/I
1242
1243"\[((?P<elem>\d+)(,(?P>elem))*)\]"I
1244    [10,20,30,5,5,4,4,2,43,23,4234]
1245\= Expect no match
1246    []
1247
1248"\[((?P<elem>\d+)(,(?P>elem))*)?\]"I
1249    [10,20,30,5,5,4,4,2,43,23,4234]
1250    []
1251
1252/(a(b(?2)c))?/IB
1253
1254/(a(b(?2)c))*/IB
1255
1256/(a(b(?2)c)){0,2}/IB
1257
1258/[ab]{1}+/B
1259
1260/()(?1){1}/B
1261
1262/()(?1)/B
1263
1264/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
1265     Baby Bjorn Active Carrier - With free SHIPPING!!
1266
1267/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
1268     Baby Bjorn Active Carrier - With free SHIPPING!!
1269
1270/a*.*b/IB
1271
1272/(a|b)*.?c/IB
1273
1274/abc(?C255)de(?C)f/IB
1275
1276/abcde/IB,auto_callout
1277  abcde
1278\= Expect no match
1279  abcdfe
1280
1281/a*b/IB,auto_callout
1282  ab
1283  aaaab
1284  aaaacb
1285
1286/a*b/IB,auto_callout
1287  ab
1288  aaaab
1289  aaaacb
1290
1291/a+b/IB,auto_callout
1292  ab
1293  aaaab
1294\= Expect no match
1295  aaaacb
1296
1297/(abc|def)x/IB,auto_callout
1298  abcx
1299  defx
1300\= Expect no match
1301  abcdefzx
1302
1303/(abc|def)x/IB,auto_callout
1304  abcx
1305  defx
1306\= Expect no match
1307  abcdefzx
1308
1309/(ab|cd){3,4}/I,auto_callout
1310  ababab
1311  abcdabcd
1312  abcdcdcdcdcd
1313
1314/([ab]{,4}c|xy)/IB,auto_callout
1315\= Expect no match
1316    Note: that { does NOT introduce a quantifier
1317
1318/([ab]{,4}c|xy)/IB,auto_callout
1319\= Expect no match
1320    Note: that { does NOT introduce a quantifier
1321
1322/([ab]{1,4}c|xy){4,5}?123/IB,auto_callout
1323    aacaacaacaacaac123
1324
1325/\b.*/I
1326  ab cd\=offset=1
1327
1328/\b.*/Is
1329  ab cd\=startoffset=1
1330
1331/(?!.bcd).*/I
1332  Xbcd12345
1333
1334/abcde/I
1335    ab\=ps
1336    abc\=ps
1337    abcd\=ps
1338    abcde\=ps
1339    the quick brown abc\=ps
1340\= Expect no match\=ps
1341    the quick brown abxyz fox\=ps
1342
1343"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I
1344    13/05/04\=ps
1345    13/5/2004\=ps
1346    02/05/09\=ps
1347    1\=ps
1348    1/2\=ps
1349    1/2/0\=ps
1350    1/2/04\=ps
1351    0\=ps
1352    02/\=ps
1353    02/0\=ps
1354    02/1\=ps
1355\= Expect no match\=ps
1356    \=ps
1357    123\=ps
1358    33/4/04\=ps
1359    3/13/04\=ps
1360    0/1/2003\=ps
1361    0/\=ps
1362    02/0/\=ps
1363    02/13\=ps
1364
1365/0{0,2}ABC/I
1366
1367/\d{3,}ABC/I
1368
1369/\d*ABC/I
1370
1371/[abc]+DE/I
1372
1373/[abc]?123/I
1374    123\=ps
1375    a\=ps
1376    b\=ps
1377    c\=ps
1378    c12\=ps
1379    c123\=ps
1380
1381/^(?:\d){3,5}X/I
1382    1\=ps
1383    123\=ps
1384    123X
1385    1234\=ps
1386    1234X
1387    12345\=ps
1388    12345X
1389\= Expect no match
1390    1X
1391    123456\=ps
1392
1393"<(\w+)/?>(.)*</(\1)>"Igms
1394    <!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
1395
1396/line\nbreak/I
1397    this is a line\nbreak
1398    line one\nthis is a line\nbreak in the second line
1399
1400/line\nbreak/I,firstline
1401    this is a line\nbreak
1402\= Expect no match
1403    line one\nthis is a line\nbreak in the second line
1404
1405/line\nbreak/Im,firstline
1406    this is a line\nbreak
1407\= Expect no match
1408    line one\nthis is a line\nbreak in the second line
1409
1410/(?i)(?-i)AbCd/I
1411    AbCd
1412\= Expect no match
1413    abcd
1414
1415/a{11111111111111111111}/I
1416
1417/(){64294967295}/I
1418
1419/(){2,4294967295}/I
1420
1421"(?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
1422    abcdefghijklAkB
1423
1424"(?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
1425    abcdefghijklAkB
1426
1427"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I
1428    abcdefghijklAkB
1429
1430"(?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
1431    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1432
1433"(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
1434    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1435
1436/[^()]*(?:\((?R)\)[^()]*)*/I
1437    (this(and)that
1438    (this(and)that)
1439    (this(and)that)stuff
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
1449/(?:\((?R)\))*[^()]*/I
1450    (this(and)that
1451    (this(and)that)
1452    ((this))
1453
1454/(?:\((?R)\))|[^()]*/I
1455    (this(and)that
1456    (this(and)that)
1457    (this)
1458    ((this))
1459
1460/\x{0000ff}/I
1461
1462/^((?P<A>a1)|(?P<A>a2)b)/I
1463
1464/^((?P<A>a1)|(?P<A>a2)b)/I,dupnames
1465    a1b\=copy=A
1466    a2b\=copy=A
1467    a1b\=copy=Z,copy=A
1468
1469/(?|(?<a>)(?<b>)(?<a>)|(?<a>)(?<b>)(?<a>))/I,dupnames
1470
1471/^(?P<A>a)(?P<A>b)/I,dupnames
1472    ab\=copy=A
1473
1474/^(?P<A>a)(?P<A>b)|cd/I,dupnames
1475    ab\=copy=A
1476    cd\=copy=A
1477
1478/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/I,dupnames
1479    cdefgh\=copy=A
1480
1481/^((?P<A>a1)|(?P<A>a2)b)/I,dupnames
1482    a1b\=get=A
1483    a2b\=get=A
1484    a1b\=get=Z,get=A
1485
1486/^(?P<A>a)(?P<A>b)/I,dupnames
1487    ab\=get=A
1488
1489/^(?P<A>a)(?P<A>b)|cd/I,dupnames
1490    ab\=get=A
1491    cd\=get=A
1492
1493/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/I,dupnames
1494    cdefgh\=get=A
1495
1496/(?J)^((?P<A>a1)|(?P<A>a2)b)/I
1497    a1b\=copy=A
1498    a2b\=copy=A
1499
1500/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/I
1501
1502# In this next test, J is not set at the outer level; consequently it isn't set
1503# in the pattern's options; consequently pcre2_substring_get_byname() produces
1504# a random value.
1505
1506/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/I
1507    a bc d\=copy=A,copy=B,copy=C
1508
1509/^(?P<A>a)?(?(A)a|b)/I
1510    aabc
1511    bc
1512\= Expect no match
1513    abc
1514
1515/(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
1516    bXaX
1517
1518/(?:(?(2y)a|b)(X))+/I
1519
1520/(?:(?(ZA)a|b)(?P<ZZ>X))+/I
1521
1522/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
1523    bbXaaX
1524
1525/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
1526    (b)\\Xa\\X
1527
1528/(?P<ABC/I
1529
1530/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
1531    bXXaYYaY
1532    bXYaXXaX
1533
1534/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
1535    bXXaYYaY
1536
1537/\s*,\s*/I
1538    \x0b,\x0b
1539    \x0c,\x0d
1540
1541/^abc/Im,newline=lf
1542    xyz\nabc
1543    xyz\r\nabc
1544\= Expect no match
1545    xyz\rabc
1546    xyzabc\r
1547    xyzabc\rpqr
1548    xyzabc\r\n
1549    xyzabc\r\npqr
1550
1551/^abc/Im,newline=crlf
1552    xyz\r\nabclf>
1553\= Expect no match
1554    xyz\nabclf
1555    xyz\rabclf
1556
1557/^abc/Im,newline=cr
1558    xyz\rabc
1559\= Expect no match
1560    xyz\nabc
1561    xyz\r\nabc
1562
1563/^abc/Im,newline=bad
1564
1565/.*/I,newline=lf
1566    abc\ndef
1567    abc\rdef
1568    abc\r\ndef
1569
1570/.*/I,newline=cr
1571    abc\ndef
1572    abc\rdef
1573    abc\r\ndef
1574
1575/.*/I,newline=crlf
1576    abc\ndef
1577    abc\rdef
1578    abc\r\ndef
1579
1580/\w+(.)(.)?def/Is
1581    abc\ndef
1582    abc\rdef
1583    abc\r\ndef
1584
1585/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
1586
1587/()()()()()()()()()()()()()()()()()()()()
1588 ()()()()()()()()()()()()()()()()()()()()
1589 ()()()()()()()()()()()()()()()()()()()()
1590 ()()()()()()()()()()()()()()()()()()()()
1591 ()()()()()()()()()()()()()()()()()()()()
1592 (.(.))/Ix
1593    XY\=ovector=133
1594
1595/(a*b|(?i:c*(?-i)d))/I
1596
1597/()[ab]xyz/I
1598
1599/(|)[ab]xyz/I
1600
1601/(|c)[ab]xyz/I
1602
1603/(|c?)[ab]xyz/I
1604
1605/(d?|c?)[ab]xyz/I
1606
1607/(d?|c)[ab]xyz/I
1608
1609/^a*b\d/IB
1610
1611/^a*+b\d/IB
1612
1613/^a*?b\d/IB
1614
1615/^a+A\d/IB
1616    aaaA5
1617\= Expect no match
1618    aaaa5
1619
1620/^a*A\d/IBi
1621    aaaA5
1622    aaaa5
1623
1624/(a*|b*)[cd]/I
1625
1626/(a+|b*)[cd]/I
1627
1628/(a*|b+)[cd]/I
1629
1630/(a+|b+)[cd]/I
1631
1632/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
1633 ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
1634 (((
1635 a
1636 ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
1637 ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
1638 )))
1639/Ix
1640  large nest
1641
1642/a*\d/B
1643
1644/a*\D/B
1645
1646/0*\d/B
1647
1648/0*\D/B
1649
1650/a*\s/B
1651
1652/a*\S/B
1653
1654/ *\s/B
1655
1656/ *\S/B
1657
1658/a*\w/B
1659
1660/a*\W/B
1661
1662/=*\w/B
1663
1664/=*\W/B
1665
1666/\d*a/B
1667
1668/\d*2/B
1669
1670/\d*\d/B
1671
1672/\d*\D/B
1673
1674/\d*\s/B
1675
1676/\d*\S/B
1677
1678/\d*\w/B
1679
1680/\d*\W/B
1681
1682/\D*a/B
1683
1684/\D*2/B
1685
1686/\D*\d/B
1687
1688/\D*\D/B
1689
1690/\D*\s/B
1691
1692/\D*\S/B
1693
1694/\D*\w/B
1695
1696/\D*\W/B
1697
1698/\s*a/B
1699
1700/\s*2/B
1701
1702/\s*\d/B
1703
1704/\s*\D/B
1705
1706/\s*\s/B
1707
1708/\s*\S/B
1709
1710/\s*\w/B
1711
1712/\s*\W/B
1713
1714/\S*a/B
1715
1716/\S*2/B
1717
1718/\S*\d/B
1719
1720/\S*\D/B
1721
1722/\S*\s/B
1723
1724/\S*\S/B
1725
1726/\S*\w/B
1727
1728/\S*\W/B
1729
1730/\w*a/B
1731
1732/\w*2/B
1733
1734/\w*\d/B
1735
1736/\w*\D/B
1737
1738/\w*\s/B
1739
1740/\w*\S/B
1741
1742/\w*\w/B
1743
1744/\w*\W/B
1745
1746/\W*a/B
1747
1748/\W*2/B
1749
1750/\W*\d/B
1751
1752/\W*\D/B
1753
1754/\W*\s/B
1755
1756/\W*\S/B
1757
1758/\W*\w/B
1759
1760/\W*\W/B
1761
1762/[^a]+a/B
1763
1764/[^a]+a/Bi
1765
1766/[^a]+A/Bi
1767
1768/[^a]+b/B
1769
1770/[^a]+\d/B
1771
1772/a*[^a]/B
1773
1774/(?P<abc>x)(?P<xyz>y)/I
1775    xy\=copy=abc,copy=xyz
1776
1777/(?<abc>x)(?'xyz'y)/I
1778    xy\=copy=abc,copy=xyz
1779
1780/(?<abc'x)(?'xyz'y)/I
1781
1782/(?<abc>x)(?'xyz>y)/I
1783
1784/(?P'abc'x)(?P<xyz>y)/I
1785
1786/^(?:(?(ZZ)a|b)(?<ZZ>X))+/
1787    bXaX
1788    bXbX
1789\= Expect no match
1790    aXaX
1791    aXbX
1792
1793/^(?P>abc)(?<abcd>xxx)/
1794
1795/^(?P>abc)(?<abc>x|y)/
1796    xx
1797    xy
1798    yy
1799    yx
1800
1801/^(?P>abc)(?P<abc>x|y)/
1802    xx
1803    xy
1804    yy
1805    yx
1806
1807/^((?(abc)a|b)(?<abc>x|y))+/
1808    bxay
1809    bxby
1810\= Expect no match
1811    axby
1812
1813/^(((?P=abc)|X)(?<abc>x|y))+/
1814    XxXxxx
1815    XxXyyx
1816    XxXyxx
1817\= Expect no match
1818    x
1819
1820/^(?1)(abc)/
1821    abcabc
1822
1823/^(?:(?:\1|X)(a|b))+/
1824    Xaaa
1825    Xaba
1826
1827/^[\E\Qa\E-\Qz\E]+/B
1828
1829/^[a\Q]bc\E]/B
1830
1831/^[a-\Q\E]/B
1832
1833/^(?P>abc)[()](?<abc>)/B
1834
1835/^((?(abc)y)[()](?P<abc>x))+/B
1836    (xy)x
1837
1838/^(?P>abc)\Q()\E(?<abc>)/B
1839
1840/^(?P>abc)[a\Q(]\E(](?<abc>)/B
1841
1842/^(?P>abc) # this is (a comment)
1843  (?<abc>)/Bx
1844
1845/^\W*(?:(?<one>(?<two>.)\W*(?&one)\W*\k<two>|)|(?<three>(?<four>.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii
1846    1221
1847    Satan, oscillate my metallic sonatas!
1848    A man, a plan, a canal: Panama!
1849    Able was I ere I saw Elba.
1850\= Expect no match
1851    The quick brown fox
1852
1853/(?=(\w+))\1:/I
1854    abcd:
1855
1856/(?=(?'abc'\w+))\k<abc>:/I
1857    abcd:
1858
1859/(?'abc'a|b)(?<abc>d|e)\k<abc>{2}/dupnames
1860    adaa
1861\= Expect no match
1862    addd
1863    adbb
1864
1865/(?'abc'a|b)(?<abc>d|e)(?&abc){2}/dupnames
1866    bdaa
1867    bdab
1868\= Expect no match
1869    bddd
1870
1871/(?(<bc))/
1872
1873/(?(''))/
1874
1875/(?('R')stuff)/
1876
1877/((abc (?(R) (?(R1)1) (?(R2)2) X  |  (?1)  (?2)   (?R) ))) /x
1878    abcabc1Xabc2XabcXabcabc
1879
1880/(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
1881    abcabc1Xabc2XabcXabcabc
1882
1883/(?<A> (?'B' abc (?(R) (?(R&C)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
1884
1885/^(?(DEFINE) abc | xyz ) /x
1886
1887/(?(DEFINE) abc) xyz/Ix
1888
1889/(a|)*\d/
1890  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4\=ovector=0
1891\= Expect no match
1892  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=0
1893
1894/^a.b/newline=lf
1895    a\rb
1896\= Expect no match
1897    a\nb
1898
1899/^a.b/newline=cr
1900    a\nb
1901\= Expect no match
1902    a\rb
1903
1904/^a.b/newline=anycrlf
1905    a\x85b
1906\= Expect no match
1907    a\rb
1908
1909/^a.b/newline=any
1910\= Expect no match
1911    a\nb
1912    a\rb
1913    a\x85b
1914
1915/^abc./gmx,newline=any
1916    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
1917
1918/abc.$/gmx,newline=any
1919    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7 abc9
1920
1921/^a\Rb/bsr=unicode
1922    a\nb
1923    a\rb
1924    a\r\nb
1925    a\x0bb
1926    a\x0cb
1927    a\x85b
1928\= Expect no match
1929    a\n\rb
1930
1931/^a\R*b/bsr=unicode
1932    ab
1933    a\nb
1934    a\rb
1935    a\r\nb
1936    a\x0bb
1937    a\x0cb
1938    a\x85b
1939    a\n\rb
1940    a\n\r\x85\x0cb
1941
1942/^a\R+b/bsr=unicode
1943    a\nb
1944    a\rb
1945    a\r\nb
1946    a\x0bb
1947    a\x0cb
1948    a\x85b
1949    a\n\rb
1950    a\n\r\x85\x0cb
1951\= Expect no match
1952    ab
1953
1954/^a\R{1,3}b/bsr=unicode
1955    a\nb
1956    a\n\rb
1957    a\n\r\x85b
1958    a\r\n\r\nb
1959    a\r\n\r\n\r\nb
1960    a\n\r\n\rb
1961    a\n\n\r\nb
1962\= Expect no match
1963    a\n\n\n\rb
1964    a\r
1965
1966/(?&abc)X(?<abc>P)/I
1967    abcPXP123
1968
1969/(?1)X(?<abc>P)/I
1970    abcPXP123
1971
1972/(?:a(?&abc)b)*(?<abc>x)/
1973    123axbaxbaxbx456
1974    123axbaxbaxb456
1975
1976/(?:a(?&abc)b){1,5}(?<abc>x)/
1977    123axbaxbaxbx456
1978
1979/(?:a(?&abc)b){2,5}(?<abc>x)/
1980    123axbaxbaxbx456
1981
1982/(?:a(?&abc)b){2,}(?<abc>x)/
1983    123axbaxbaxbx456
1984
1985/(abc)(?i:(?1))/
1986    defabcabcxyz
1987\= Expect no match
1988    DEFabcABCXYZ
1989
1990/(abc)(?:(?i)(?1))/
1991    defabcabcxyz
1992\= Expect no match
1993    DEFabcABCXYZ
1994
1995/^(a)\g-2/
1996
1997/^(a)\g/
1998
1999/^(a)\g{0}/
2000
2001/^(a)\g{3/
2002
2003/^(a)\g{aa}/
2004
2005/^a.b/newline=lf
2006    a\rb
2007\= Expect no match
2008    a\nb
2009
2010/.+foo/
2011    afoo
2012\= Expect no match
2013    \r\nfoo
2014    \nfoo
2015
2016/.+foo/newline=crlf
2017    afoo
2018    \nfoo
2019\= Expect no match
2020    \r\nfoo
2021
2022/.+foo/newline=any
2023    afoo
2024\= Expect no match
2025    \nfoo
2026    \r\nfoo
2027
2028/.+foo/s
2029    afoo
2030    \r\nfoo
2031    \nfoo
2032
2033/^$/gm,newline=any
2034    abc\r\rxyz
2035    abc\n\rxyz
2036\= Expect no match
2037    abc\r\nxyz
2038
2039/(?m)^$/g,newline=any,aftertext
2040    abc\r\n\r\n
2041
2042/(?m)^$|^\r\n/g,newline=any,aftertext
2043    abc\r\n\r\n
2044
2045/(?m)$/g,newline=any,aftertext
2046    abc\r\n\r\n
2047
2048/abc.$/gmx,newline=anycrlf
2049    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
2050
2051/^X/m
2052    XABC
2053\= Expect no match
2054    XABC\=notbol
2055
2056/(ab|c)(?-1)/B
2057    abc
2058
2059/xy(?+1)(abc)/B
2060    xyabcabc
2061\= Expect no match
2062    xyabc
2063
2064/x(?-0)y/
2065
2066/x(?-1)y/
2067
2068/x(?+0)y/
2069
2070/x(?+1)y/
2071
2072/^(abc)?(?(-1)X|Y)/B
2073    abcX
2074    Y
2075\= Expect no match
2076    abcY
2077
2078/^((?(+1)X|Y)(abc))+/B
2079    YabcXabc
2080    YabcXabcXabc
2081\= Expect no match
2082    XabcXabc
2083
2084/(?(-1)a)/B
2085
2086/((?(-1)a))/B
2087
2088/((?(-2)a))/B
2089
2090/^(?(+1)X|Y)(.)/B
2091    Y!
2092
2093/(?<A>tom|bon)-\k{A}/
2094    tom-tom
2095    bon-bon
2096\= Expect no match
2097    tom-bon
2098
2099/\g{A/
2100
2101/(?|(abc)|(xyz))/B
2102   >abc<
2103   >xyz<
2104
2105/(x)(?|(abc)|(xyz))(x)/B
2106    xabcx
2107    xxyzx
2108
2109/(x)(?|(abc)(pqr)|(xyz))(x)/B
2110    xabcpqrx
2111    xxyzx
2112
2113/\H++X/B
2114\= Expect no match
2115    XXXX
2116
2117/\H+\hY/B
2118    XXXX Y
2119
2120/\H+ Y/B
2121
2122/\h+A/B
2123
2124/\v*B/B
2125
2126/\V+\x0a/B
2127
2128/A+\h/B
2129
2130/ *\H/B
2131
2132/A*\v/B
2133
2134/\x0b*\V/B
2135
2136/\d+\h/B
2137
2138/\d*\v/B
2139
2140/S+\h\S+\v/B
2141
2142/\w{3,}\h\w+\v/B
2143
2144/\h+\d\h+\w\h+\S\h+\H/B
2145
2146/\v+\d\v+\w\v+\S\v+\V/B
2147
2148/\H+\h\H+\d/B
2149
2150/\V+\v\V+\w/B
2151
2152/\( (?: [^()]* | (?R) )* \)/x
2153(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(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
2154
2155/[\E]AAA/
2156
2157/[\Q\E]AAA/
2158
2159/[^\E]AAA/
2160
2161/[^\Q\E]AAA/
2162
2163/[\E^]AAA/
2164
2165/[\Q\E^]AAA/
2166
2167/A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/B
2168
2169/^a+(*FAIL)/auto_callout
2170\= Expect no match
2171    aaaaaa
2172
2173/a+b?c+(*FAIL)/auto_callout
2174\= Expect no match
2175    aaabccc
2176
2177/a+b?(*PRUNE)c+(*FAIL)/auto_callout
2178\= Expect no match
2179    aaabccc
2180
2181/a+b?(*COMMIT)c+(*FAIL)/auto_callout
2182\= Expect no match
2183    aaabccc
2184
2185/a+b?(*SKIP)c+(*FAIL)/auto_callout
2186\= Expect no match
2187    aaabcccaaabccc
2188
2189/a+b?(*THEN)c+(*FAIL)/auto_callout
2190\= Expect no match
2191    aaabccc
2192
2193/a(*MARK)b/
2194
2195/(?i:A{1,}\6666666666)/
2196
2197/\g6666666666/
2198
2199/[\g6666666666]/B
2200
2201/(?1)\c[/
2202
2203/.+A/newline=crlf
2204\= Expect no match
2205    \r\nA
2206
2207/\nA/newline=crlf
2208    \r\nA
2209
2210/[\r\n]A/newline=crlf
2211    \r\nA
2212
2213/(\r|\n)A/newline=crlf
2214    \r\nA
2215
2216/a(*CR)b/
2217
2218/(*CR)a.b/
2219    a\nb
2220\= Expect no match
2221    a\rb
2222
2223/(*CR)a.b/newline=lf
2224    a\nb
2225\= Expect no match
2226    a\rb
2227
2228/(*LF)a.b/newline=CRLF
2229    a\rb
2230\= Expect no match
2231    a\nb
2232
2233/(*CRLF)a.b/
2234    a\rb
2235    a\nb
2236\= Expect no match
2237    a\r\nb
2238
2239/(*ANYCRLF)a.b/newline=CR
2240\= Expect no match
2241    a\rb
2242    a\nb
2243    a\r\nb
2244
2245/(*ANY)a.b/newline=cr
2246\= Expect no match
2247    a\rb
2248    a\nb
2249    a\r\nb
2250    a\x85b
2251
2252/(*ANY).*/g
2253    abc\r\ndef
2254
2255/(*ANYCRLF).*/g
2256    abc\r\ndef
2257
2258/(*CRLF).*/g
2259    abc\r\ndef
2260
2261/a\Rb/I,bsr=anycrlf
2262    a\rb
2263    a\nb
2264    a\r\nb
2265\= Expect no match
2266    a\x85b
2267    a\x0bb
2268
2269/a\Rb/I,bsr=unicode
2270    a\rb
2271    a\nb
2272    a\r\nb
2273    a\x85b
2274    a\x0bb
2275
2276/a\R?b/I,bsr=anycrlf
2277    a\rb
2278    a\nb
2279    a\r\nb
2280\= Expect no match
2281    a\x85b
2282    a\x0bb
2283
2284/a\R?b/I,bsr=unicode
2285    a\rb
2286    a\nb
2287    a\r\nb
2288    a\x85b
2289    a\x0bb
2290
2291/a\R{2,4}b/I,bsr=anycrlf
2292    a\r\n\nb
2293    a\n\r\rb
2294    a\r\n\r\n\r\n\r\nb
2295\= Expect no match
2296    a\x85\x85b
2297    a\x0b\x0bb
2298
2299/a\R{2,4}b/I,bsr=unicode
2300    a\r\rb
2301    a\n\n\nb
2302    a\r\n\n\r\rb
2303    a\x85\x85b
2304    a\x0b\x0bb
2305\= Expect no match
2306    a\r\r\r\r\rb
2307
2308/(*BSR_ANYCRLF)a\Rb/I
2309    a\nb
2310    a\rb
2311
2312/(*BSR_UNICODE)a\Rb/I
2313    a\x85b
2314
2315/(*BSR_ANYCRLF)(*CRLF)a\Rb/I
2316    a\nb
2317    a\rb
2318
2319/(*CRLF)(*BSR_UNICODE)a\Rb/I
2320    a\x85b
2321
2322/(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
2323
2324/(?<a>)(?&)/
2325
2326/(?<abc>)(?&a)/
2327
2328/(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
2329
2330/(?+-a)/
2331
2332/(?-+a)/
2333
2334/(?(-1))/
2335
2336/(?(+10))/
2337
2338/(?(10))/
2339
2340/(?(+2))()()/
2341
2342/(?(2))()()/
2343
2344/\k''/
2345
2346/\k<>/
2347
2348/\k{}/
2349
2350/\k/
2351
2352/\kabc/
2353
2354/(?P=)/
2355
2356/(?P>)/
2357
2358/[[:foo:]]/
2359
2360/[[:1234:]]/
2361
2362/[[:f\oo:]]/
2363
2364/[[: :]]/
2365
2366/[[:...:]]/
2367
2368/[[:l\ower:]]/
2369
2370/[[:abc\:]]/
2371
2372/[abc[:x\]pqr:]]/
2373
2374/[[:a\dz:]]/
2375
2376/(^(a|b\g<-1'c))/
2377
2378/^(?+1)(?<a>x|y){0}z/
2379    xzxx
2380    yzyy
2381\= Expect no match
2382    xxz
2383
2384/(\3)(\1)(a)/
2385\= Expect no match
2386    cat
2387
2388/(\3)(\1)(a)/alt_bsux,allow_empty_class,match_unset_backref,dupnames
2389    cat
2390
2391/TA]/
2392    The ACTA] comes
2393
2394/TA]/alt_bsux,allow_empty_class,match_unset_backref,dupnames
2395    The ACTA] comes
2396
2397/(?2)[]a()b](abc)/
2398    abcbabc
2399
2400/(?2)[^]a()b](abc)/
2401    abcbabc
2402
2403/(?1)[]a()b](abc)/
2404    abcbabc
2405\= Expect no match
2406    abcXabc
2407
2408/(?1)[^]a()b](abc)/
2409    abcXabc
2410\= Expect no match
2411    abcbabc
2412
2413/(?2)[]a()b](abc)(xyz)/
2414    xyzbabcxyz
2415
2416/(?&N)[]a(?<N>)](?<M>abc)/
2417   abc<abc
2418
2419/(?&N)[]a(?<N>)](abc)/
2420   abc<abc
2421
2422/a[]b/
2423
2424/a[^]b/
2425
2426/a[]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
2427\= Expect no match
2428    ab
2429
2430/a[]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
2431\= Expect no match
2432    ab
2433
2434/a[]*+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
2435\= Expect no match
2436    ab
2437
2438/a[^]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
2439    aXb
2440    a\nb
2441\= Expect no match
2442    ab
2443
2444/a[^]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
2445    aXb
2446    a\nX\nXb
2447\= Expect no match
2448    ab
2449
2450/a(?!)b/B
2451
2452/(?!)?a/B
2453    ab
2454
2455/a(*FAIL)+b/
2456
2457/(abc|pqr|123){0}[xyz]/I
2458
2459/(?(?=.*b)b|^)/I,auto_callout
2460   adc
2461   abc
2462
2463/(?(?=b).*b|^d)/I
2464
2465/(?(?=.*b).*b|^d)/I
2466
2467/xyz/auto_callout
2468  xyz
2469  abcxyz
2470\= Expect no match
2471  abc
2472  abcxypqr
2473
2474/xyz/auto_callout,no_start_optimize
2475  abcxyz
2476\= Expect no match
2477  abc
2478  abcxypqr
2479
2480/(*NO_START_OPT)xyz/auto_callout
2481  abcxyz
2482
2483/(*NO_AUTO_POSSESS)a+b/B
2484
2485/xyz/auto_callout,no_start_optimize
2486  abcxyz
2487
2488/^"((?(?=[a])[^"])|b)*"$/auto_callout
2489    "ab"
2490
2491/^"((?(?=[a])[^"])|b)*"$/
2492    "ab"
2493
2494/^X(?5)(a)(?|(b)|(q))(c)(d)Y/
2495    XYabcdY
2496
2497/^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)/
2498    XYabcdY
2499
2500/Xa{2,4}b/
2501    X\=ps
2502    Xa\=ps
2503    Xaa\=ps
2504    Xaaa\=ps
2505    Xaaaa\=ps
2506
2507/Xa{2,4}?b/
2508    X\=ps
2509    Xa\=ps
2510    Xaa\=ps
2511    Xaaa\=ps
2512    Xaaaa\=ps
2513
2514/Xa{2,4}+b/
2515    X\=ps
2516    Xa\=ps
2517    Xaa\=ps
2518    Xaaa\=ps
2519    Xaaaa\=ps
2520
2521/X\d{2,4}b/
2522    X\=ps
2523    X3\=ps
2524    X33\=ps
2525    X333\=ps
2526    X3333\=ps
2527
2528/X\d{2,4}?b/
2529    X\=ps
2530    X3\=ps
2531    X33\=ps
2532    X333\=ps
2533    X3333\=ps
2534
2535/X\d{2,4}+b/
2536    X\=ps
2537    X3\=ps
2538    X33\=ps
2539    X333\=ps
2540    X3333\=ps
2541
2542/X\D{2,4}b/
2543    X\=ps
2544    Xa\=ps
2545    Xaa\=ps
2546    Xaaa\=ps
2547    Xaaaa\=ps
2548
2549/X\D{2,4}?b/
2550    X\=ps
2551    Xa\=ps
2552    Xaa\=ps
2553    Xaaa\=ps
2554    Xaaaa\=ps
2555
2556/X\D{2,4}+b/
2557    X\=ps
2558    Xa\=ps
2559    Xaa\=ps
2560    Xaaa\=ps
2561    Xaaaa\=ps
2562
2563/X[abc]{2,4}b/
2564    X\=ps
2565    Xa\=ps
2566    Xaa\=ps
2567    Xaaa\=ps
2568    Xaaaa\=ps
2569
2570/X[abc]{2,4}?b/
2571    X\=ps
2572    Xa\=ps
2573    Xaa\=ps
2574    Xaaa\=ps
2575    Xaaaa\=ps
2576
2577/X[abc]{2,4}+b/
2578    X\=ps
2579    Xa\=ps
2580    Xaa\=ps
2581    Xaaa\=ps
2582    Xaaaa\=ps
2583
2584/X[^a]{2,4}b/
2585    X\=ps
2586    Xz\=ps
2587    Xzz\=ps
2588    Xzzz\=ps
2589    Xzzzz\=ps
2590
2591/X[^a]{2,4}?b/
2592    X\=ps
2593    Xz\=ps
2594    Xzz\=ps
2595    Xzzz\=ps
2596    Xzzzz\=ps
2597
2598/X[^a]{2,4}+b/
2599    X\=ps
2600    Xz\=ps
2601    Xzz\=ps
2602    Xzzz\=ps
2603    Xzzzz\=ps
2604
2605/(Y)X\1{2,4}b/
2606    YX\=ps
2607    YXY\=ps
2608    YXYY\=ps
2609    YXYYY\=ps
2610    YXYYYY\=ps
2611
2612/(Y)X\1{2,4}?b/
2613    YX\=ps
2614    YXY\=ps
2615    YXYY\=ps
2616    YXYYY\=ps
2617    YXYYYY\=ps
2618
2619/(Y)X\1{2,4}+b/
2620    YX\=ps
2621    YXY\=ps
2622    YXYY\=ps
2623    YXYYY\=ps
2624    YXYYYY\=ps
2625
2626/\++\KZ|\d+X|9+Y/startchar
2627    ++++123999\=ps
2628    ++++123999Y\=ps
2629    ++++Z1234\=ps
2630
2631/Z(*F)/
2632\= Expect no match
2633    Z\=ps
2634    ZA\=ps
2635
2636/Z(?!)/
2637\= Expect no match
2638    Z\=ps
2639    ZA\=ps
2640
2641/dog(sbody)?/
2642    dogs\=ps
2643    dogs\=ph
2644
2645/dog(sbody)??/
2646    dogs\=ps
2647    dogs\=ph
2648
2649/dog|dogsbody/
2650    dogs\=ps
2651    dogs\=ph
2652
2653/dogsbody|dog/
2654    dogs\=ps
2655    dogs\=ph
2656
2657/\bthe cat\b/
2658    the cat\=ps
2659    the cat\=ph
2660
2661/abc/
2662   abc\=ps
2663   abc\=ph
2664
2665/abc\K123/startchar
2666    xyzabc123pqr
2667    xyzabc12\=ps
2668    xyzabc12\=ph
2669
2670/(?<=abc)123/
2671    xyzabc123pqr
2672    xyzabc12\=ps
2673    xyzabc12\=ph
2674
2675/\babc\b/
2676    +++abc+++
2677    +++ab\=ps
2678    +++ab\=ph
2679
2680/(?&word)(?&element)(?(DEFINE)(?<element><[^m][^>]>[^<])(?<word>\w*+))/B
2681
2682/(?&word)(?&element)(?(DEFINE)(?<element><[^\d][^>]>[^<])(?<word>\w*+))/B
2683
2684/(ab)(x(y)z(cd(*ACCEPT)))pq/B
2685
2686/abc\K/aftertext,startchar
2687    abcdef
2688    abcdef\=notempty_atstart
2689    xyzabcdef\=notempty_atstart
2690\= Expect no match
2691    abcdef\=notempty
2692    xyzabcdef\=notempty
2693
2694/^(?:(?=abc)|abc\K)/aftertext,startchar
2695    abcdef
2696    abcdef\=notempty_atstart
2697\= Expect no match
2698    abcdef\=notempty
2699
2700/a?b?/aftertext
2701    xyz
2702    xyzabc
2703    xyzabc\=notempty
2704    xyzabc\=notempty_atstart
2705    xyz\=notempty_atstart
2706\= Expect no match
2707    xyz\=notempty
2708
2709/^a?b?/aftertext
2710    xyz
2711    xyzabc
2712\= Expect no match
2713    xyzabc\=notempty
2714    xyzabc\=notempty_atstart
2715    xyz\=notempty_atstart
2716    xyz\=notempty
2717
2718/^(?<name>a|b\g<name>c)/
2719    aaaa
2720    bacxxx
2721    bbaccxxx
2722    bbbacccxx
2723
2724/^(?<name>a|b\g'name'c)/
2725    aaaa
2726    bacxxx
2727    bbaccxxx
2728    bbbacccxx
2729
2730/^(a|b\g<1>c)/
2731    aaaa
2732    bacxxx
2733    bbaccxxx
2734    bbbacccxx
2735
2736/^(a|b\g'1'c)/
2737    aaaa
2738    bacxxx
2739    bbaccxxx
2740    bbbacccxx
2741
2742/^(a|b\g'-1'c)/
2743    aaaa
2744    bacxxx
2745    bbaccxxx
2746    bbbacccxx
2747
2748/(^(a|b\g<-1>c))/
2749    aaaa
2750    bacxxx
2751    bbaccxxx
2752    bbbacccxx
2753
2754/(?-i:\g<name>)(?i:(?<name>a))/
2755    XaaX
2756    XAAX
2757
2758/(?i:\g<name>)(?-i:(?<name>a))/
2759    XaaX
2760\= Expect no match
2761    XAAX
2762
2763/(?-i:\g<+1>)(?i:(a))/
2764    XaaX
2765    XAAX
2766
2767/(?=(?<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>\})\}))\{/
2768
2769/(?<n>a|b|c)\g<n>*/
2770   abc
2771   accccbbb
2772
2773/^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)/
2774    XYabcdY
2775
2776/(?<=b(?1)|zzz)(a)/
2777    xbaax
2778    xzzzax
2779
2780/(a)(?<=b\1)/
2781
2782/(a)(?<=b+(?1))/
2783
2784/(a+)(?<=b(?1))/
2785
2786/(a(?<=b(?1)))/
2787
2788/(?<=b(?1))xyz/
2789
2790/(?<=b(?1))xyz(b+)pqrstuvew/
2791
2792/(a|bc)\1/I
2793
2794/(a|bc)\1{2,3}/I
2795
2796/(a|bc)(?1)/I
2797
2798/(a|b\1)(a|b\1)/I
2799
2800/(a|b\1){2}/I
2801
2802/(a|bbbb\1)(a|bbbb\1)/I
2803
2804/(a|bbbb\1){2}/I
2805
2806/^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
2807
2808/<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
2809
2810"(?>.*/)foo"I
2811
2812/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /Ix
2813
2814/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/Ii
2815
2816/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/I
2817
2818/<a[\s]+href[\s]*=[\s]*          # find <a href=
2819 ([\"\'])?                       # find single or double quote
2820 (?(1) (.*?)\1 | ([^\s]+))       # if quote found, match up to next matching
2821                                 # quote, otherwise match up to next space
2822/Iisx
2823
2824/^(?!:)                       # colon disallowed at start
2825  (?:                         # start of item
2826    (?: [0-9a-f]{1,4} |       # 1-4 hex digits or
2827    (?(1)0 | () ) )           # if null previously matched, fail; else null
2828    :                         # followed by colon
2829  ){1,7}                      # end item; 1-7 of them required
2830  [0-9a-f]{1,4} $             # final hex number at end of string
2831  (?(1)|.)                    # check that there was an empty component
2832  /Iix
2833
2834/(?|(?<a>A)|(?<a>B))/I
2835    AB\=copy=a
2836    BA\=copy=a
2837
2838/(?|(?<a>A)|(?<b>B))/
2839
2840/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |
2841    b(?<quote> (?<apostrophe>')|(?<realquote>")) )
2842    (?('quote')[a-z]+|[0-9]+)/Ix,dupnames
2843    a"aaaaa
2844    b"aaaaa
2845\= Expect no match
2846    b"11111
2847    a"11111
2848
2849/^(?|(a)(b)(c)(?<D>d)|(?<D>e)) (?('D')X|Y)/IBx,dupnames
2850    abcdX
2851    eX
2852\= Expect no match
2853    abcdY
2854    ey
2855
2856/(?<A>a) (b)(c)  (?<A>d  (?(R&A)$ | (?4)) )/IBx,dupnames
2857    abcdd
2858\= Expect no match
2859    abcdde
2860
2861/abcd*/
2862    xxxxabcd\=ps
2863    xxxxabcd\=ph
2864
2865/abcd*/i
2866    xxxxabcd\=ps
2867    xxxxabcd\=ph
2868    XXXXABCD\=ps
2869    XXXXABCD\=ph
2870
2871/abc\d*/
2872    xxxxabc1\=ps
2873    xxxxabc1\=ph
2874
2875/(a)bc\1*/
2876    xxxxabca\=ps
2877    xxxxabca\=ph
2878
2879/abc[de]*/
2880    xxxxabcde\=ps
2881    xxxxabcde\=ph
2882
2883# This is not in the Perl-compatible test because Perl seems currently to be
2884# broken and not behaving as specified in that it *does* bumpalong after
2885# hitting (*COMMIT).
2886
2887/(?1)(A(*COMMIT)|B)D/
2888    ABD
2889    XABD
2890    BAD
2891    ABXABD
2892\= Expect no match
2893    ABX
2894    BAXBAD
2895
2896/(\3)(\1)(a)/alt_bsux,allow_empty_class,match_unset_backref,dupnames
2897    cat
2898
2899/(\3)(\1)(a)/I,alt_bsux,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/abc(*FAIL:123)xyz/
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
2949/A(*COMMIT)B/aftertext,mark
2950\= Expect no match
2951    ACABX
2952
2953# These should be different, but in Perl they are not, which I think
2954# is a bug in Perl.
2955
2956/A(*THEN)B|A(*THEN)C/mark
2957    AC
2958
2959/A(*PRUNE)B|A(*PRUNE)C/mark
2960\= Expect no match
2961    AC
2962
2963# Mark names can be duplicated. Perl doesn't give a mark for this one,
2964# though PCRE2 does.
2965
2966/^A(*:A)B|^X(*:A)Y/mark
2967\= Expect no match
2968    XAQQ
2969
2970# COMMIT at the start of a pattern should be the same as an anchor. Perl
2971# optimizations defeat this. So does the PCRE2 optimization unless we disable
2972# it.
2973
2974/(*COMMIT)ABC/
2975    ABCDEFG
2976
2977/(*COMMIT)ABC/no_start_optimize
2978\= Expect no match
2979    DEFGABC
2980
2981/^(ab (c+(*THEN)cd) | xyz)/x
2982\= Expect no match
2983    abcccd
2984
2985/^(ab (c+(*PRUNE)cd) | xyz)/x
2986\= Expect no match
2987    abcccd
2988
2989/^(ab (c+(*FAIL)cd) | xyz)/x
2990\= Expect no match
2991    abcccd
2992
2993# Perl gets some of these wrong
2994
2995/(?>.(*ACCEPT))*?5/
2996    abcde
2997
2998/(.(*ACCEPT))*?5/
2999    abcde
3000
3001/(.(*ACCEPT))5/
3002    abcde
3003
3004/(.(*ACCEPT))*5/
3005    abcde
3006
3007/A\NB./B
3008    ACBD
3009\= Expect no match
3010    A\nB
3011    ACB\n
3012
3013/A\NB./Bs
3014    ACBD
3015    ACB\n
3016\= Expect no match
3017    A\nB
3018
3019/A\NB/newline=crlf
3020    A\nB
3021    A\rB
3022\= Expect no match
3023    A\r\nB
3024
3025/\R+b/B
3026
3027/\R+\n/B
3028
3029/\R+\d/B
3030
3031/\d*\R/B
3032
3033/\s*\R/B
3034    \x20\x0a
3035    \x20\x0d
3036    \x20\x0d\x0a
3037
3038/\S*\R/B
3039    a\x0a
3040
3041/X\h*\R/B
3042    X\x20\x0a
3043
3044/X\H*\R/B
3045    X\x0d\x0a
3046
3047/X\H+\R/B
3048    X\x0d\x0a
3049
3050/X\H++\R/B
3051\= Expect no match
3052    X\x0d\x0a
3053
3054/(?<=abc)def/
3055    abc\=ph
3056
3057/abc$/
3058    abc
3059    abc\=ps
3060    abc\=ph
3061
3062/abc$/m
3063    abc
3064    abc\n
3065    abc\=ph
3066    abc\n\=ph
3067    abc\=ps
3068    abc\n\=ps
3069
3070/abc\z/
3071    abc
3072    abc\=ps
3073    abc\=ph
3074
3075/abc\Z/
3076    abc
3077    abc\=ps
3078    abc\=ph
3079
3080/abc\b/
3081    abc
3082    abc\=ps
3083    abc\=ph
3084
3085/abc\B/
3086    abc\=ps
3087    abc\=ph
3088\= Expect no match
3089    abc
3090
3091/.+/
3092\= Bad offsets
3093    abc\=offset=4
3094    abc\=offset=-4
3095\= Valid data
3096    abc\=offset=0
3097    abc\=offset=1
3098    abc\=offset=2
3099\= Expect no match
3100    abc\=offset=3
3101
3102/^\cģ/
3103
3104/(?P<abn>(?P=abn)xxx)/B
3105
3106/(a\1z)/B
3107
3108/(?P<abn>(?P=abn)(?<badstufxxx)/B
3109
3110/(?P<abn>(?P=axn)xxx)/B
3111
3112/(?P<abn>(?P=axn)xxx)(?<axn>yy)/B
3113
3114# These tests are here because Perl gets the first one wrong.
3115
3116/(\R*)(.)/s
3117    \r\n
3118    \r\r\n\n\r
3119    \r\r\n\n\r\n
3120
3121/(\R)*(.)/s
3122    \r\n
3123    \r\r\n\n\r
3124    \r\r\n\n\r\n
3125
3126/((?>\r\n|\n|\x0b|\f|\r|\x85)*)(.)/s
3127    \r\n
3128    \r\r\n\n\r
3129    \r\r\n\n\r\n
3130
3131# -------------
3132
3133/^abc$/B
3134
3135/^abc$/Bm
3136
3137/^(a)*+(\w)/
3138    aaaaX
3139\= Expect no match
3140    aaaa
3141
3142/^(?:a)*+(\w)/
3143    aaaaX
3144\= Expect no match
3145    aaaa
3146
3147/(a)++1234/IB
3148
3149/([abc])++1234/I
3150
3151/(?<=(abc)+)X/
3152
3153/(^ab)/I
3154
3155/(^ab)++/I
3156
3157/(^ab|^)+/I
3158
3159/(^ab|^)++/I
3160
3161/(?:^ab)/I
3162
3163/(?:^ab)++/I
3164
3165/(?:^ab|^)+/I
3166
3167/(?:^ab|^)++/I
3168
3169/(.*ab)/I
3170
3171/(.*ab)++/I
3172
3173/(.*ab|.*)+/I
3174
3175/(.*ab|.*)++/I
3176
3177/(?:.*ab)/I
3178
3179/(?:.*ab)++/I
3180
3181/(?:.*ab|.*)+/I
3182
3183/(?:.*ab|.*)++/I
3184
3185/(?=a)[bcd]/I
3186
3187/((?=a))[bcd]/I
3188
3189/((?=a))+[bcd]/I
3190
3191/((?=a))++[bcd]/I
3192
3193/(?=a+)[bcd]/Ii
3194
3195/(?=a+?)[bcd]/Ii
3196
3197/(?=a++)[bcd]/Ii
3198
3199/(?=a{3})[bcd]/Ii
3200
3201/(abc)\1+/
3202
3203# Perl doesn't get these right IMO (the 3rd is PCRE2-specific)
3204
3205/(?1)(?:(b(*ACCEPT))){0}/
3206    b
3207
3208/(?1)(?:(b(*ACCEPT))){0}c/
3209    bc
3210\= Expect no match
3211    b
3212
3213/(?1)(?:((*ACCEPT))){0}c/
3214    c
3215    c\=notempty
3216
3217/^.*?(?(?=a)a|b(*THEN)c)/
3218\= Expect no match
3219    ba
3220
3221/^.*?(?(?=a)a|bc)/
3222    ba
3223
3224/^.*?(?(?=a)a(*THEN)b|c)/
3225\= Expect no match
3226    ac
3227
3228/^.*?(?(?=a)a(*THEN)b)c/
3229\= Expect no match
3230    ac
3231
3232/^.*?(a(*THEN)b)c/
3233\= Expect no match
3234    aabc
3235
3236/^.*? (?1) c (?(DEFINE)(a(*THEN)b))/x
3237    aabc
3238
3239/^.*?(a(*THEN)b|z)c/
3240    aabc
3241
3242/^.*?(z|a(*THEN)b)c/
3243    aabc
3244
3245# These are here because they are not Perl-compatible; the studying means the
3246# mark is not seen.
3247
3248/(*MARK:A)(*SKIP:B)(C|X)/mark
3249    C
3250\= Expect no match
3251    D
3252
3253/(*:A)A+(*SKIP:A)(B|Z)/mark
3254\= Expect no match
3255    AAAC
3256
3257# ----------------------------
3258
3259"(?=a*(*ACCEPT)b)c"
3260    c
3261    c\=notempty
3262
3263/(?1)c(?(DEFINE)((*ACCEPT)b))/
3264    c
3265    c\=notempty
3266
3267/(?>(*ACCEPT)b)c/
3268    c
3269\= Expect no match
3270    c\=notempty
3271
3272/(?:(?>(a)))+a%/allaftertext
3273    %aa%
3274
3275/(a)b|ac/allaftertext
3276    ac\=ovector=1
3277
3278/(a)(b)x|abc/allaftertext
3279     abc\=ovector=2
3280
3281/(a)bc|(a)(b)\2/
3282    abc\=ovector=1
3283    abc\=ovector=2
3284    aba\=ovector=1
3285    aba\=ovector=2
3286    aba\=ovector=3
3287    aba\=ovector=4
3288
3289/(?(DEFINE)(a(?2)|b)(b(?1)|a))(?:(?1)|(?2))/I
3290
3291/(a(?2)|b)(b(?1)|a)(?:(?1)|(?2))/I
3292
3293/(a(?2)|b)(b(?1)|a)(?1)(?2)/I
3294
3295/(abc)(?1)/I
3296
3297/(?:(foo)|(bar)|(baz))X/allcaptures
3298    bazfooX
3299    foobazbarX
3300    barfooX
3301    bazX
3302    foobarbazX
3303    bazfooX\=ovector=0
3304    bazfooX\=ovector=1
3305    bazfooX\=ovector=2
3306    bazfooX\=ovector=3
3307
3308/(?=abc){3}abc/B
3309
3310/(?=abc)+abc/B
3311
3312/(?=abc)++abc/B
3313
3314/(?=abc){0}xyz/B
3315
3316/(?=(a))?./B
3317
3318/(?=(a))??./B
3319
3320/^(?=(a)){0}b(?1)/B
3321
3322/(?(DEFINE)(a))?b(?1)/B
3323
3324/^(?=(?1))?[az]([abc])d/B
3325
3326/^(?!a){0}\w+/B
3327
3328/(?<=(abc))?xyz/B
3329
3330/[:a[:abc]b:]/B
3331
3332/^(a(*:A)(d|e(*:B))z|aeq)/auto_callout
3333    adz
3334    aez
3335    aeqwerty
3336
3337/.(*F)/
3338\= Expect no match
3339    abc\=ph
3340
3341/\btype\b\W*?\btext\b\W*?\bjavascript\b/I
3342
3343/\btype\b\W*?\btext\b\W*?\bjavascript\b|\burl\b\W*?\bshell:|<input\b.*?\btype\b\W*?\bimage\b|\bonkeyup\b\W*?\=/I
3344
3345/a(*SKIP)c|b(*ACCEPT)|/I,aftertext
3346    a
3347
3348/a(*SKIP)c|b(*ACCEPT)cd(*ACCEPT)|x/I
3349    ax
3350
3351'a*(*ACCEPT)b'aftertext
3352    abc\=notempty_atstart
3353    bbb\=notempty_atstart
3354\= Expect no match
3355    \=notempty_atstart
3356
3357/(*ACCEPT)a/I,aftertext
3358    bax
3359
3360/z(*ACCEPT)a/I,aftertext
3361    baxzbx
3362
3363/^(?>a+)(?>(z+))\w/B
3364    aaaazzzzb
3365\= Expect no match
3366    aazz
3367
3368/(.)(\1|a(?2))/
3369    bab
3370
3371/\1|(.)(?R)\1/
3372    cbbbc
3373
3374/(.)((?(1)c|a)|a(?2))/
3375\= Expect no match
3376    baa
3377
3378/(?P<abn>(?P=abn)xxx)/B
3379
3380/(a\1z)/B
3381
3382/^a\x41z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3383    aAz
3384\= Expect no match
3385    ax41z
3386
3387/^a[m\x41]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3388    aAz
3389
3390/^a\x1z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3391    ax1z
3392
3393/^a\u0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3394    aAz
3395\= Expect no match
3396    au0041z
3397
3398/^a[m\u0041]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3399    aAz
3400
3401/^a\u041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3402    au041z
3403\= Expect no match
3404    aAz
3405
3406/^a\U0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
3407    aU0041z
3408\= Expect no match
3409    aAz
3410
3411/(?(?=c)c|d)++Y/B
3412
3413/(?(?=c)c|d)*+Y/B
3414
3415/a[\NB]c/
3416    aNc
3417
3418/a[B-\Nc]/
3419
3420/a[B\Nc]/
3421
3422/(a)(?2){0,1999}?(b)/
3423
3424/(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/
3425
3426# This test, with something more complicated than individual letters, causes
3427# different behaviour in Perl. Perhaps it disables some optimization; no tag is
3428# passed back for the failures, whereas in PCRE2 there is a tag.
3429
3430/(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/x,mark
3431    AABC
3432    XXYZ
3433\= Expect no match
3434    XAQQ
3435    XAQQXZZ
3436    AXQQQ
3437    AXXQQQ
3438
3439# Perl doesn't give marks for these, though it does if the alternatives are
3440# replaced by single letters.
3441
3442/(b|q)(*:m)f|a(*:n)w/mark
3443    aw
3444\= Expect no match
3445    abc
3446
3447/(q|b)(*:m)f|a(*:n)w/mark
3448    aw
3449\= Expect no match
3450    abc
3451
3452# After a partial match, the behaviour is as for a failure.
3453
3454/^a(*:X)bcde/mark
3455   abc\=ps
3456
3457# These are here because Perl doesn't return a mark, except for the first.
3458
3459/(?=(*:x))(q|)/aftertext,mark
3460    abc
3461
3462/(?=(*:x))((*:y)q|)/aftertext,mark
3463    abc
3464
3465/(?=(*:x))(?:(*:y)q|)/aftertext,mark
3466    abc
3467
3468/(?=(*:x))(?>(*:y)q|)/aftertext,mark
3469    abc
3470
3471/(?=a(*:x))(?!a(*:y)c)/aftertext,mark
3472    ab
3473
3474/(?=a(*:x))(?=a(*:y)c|)/aftertext,mark
3475    ab
3476
3477/(..)\1/
3478    ab\=ps
3479    aba\=ps
3480    abab\=ps
3481
3482/(..)\1/i
3483    ab\=ps
3484    abA\=ps
3485    aBAb\=ps
3486
3487/(..)\1{2,}/
3488    ab\=ps
3489    aba\=ps
3490    abab\=ps
3491    ababa\=ps
3492    ababab\=ps
3493    ababab\=ph
3494    abababa\=ps
3495    abababa\=ph
3496
3497/(..)\1{2,}/i
3498    ab\=ps
3499    aBa\=ps
3500    aBAb\=ps
3501    AbaBA\=ps
3502    abABAb\=ps
3503    aBAbaB\=ph
3504    abABabA\=ps
3505    abaBABa\=ph
3506
3507/(..)\1{2,}?x/i
3508    ab\=ps
3509    abA\=ps
3510    aBAb\=ps
3511    abaBA\=ps
3512    abAbaB\=ps
3513    abaBabA\=ps
3514    abAbABaBx\=ps
3515
3516/^(..)\1/
3517    aba\=ps
3518
3519/^(..)\1{2,3}x/
3520    aba\=ps
3521    ababa\=ps
3522    ababa\=ph
3523    abababx
3524    ababababx
3525
3526/^(..)\1{2,3}?x/
3527    aba\=ps
3528    ababa\=ps
3529    ababa\=ph
3530    abababx
3531    ababababx
3532
3533/^(..)(\1{2,3})ab/
3534    abababab
3535
3536/^\R/
3537    \r\=ps
3538    \r\=ph
3539
3540/^\R{2,3}x/
3541    \r\=ps
3542    \r\=ph
3543    \r\r\=ps
3544    \r\r\=ph
3545    \r\r\r\=ps
3546    \r\r\r\=ph
3547    \r\rx
3548    \r\r\rx
3549
3550/^\R{2,3}?x/
3551    \r\=ps
3552    \r\=ph
3553    \r\r\=ps
3554    \r\r\=ph
3555    \r\r\r\=ps
3556    \r\r\r\=ph
3557    \r\rx
3558    \r\r\rx
3559
3560/^\R?x/
3561    \r\=ps
3562    \r\=ph
3563    x
3564    \rx
3565
3566/^\R+x/
3567    \r\=ps
3568    \r\=ph
3569    \r\n\=ps
3570    \r\n\=ph
3571    \rx
3572
3573/^a$/newline=crlf
3574    a\r\=ps
3575    a\r\=ph
3576
3577/^a$/m,newline=crlf
3578    a\r\=ps
3579    a\r\=ph
3580
3581/^(a$|a\r)/newline=crlf
3582    a\r\=ps
3583    a\r\=ph
3584
3585/^(a$|a\r)/m,newline=crlf
3586    a\r\=ps
3587    a\r\=ph
3588
3589/./newline=crlf
3590    \r\=ps
3591    \r\=ph
3592
3593/.{2,3}/newline=crlf
3594    \r\=ps
3595    \r\=ph
3596    \r\r\=ps
3597    \r\r\=ph
3598    \r\r\r\=ps
3599    \r\r\r\=ph
3600
3601/.{2,3}?/newline=crlf
3602    \r\=ps
3603    \r\=ph
3604    \r\r\=ps
3605    \r\r\=ph
3606    \r\r\r\=ps
3607    \r\r\r\=ph
3608
3609"AB(C(D))(E(F))?(?(?=\2)(?=\4))"
3610    ABCDGHI\=ovector=01
3611
3612# These are all run as real matches in test 1; here we are just checking the
3613# settings of the anchored and startline bits.
3614
3615/(?>.*?a)(?<=ba)/I
3616
3617/(?:.*?a)(?<=ba)/I
3618
3619/.*?a(*PRUNE)b/I
3620
3621/.*?a(*PRUNE)b/Is
3622
3623/^a(*PRUNE)b/Is
3624
3625/.*?a(*SKIP)b/I
3626
3627/(?>.*?a)b/Is
3628
3629/(?>.*?a)b/I
3630
3631/(?>^a)b/Is
3632
3633/(?>.*?)(?<=(abcd)|(wxyz))/I
3634
3635/(?>.*)(?<=(abcd)|(wxyz))/I
3636
3637"(?>.*)foo"I
3638
3639"(?>.*?)foo"I
3640
3641/(?>^abc)/Im
3642
3643/(?>.*abc)/Im
3644
3645/(?:.*abc)/Im
3646
3647/(?:(a)+(?C1)bb|aa(?C2)b)/
3648    aab\=callout_capture
3649
3650/(?:(a)++(?C1)bb|aa(?C2)b)/
3651    aab\=callout_capture
3652
3653/(?:(?>(a))(?C1)bb|aa(?C2)b)/
3654    aab\=callout_capture
3655
3656/(?:(?1)(?C1)x|ab(?C2))((a)){0}/
3657    aab\=callout_capture
3658
3659/(?1)(?C1)((a)(?C2)){0}/
3660    aab\=callout_capture
3661
3662/(?:(a)+(?C1)bb|aa(?C2)b)++/
3663    aab\=callout_capture
3664    aab\=callout_capture,ovector=1
3665
3666/(ab)x|ab/
3667    ab\=ovector=0
3668    ab\=ovector=1
3669
3670/(?<=123)(*MARK:xx)abc/mark
3671    xxxx123a\=ph
3672    xxxx123a\=ps
3673
3674/123\Kabc/startchar
3675    xxxx123a\=ph
3676    xxxx123a\=ps
3677
3678/^(?(?=a)aa|bb)/auto_callout
3679    bb
3680
3681/(?C1)^(?C2)(?(?C99)(?=(?C3)a(?C4))(?C5)a(?C6)a(?C7)|(?C8)b(?C9)b(?C10))(?C11)/
3682    bb
3683
3684# Perl seems to have a bug with this one.
3685
3686/aaaaa(*COMMIT)(*PRUNE)b|a+c/
3687    aaaaaac
3688
3689# Here are some that Perl treats differently because of the way it handles
3690# backtracking verbs.
3691
3692/(?!a(*COMMIT)b)ac|ad/
3693     ac
3694     ad
3695
3696/^(?!a(*THEN)b|ac)../
3697     ad
3698\= Expect no match
3699     ac
3700
3701/^(?=a(*THEN)b|ac)/
3702    ac
3703
3704/\A.*?(?:a|b(*THEN)c)/
3705    ba
3706
3707/\A.*?(?:a|b(*THEN)c)++/
3708    ba
3709
3710/\A.*?(?:a|b(*THEN)c|d)/
3711    ba
3712
3713/(?:(a(*MARK:X)a+(*SKIP:X)b)){0}(?:(?1)|aac)/
3714    aac
3715
3716/\A.*?(a|b(*THEN)c)/
3717    ba
3718
3719/^(A(*THEN)B|A(*THEN)D)/
3720    AD
3721
3722/(?!b(*THEN)a)bn|bnn/
3723    bnn
3724
3725/(?(?=b(*SKIP)a)bn|bnn)/
3726\= Expect no match
3727    bnn
3728
3729/(?=b(*THEN)a|)bn|bnn/
3730    bnn
3731
3732# This test causes a segfault with Perl 5.18.0
3733
3734/^(?=(a)){0}b(?1)/
3735    backgammon
3736
3737/(?|(?<n>f)|(?<n>b))/I,dupnames
3738
3739/(?<a>abc)(?<a>z)\k<a>()/IB,dupnames
3740
3741/a*[bcd]/B
3742
3743/[bcd]*a/B
3744
3745# A complete set of tests for auto-possessification of character types, but
3746# omitting \C because it might be disabled (it has its own tests).
3747
3748/\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
3749
3750/\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
3751
3752/\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
3753
3754/\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
3755
3756/\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
3757
3758/\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
3759
3760/\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
3761
3762/\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
3763
3764/\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
3765
3766/\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
3767
3768/\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
3769
3770/ 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
3771
3772/\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
3773
3774/ .+\D  .+\d  .+\S  .+\s  .+\W  .+\w  .+.  .+\R  .+\H  .+\h  .+\V  .+\v  .+\Z  .+\z  .+$/Bx
3775
3776/ .+\D  .+\d  .+\S  .+\s  .+\W  .+\w  .+.  .+\R  .+\H  .+\h  .+\V  .+\v  .+\Z  .+\z  .+$/Bsx
3777
3778/ \D+$  \d+$  \S+$  \s+$  \W+$  \w+$  \R+$  \H+$  \h+$  \V+$ \v+$  a+$   \n+$  .+$  .+$/Bmx
3779
3780/(?=a+)a(a+)++a/B
3781
3782/a+(bb|cc)a+(?:bb|cc)a+(?>bb|cc)a+(?:bb|cc)+a+(aa)a+(?:bb|aa)/B
3783
3784/a+(bb|cc)?#a+(?:bb|cc)??#a+(?:bb|cc)?+#a+(?:bb|cc)*#a+(bb|cc)?a#a+(?:aa)?/B
3785
3786/a+(?:bb)?a#a+(?:|||)#a+(?:|b)a#a+(?:|||)?a/B
3787
3788/[ab]*/B
3789    aaaa
3790
3791/[ab]*?/B
3792    aaaa
3793
3794/[ab]?/B
3795    aaaa
3796
3797/[ab]??/B
3798    aaaa
3799
3800/[ab]+/B
3801    aaaa
3802
3803/[ab]+?/B
3804    aaaa
3805
3806/[ab]{2,3}/B
3807    aaaa
3808
3809/[ab]{2,3}?/B
3810    aaaa
3811
3812/[ab]{2,}/B
3813    aaaa
3814
3815/[ab]{2,}?/B
3816    aaaa
3817
3818/\d+\s{0,5}=\s*\S?=\w{0,4}\W*/B
3819
3820/[a-d]{5,12}[e-z0-9]*#[^a-z]+[b-y]*a[2-7]?[^0-9a-z]+/B
3821
3822/[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
3823
3824/a+(aa|bb)*c#a*(bb|cc)*a#a?(bb|cc)*d#[a-f]*(g|hh)*f/B
3825
3826/[a-f]*(g|hh|i)*i#[a-x]{4,}(y{0,6})*y#[a-k]+(ll|mm)+n/B
3827
3828/[a-f]*(?>gg|hh)+#[a-f]*(?>gg|hh)?#[a-f]*(?>gg|hh)*a#[a-f]*(?>gg|hh)*h/B
3829
3830/[a-c]*d/IB
3831
3832/[a-c]+d/IB
3833
3834/[a-c]?d/IB
3835
3836/[a-c]{4,6}d/IB
3837
3838/[a-c]{0,6}d/IB
3839
3840# End of special auto-possessive tests
3841
3842/^A\o{1239}B/
3843    A\123B
3844
3845/^A\oB/
3846
3847/^A\x{zz}B/
3848
3849/^A\x{12Z/
3850
3851/^A\x{/
3852
3853/[ab]++/B,no_auto_possess
3854
3855/[^ab]*+/B,no_auto_possess
3856
3857/a{4}+/B,no_auto_possess
3858
3859/a{4}+/Bi,no_auto_possess
3860
3861/[a-[:digit:]]+/
3862
3863/[A-[:digit:]]+/
3864
3865/[a-[.xxx.]]+/
3866
3867/[a-[=xxx=]]+/
3868
3869/[a-[!xxx!]]+/
3870
3871/[A-[!xxx!]]+/
3872    A]]]
3873
3874/[a-\d]+/
3875
3876/(?<0abc>xx)/
3877
3878/(?&1abc)xx(?<1abc>y)/
3879
3880/(?<ab-cd>xx)/
3881
3882/(?'0abc'xx)/
3883
3884/(?P<0abc>xx)/
3885
3886/\k<5ghj>/
3887
3888/\k'5ghj'/
3889
3890/\k{2fgh}/
3891
3892/(?P=8yuki)/
3893
3894/\g{4df}/
3895
3896/(?&1abc)xx(?<1abc>y)/
3897
3898/(?P>1abc)xx(?<1abc>y)/
3899
3900/\g'3gh'/
3901
3902/\g<5fg>/
3903
3904/(?(<4gh>)abc)/
3905
3906/(?('4gh')abc)/
3907
3908/(?(4gh)abc)/
3909
3910/(?(R&6yh)abc)/
3911
3912/(((a\2)|(a*)\g<-1>))*a?/B
3913
3914# Test the ugly "start or end of word" compatibility syntax.
3915
3916/[[:<:]]red[[:>:]]/B
3917    little red riding hood
3918    a /red/ thing
3919    red is a colour
3920    put it all on red
3921\= Expect no match
3922    no reduction
3923    Alfred Winifred
3924
3925/[a[:<:]] should give error/
3926
3927/(?=ab\K)/aftertext
3928    abcd\=startchar
3929
3930/abcd/newline=lf,firstline
3931\= Expect no match
3932    xx\nxabcd
3933
3934# Test stack guard external calls.
3935
3936/(((a)))/stackguard=1
3937
3938/(((a)))/stackguard=2
3939
3940/(((a)))/stackguard=3
3941
3942/(((((a)))))/
3943
3944# End stack guard tests
3945
3946/^\w+(?>\s*)(?<=\w)/B
3947
3948/\othing/
3949
3950/\o{}/
3951
3952/\o{whatever}/
3953
3954/\xthing/
3955
3956/\x{}/
3957
3958/\x{whatever}/
3959
3960/A\8B/
3961
3962/A\9B/
3963
3964# This one is here because Perl fails to match "12" for this pattern when the $
3965# is present.
3966
3967/^(?(?=abc)\w{3}:|\d\d)$/
3968    abc:
3969    12
3970\= Expect no match
3971    123
3972    xyz
3973
3974# Perl gets this one wrong, giving "a" as the after text for ca and failing to
3975# match for cd.
3976
3977/(?(?=ab)ab)/aftertext
3978    abxxx
3979    ca
3980    cd
3981
3982# This should test both paths for processing OP_RECURSE.
3983
3984/(?(R)a+|(?R)b)/
3985    aaaabcde
3986    aaaabcde\=ovector=100
3987
3988/a*?b*?/
3989    ab
3990
3991/(*NOTEMPTY)a*?b*?/
3992    ab
3993    ba
3994    cb
3995
3996/(*NOTEMPTY_ATSTART)a*?b*?/aftertext
3997    ab
3998    cdab
3999
4000/(?(VERSION>=10.0)yes|no)/I
4001    yesno
4002
4003/(?(VERSION=8)yes){3}/BI,aftertext
4004    yesno
4005
4006/(?(VERSION=8)yes|no){3}/I
4007    yesnononoyes
4008\= Expect no match
4009    yesno
4010
4011/(?:(?<VERSION>abc)|xyz)(?(VERSION)yes|no)/I
4012    abcyes
4013    xyzno
4014\= Expect no match
4015    abcno
4016    xyzyes
4017
4018/(?(VERSION<10)yes|no)/
4019
4020/(?(VERSION>10)yes|no)/
4021
4022/(?(VERSION>=10.0.0)yes|no)/
4023
4024/(?(VERSION=10.101)yes|no)/
4025
4026/abcd/I
4027
4028/abcd/I,no_start_optimize
4029
4030/(|ab)*?d/I
4031   abd
4032   xyd
4033
4034/(|ab)*?d/I,no_start_optimize
4035   abd
4036   xyd
4037
4038/\k<A>*(?<A>aa)(?<A>bb)/match_unset_backref,dupnames
4039    aabb
4040
4041/(((((a)))))/parens_nest_limit=2
4042
4043/abc/replace=XYZ
4044    123123
4045    123abc123
4046    123abc123abc123
4047    123123\=zero_terminate
4048    123abc123\=zero_terminate
4049    123abc123abc123\=zero_terminate
4050
4051/abc/g,replace=XYZ
4052    123abc123
4053    123abc123abc123
4054
4055/abc/replace=X$$Z
4056    123abc123
4057
4058/abc/g,replace=X$$Z
4059    123abc123abc123
4060
4061/a(b)c(d)e/replace=X$1Y${2}Z
4062    "abcde"
4063
4064/a(b)c(d)e/replace=X$1Y${2}Z,global
4065    "abcde-abcde"
4066
4067/a(?<ONE>b)c(?<TWO>d)e/replace=X$ONE+${TWO}Z
4068    "abcde"
4069
4070/a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z
4071    "abcde-abcde-"
4072
4073/abc/replace=a$++
4074    123abc
4075
4076/abc/replace=a$bad
4077    123abc
4078
4079/abc/replace=a${A234567890123456789_123456789012}z
4080    123abc
4081
4082/abc/replace=a${A23456789012345678901234567890123}z
4083    123abc
4084
4085/abc/replace=a${bcd
4086    123abc
4087
4088/abc/replace=a${b+d}z
4089    123abc
4090
4091/abc/replace=[10]XYZ
4092    123abc123
4093
4094/abc/replace=[9]XYZ
4095    123abc123
4096
4097/abc/replace=xyz
4098    1abc2\=partial_hard
4099
4100/abc/replace=xyz
4101    123abc456
4102    123abc456\=replace=pqr
4103    123abc456abc789
4104    123abc456abc789\=g
4105
4106/(?<=abc)(|def)/g,replace=<$0>
4107    123abcxyzabcdef789abcpqr
4108
4109/./replace=$0
4110    a
4111
4112/(.)(.)/replace=$2+$1
4113    abc
4114
4115/(?<A>.)(?<B>.)/replace=$B+$A
4116    abc
4117
4118/(.)(.)/g,replace=$2$1
4119    abcdefgh
4120
4121/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=${*MARK}
4122    apple lemon blackberry
4123    apple strudel
4124    fruitless
4125
4126/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} sauce,
4127    apple lemon blackberry
4128
4129/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK>
4130    apple lemon blackberry
4131    apple strudel
4132    fruitless
4133
4134/(*:pear)apple/g,replace=${*MARKING}
4135    apple lemon blackberry
4136
4137/(*:pear)apple/g,replace=${*MARK-time
4138    apple lemon blackberry
4139
4140/(*:pear)apple/g,replace=${*mark}
4141    apple lemon blackberry
4142
4143/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARKET>
4144    apple lemon blackberry
4145
4146/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[22]${*MARK}
4147    apple lemon blackberry
4148    apple lemon blackberry\=substitute_overflow_length
4149
4150/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[23]${*MARK}
4151    apple lemon blackberry
4152
4153/abc/
4154    123abc123\=replace=[9]XYZ
4155    123abc123\=substitute_overflow_length,replace=[9]XYZ
4156    123abc123\=substitute_overflow_length,replace=[6]XYZ
4157    123abc123\=substitute_overflow_length,replace=[1]XYZ
4158    123abc123\=substitute_overflow_length,replace=[0]XYZ
4159
4160/a(b)c/
4161    123abc123\=replace=[9]x$1z
4162    123abc123\=substitute_overflow_length,replace=[9]x$1z
4163    123abc123\=substitute_overflow_length,replace=[6]x$1z
4164    123abc123\=substitute_overflow_length,replace=[1]x$1z
4165    123abc123\=substitute_overflow_length,replace=[0]x$1z
4166
4167"((?=(?(?=(?(?=(?(?=()))))))))"
4168    a
4169
4170"(?(?=)==)(((((((((?=)))))))))"
4171\= Expect no match
4172    a
4173
4174/(a)(b)|(c)/
4175    XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
4176
4177/x(?=ab\K)/
4178    xab\=get=0
4179    xab\=copy=0
4180    xab\=getall
4181
4182/(?<A>a)|(?<A>b)/dupnames
4183    a\=ovector=1,copy=A,get=A,get=2
4184    a\=ovector=2,copy=A,get=A,get=2
4185    b\=ovector=2,copy=A,get=A,get=2
4186
4187/a(b)c(d)/
4188    abc\=ph,copy=0,copy=1,getall
4189
4190/^abc/info
4191
4192/^abc/info,no_dotstar_anchor
4193
4194/.*\d/info,auto_callout
4195\= Expect no match
4196    aaa
4197
4198/.*\d/info,no_dotstar_anchor,auto_callout
4199\= Expect no match
4200    aaa
4201
4202/.*\d/dotall,info
4203
4204/.*\d/dotall,no_dotstar_anchor,info
4205
4206/(*NO_DOTSTAR_ANCHOR)(?s).*\d/info
4207
4208'^(?:(a)|b)(?(1)A|B)'
4209    aA123\=ovector=1
4210    aA123\=ovector=2
4211
4212'^(?:(?<AA>a)|b)(?(<AA>)A|B)'
4213    aA123\=ovector=1
4214    aA123\=ovector=2
4215
4216'^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'dupnames
4217    aA123\=ovector=1
4218    aA123\=ovector=2
4219    aA123\=ovector=3
4220
4221'^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'dupnames
4222    aa123\=ovector=1
4223    aa123\=ovector=2
4224    aa123\=ovector=3
4225
4226/(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
4227
4228/(?<N>(?J)(?<N>))(?-J)\k<N>/
4229
4230# Quantifiers are not allowed on condition assertions, but are otherwise
4231# OK in conditions.
4232
4233/(?(?=0)?)+/
4234
4235/(?(?=0)(?=00)?00765)/
4236     00765
4237
4238/(?(?=0)(?=00)?00765|(?!3).56)/
4239     00765
4240     456
4241\= Expect no match
4242     356
4243
4244'^(a)*+(\w)'
4245    g
4246    g\=ovector=1
4247
4248'^(?:a)*+(\w)'
4249    g
4250    g\=ovector=1
4251
4252# These two pattern showeds up compile-time bugs
4253
4254"((?2){0,1999}())?"
4255
4256/((?+1)(\1))/B
4257
4258# Callouts with string arguments
4259
4260/a(?C"/
4261
4262/a(?C"a/
4263
4264/a(?C"a"/
4265
4266/a(?C"a"bcde(?C"b")xyz/
4267
4268/a(?C"a)b""c")/B
4269
4270/ab(?C" any text with spaces ")cde/B
4271    abcde
4272    12abcde
4273
4274/^a(b)c(?C1)def/
4275      abcdef
4276
4277/^a(b)c(?C"AB")def/
4278      abcdef
4279
4280/^a(b)c(?C1)def/
4281      abcdef\=callout_capture
4282
4283/^a(b)c(?C{AB})def/B
4284      abcdef\=callout_capture
4285
4286/(?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
4287
4288/(?:a(?C`code`)){3}/B
4289
4290/^(?(?C25)(?=abc)abcd|xyz)/B,callout_info
4291    abcdefg
4292    xyz123
4293
4294/^(?(?C$abc$)(?=abc)abcd|xyz)/B
4295    abcdefg
4296    xyz123
4297
4298/^ab(?C'first')cd(?C"second")ef/
4299    abcdefg
4300
4301/(?:a(?C`code`)){3}X/
4302    aaaXY
4303
4304# Binary zero in callout string
4305#  a  (  ?  C  '  x     z  '  )  b
4306/ 61 28 3f 43 27 78 00 7a 27 29 62/hex,callout_info
4307    abcdefgh
4308
4309/(?(?!)^)/
4310
4311/(?(?!)a|b)/
4312    bbb
4313\= Expect no match
4314    aaa
4315
4316# JIT gives a different error message for the infinite recursion
4317
4318"(*NO_JIT)((?2)+)((?1)){"
4319    abcd{
4320
4321# Perl fails to diagnose the absence of an assertion
4322
4323"(?(?<E>.*!.*)?)"
4324
4325"X((?2)()*+){2}+"B
4326
4327"X((?2)()*+){2}"B
4328
4329/(?<=\bABQ(3(?-7)))/
4330
4331/(?<=\bABQ(3(?+7)))/
4332
4333";(?<=()((?3))((?2)))"
4334
4335# Perl loops on this (PCRE2 used to!)
4336
4337/(?<=\Ka)/g,aftertext
4338    aaaaa
4339
4340/(?<=\Ka)/altglobal,aftertext
4341    aaaaa
4342
4343/((?2){73}(?2))((?1))/info
4344
4345/abc/
4346\= Expect no match
4347    \[9x!xxx(]{9999}
4348
4349/(abc)*/
4350    \[abc]{5}
4351
4352/^/gm
4353    \n\n\n
4354
4355/^/gm,alt_circumflex
4356    \n\n\n
4357
4358/((((((((x))))))))\81/
4359    xx1
4360
4361/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\80/
4362    xx
4363
4364/\80/
4365
4366/A\8B\9C/
4367    A8B9C
4368
4369/(?x:((?'a')) # comment (with parentheses) and | vertical
4370(?-x:#not a comment (?'b')) # this is a comment ()
4371(?'c')) # not a comment (?'d')/info
4372
4373/(?|(?'a')(2)(?'b')|(?'a')(?'a')(3))/I,dupnames
4374    A23B
4375    B32A
4376
4377# These are some patterns that used to cause buffer overflows or other errors
4378# while compiling.
4379
4380/.((?2)(?R)|\1|$)()/B
4381
4382/.((?3)(?R)()(?2)|\1|$)()/B
4383
4384/(\9*+(?2);\3++()2|)++{/
4385
4386/\V\x85\9*+((?2)\3++()2)*:2/
4387
4388/(((?(R)){0,2}) (?'x'((?'R')((?'R')))))/dupnames
4389
4390/(((?(X)){0,2}) (?'x'((?'X')((?'X')))))/dupnames
4391
4392/(((?(R)){0,2}) (?'x'((?'X')((?'R')))))/
4393
4394"(?J)(?'d'(?'d'\g{d}))"
4395
4396"(?=!((?2)(?))({8(?<=(?1){29}8bbbb\x16\xd\xc6^($(\xa9H4){4}h}?1)B))\x15')"
4397
4398/A(?'')Z/
4399
4400"(?J:(?|(?'R')(\k'R')|((?'R'))))"
4401
4402/(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
4403
4404/^(?:(?(1)x|)+)+$()/B
4405
4406/[[:>:]](?<)/
4407
4408/((?x)(*:0))#(?'/
4409
4410/(?C$[$)(?<]/
4411
4412/(?C$)$)(?<]/
4413
4414/(?(R))*+/B
4415    abcd
4416
4417/((?x)(?#))#(?'/
4418
4419/((?x)(?#))#(?'abc')/I
4420
4421/[[:\\](?<[::]/
4422
4423/[[:\\](?'abc')[a:]/I
4424
4425"[[[.\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[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
4426
4427/()(?(R)0)*+/B
4428
4429/(?R-:(?</
4430
4431/(?R-:(?<)/
4432
4433/(?(?C{\Q})(?!(?'/
4434
4435/(?(?C{\Q})(?!(?'abc')))/I
4436
4437/(?1){3918}(((((0(\k'R'))))(?J)(?'R'(?'R'\3){99})))/I
4438
4439/(?|(aaa)|(b))\g{1}/I
4440
4441/(?|(aaa)|(b))(?1)/I
4442
4443/(?|(aaa)|(b))/I
4444
4445/(?|(?'a'aaa)|(?'a'b))\k'a'/I
4446
4447/(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/I,dupnames
4448
4449/ab{3cd/
4450    ab{3cd
4451
4452/ab{3,cd/
4453    ab{3,cd
4454
4455/ab{3,4a}cd/
4456    ab{3,4a}cd
4457
4458/{4,5a}bc/
4459    {4,5a}bc
4460
4461/\x0{ab}/
4462    \0{ab}
4463
4464/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
4465    ababababbbabZXXXX
4466
4467/.*?a(*PRUNE)b/
4468    aab
4469
4470/.*?a(*PRUNE)b/s
4471    aab
4472
4473/^a(*PRUNE)b/s
4474\= Expect no match
4475    aab
4476
4477/.*?a(*SKIP)b/
4478    aab
4479
4480/(?(8000000000/
4481
4482/((?(R8000000000)))/
4483
4484/0(?0)|(1)(*THEN)(*SKIP:0)(*FAIL)/
4485\= Expect no match
4486    01
4487
4488/(?(1)()\983040\2)/
4489
4490/(*LIMIT_MATCH=)abc/
4491
4492/(*CRLF)(*LIMIT_MATCH=)abc/
4493
4494/(?:ab)?(?:ab)(?:ab)/
4495    abab
4496    ababab
4497\= Expect no match
4498    aba
4499
4500/((*MARK:A))++a(*SKIP:B)b/
4501\= Expect no match
4502    aacb
4503
4504/(*MARK:a\zb)z/alt_verbnames
4505
4506/(*:ab\t(d\)c)xxx/
4507
4508/(*:ab\t(d\)c)xxx/alt_verbnames,mark
4509    cxxxz
4510
4511/(*:A\Qxx)x\EB)x/alt_verbnames,mark
4512    x
4513
4514/(*:A\ExxxB)x/alt_verbnames,mark
4515    x
4516
4517/(*: A \ and #comment
4518     \ B)x/x,alt_verbnames,mark
4519    x
4520
4521/(*:A
4522B)x/alt_verbnames,mark
4523    x
4524
4525/(*:abc\Qpqr)/alt_verbnames
4526
4527/abc/use_offset_limit
4528    1234abcde\=offset_limit=100
4529    1234abcde\=offset_limit=9
4530    1234abcde\=offset_limit=4
4531    1234abcde\=offset_limit=4,offset=4
4532\= Expect no match
4533    1234abcde\=offset_limit=4,offset=5
4534    1234abcde\=offset_limit=3
4535
4536/(?<=abc)/use_offset_limit
4537    1234abc\=offset_limit=7
4538\= Expect no match
4539    1234abc\=offset_limit=6
4540
4541/A/g,replace=-,use_offset_limit
4542    XAXAXAXAXA\=offset_limit=4
4543
4544/abc/
4545\= Expect error
4546    1234abcde\=offset_limit=4
4547
4548/^\w/m,use_offset_limit
4549    \n..\naa\=offset_limit=3
4550    \n..\naa\=offset_limit=4
4551
4552/abcd/null_context
4553    abcd\=null_context
4554\= Expect error
4555    abcd\=null_context,find_limits
4556    abcd\=allusedtext,startchar
4557
4558/abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended
4559    abcd
4560
4561/a(bc)(DE)/replace=a\u$1\U$1\E$1\l$2\L$2\Eab\Uab\LYZ\EDone,substitute_extended
4562    abcDE
4563
4564/abcd/replace=xy\kz,substitute_extended
4565    abcd
4566
4567/a(?:(b)|(c))/substitute_extended,replace=X${1:+1:-1}X${2:+2:-2}
4568    ab
4569    ac
4570    ab\=replace=${1:+$1\:$1:$2}
4571    ac\=replace=${1:+$1\:$1:$2}
4572
4573/a(?:(b)|(c))/substitute_extended,replace=X${1:-1:-1}X${2:-2:-2}
4574    ab
4575    ac
4576
4577/(a)/substitute_extended,replace=>${1:+\Q$1:{}$$\E+\U$1}<
4578    a
4579
4580/X(b)Y/substitute_extended
4581    XbY\=replace=x${1:+$1\U$1}y
4582    XbY\=replace=\Ux${1:+$1$1}y
4583
4584/a/substitute_extended,replace=${*MARK:+a:b}
4585    a
4586
4587/(abcd)/replace=${1:+xy\kz},substitute_extended
4588    abcd
4589
4590/(abcd)/
4591    abcd\=replace=${1:+xy\kz},substitute_extended
4592
4593/abcd/substitute_extended,replace=>$1<
4594    abcd
4595
4596/abcd/substitute_extended,replace=>xxx${xyz}<<<
4597    abcd
4598
4599/(?J)(?:(?<A>a)|(?<A>b))/replace=<$A>
4600    [a]
4601    [b]
4602\= Expect error
4603    (a)\=ovector=1
4604
4605/(a)|(b)/replace=<$1>
4606\= Expect error
4607    b
4608
4609/(aa)(BB)/substitute_extended,replace=\U$1\L$2\E$1..\U$1\l$2$1
4610    aaBB
4611
4612/^(o(\1{72}{\"{\\{00000059079}\d*){74}}){19}/I
4613
4614/((p(?'K/
4615
4616/((p(?'K/no_auto_capture
4617
4618/abc/replace=A$3123456789Z
4619    abc
4620
4621/(?<!a{65535}a{5})x/I
4622
4623/(?<!a{65535})x/I
4624
4625/(?=a\K)/replace=z
4626    BaCaD
4627
4628/(?'abcdefghijklmnopqrstuvwxyzABCDEFG'toolong)/
4629
4630/(?'abcdefghijklmnopqrstuvwxyzABCDEF'justright)/
4631
4632# These two use zero-termination
4633/abcd/max_pattern_length=3
4634
4635/abc/max_pattern_length=3
4636
4637# These two, being hex, pass the length
4638/abcdefab/hex,max_pattern_length=3
4639
4640/abcdef/hex,max_pattern_length=3
4641
4642# These two patterns used to take a long time to compile
4643
4644"(.*)
4645((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4646((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4647((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
4648
4649"(?<=a()
4650((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4651((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4652((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4653a)"xI
4654
4655# When (?| is used and groups of the same number may be different,
4656# we have to rely on a count to catch overly complicated patterns.
4657
4658"(?|()|())(.*)
4659((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4660((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4661((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
4662
4663"(?|()|())(?<=a()
4664((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4665((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4666((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
4667a)"xI
4668
4669# Test the use of malloc for caching group information when there are more
4670# groups than fit into the on-stack workspace.
4671
4672/\[()]{1024}/I,expand
4673
4674# Test minlength capped at 65535
4675
4676/(A{65000})\1{65000}/I
4677
4678# Test group scans when numbers are not unique
4679
4680/(?|()+|(a)+)/BI
4681
4682/(?|(a)+|()+)/BI
4683
4684/(?|()|(a))/BI
4685
4686/(?|(a)|())/BI
4687
4688# Test CRLF handling in empty string substitutions
4689
4690/^$/gm,newline=anycrlf,replace=-
4691    X\r\n\r\nY
4692
4693/^$/gm,newline=crlf,replace=-
4694    X\r\n\r\nY
4695
4696/^$/gm,newline=any,replace=-
4697    X\r\n\r\nY
4698
4699"(*ANYCRLF)(?m)^(.*[^0-9\r\n].*|)$"g,replace=NaN
4700    15\r\nfoo\r\n20\r\nbar\r\nbaz\r\n\r\n20
4701
4702/a[[:punct:]b]/bincode
4703
4704/a[b[:punct:]]/bincode
4705
4706/L(?#(|++<!(2)?/B
4707
4708/L(?#(|++<!(2)?/B,no_auto_possess
4709
4710/L(?#(|++<!(2)?/B,auto_callout
4711
4712/L(?#(|++<!(2)?/B,no_auto_possess,auto_callout
4713
4714/(A*)\E+/B,auto_callout
4715
4716/()\Q\E*]/B,auto_callout
4717    a[bc]d
4718
4719/\x8a+f|;T?(*:;.'?`(\xeap ){![^()!y*''C*(?';]{1;(\x08)/B,alt_verbnames,dupnames,extended
4720
4721# Tests for NULL characters in comments and verb "names" and callouts
4722
4723# /A#B\x00C\x0aZ/
4724/41 23 42 00 43 0a 5a/Bx,hex
4725
4726# /A+#B\x00C\x0a+/
4727/41 2b 23 42 00 43 0a 2b/Bx,hex
4728
4729# /A(*:B\x00W#X\00Y\x0aC)Z/
4730/41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex,alt_verbnames
4731
4732# /A(*:B\x00W#X\00Y\x0aC)Z/
4733/41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex
4734
4735# /A(?C{X\x00Y})B/
4736/41 28 3f 43 7b 58 00 59 7d 29 42/B,hex
4737
4738# /A(?#X\x00Y)B/
4739/41 28 3f 23 7b 00 7d 29 42/B,hex
4740
4741# Tests for leading comment in extended patterns
4742
4743/ (?-x):?/extended
4744
4745/(?-x):?/extended
4746
4747/0b 28 3f 2d 78 29 3a/hex,extended
4748
4749/#comment
4750(?-x):?/extended
4751
4752/(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
4753
4754/a|(b)c/replace=>$1<,substitute_unset_empty
4755    cat
4756    xbcom
4757
4758/a|(b)c/
4759    cat\=replace=>$1<
4760    cat\=replace=>$1<,substitute_unset_empty
4761    xbcom\=replace=>$1<,substitute_unset_empty
4762
4763/a|(b)c/substitute_extended
4764    cat\=replace=>${2:-xx}<
4765    cat\=replace=>${2:-xx}<,substitute_unknown_unset
4766    cat\=replace=>${X:-xx}<,substitute_unknown_unset
4767
4768/a|(?'X'b)c/replace=>$X<,substitute_unset_empty
4769    cat
4770    xbcom
4771
4772/a|(?'X'b)c/replace=>$Y<,substitute_unset_empty
4773    cat
4774    cat\=substitute_unknown_unset
4775    cat\=substitute_unknown_unset,-substitute_unset_empty
4776
4777/a|(b)c/replace=>$2<,substitute_unset_empty
4778    cat
4779    cat\=substitute_unknown_unset
4780    cat\=substitute_unknown_unset,-substitute_unset_empty
4781
4782/()()()/use_offset_limit
4783    \=ovector=11000000000
4784    \=callout_fail=11000000000
4785    \=callout_fail=1:11000000000
4786    \=callout_data=11000000000
4787    \=callout_data=-11000000000
4788    \=offset_limit=1100000000000000000000
4789    \=copy=11000000000
4790
4791/(*MARK:A\x00b)/mark
4792    abc
4793
4794/(*MARK:A\x00b)/mark,alt_verbnames
4795    abc
4796
4797/"(*MARK:A" 00 "b)"/mark,hex
4798    abc
4799
4800/"(*MARK:A" 00 "b)"/mark,hex,alt_verbnames
4801    abc
4802
4803/efg/hex
4804
4805/eff/hex
4806
4807/effg/hex
4808
4809/(?J)(?'a'))(?'a')/
4810
4811/(?<=((?C)0))/
4812    9010
4813\= Expect no match
4814    abc
4815
4816/aaa/
4817\[abc]{10000000000000000000000000000}
4818\[a]{3}
4819
4820/\[AB]{6000000000000000000000}/expand
4821
4822# End of testinput2
4823