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------------------------------------------------------------------
19        Bra
20        a\x00b
21        Ket
22        End
23------------------------------------------------------------------
24    a\x{0}b
25 0: a\x00b
26
27# /a0b/ where 0 is a binary zero
28/61 00 62/B,hex
29------------------------------------------------------------------
30        Bra
31        a\x00b
32        Ket
33        End
34------------------------------------------------------------------
35    a\x{0}b
36 0: a\x00b
37
38# /(?#B0C)DE/ where 0 is a binary zero
39/28 3f 23 42 00 43 29 44 45/B,hex
40------------------------------------------------------------------
41        Bra
42        DE
43        Ket
44        End
45------------------------------------------------------------------
46    DE
47 0: DE
48
49/(a)b|/I
50Capture group count = 1
51May match empty string
52Subject length lower bound = 0
53
54/abc/I
55Capture group count = 0
56First code unit = 'a'
57Last code unit = 'c'
58Subject length lower bound = 3
59    abc
60 0: abc
61    defabc
62 0: abc
63    abc\=anchored
64 0: abc
65\= Expect no match
66    defabc\=anchored
67No match
68    ABC
69No match
70
71/^abc/I
72Capture group count = 0
73Compile options: <none>
74Overall options: anchored
75First code unit = 'a'
76Subject length lower bound = 3
77    abc
78 0: abc
79    abc\=anchored
80 0: abc
81\= Expect no match
82    defabc
83No match
84    defabc\=anchored
85No match
86
87/a+bc/I
88Capture group count = 0
89First code unit = 'a'
90Last code unit = 'c'
91Subject length lower bound = 3
92
93/a*bc/I
94Capture group count = 0
95Starting code units: a b
96Last code unit = 'c'
97Subject length lower bound = 2
98
99/a{3}bc/I
100Capture group count = 0
101First code unit = 'a'
102Last code unit = 'c'
103Subject length lower bound = 5
104
105/(abc|a+z)/I
106Capture group count = 1
107First code unit = 'a'
108Subject length lower bound = 2
109
110/^abc$/I
111Capture group count = 0
112Compile options: <none>
113Overall options: anchored
114First code unit = 'a'
115Subject length lower bound = 3
116    abc
117 0: abc
118\= Expect no match
119    def\nabc
120No match
121
122/ab\idef/
123Failed: error 103 at offset 3: unrecognized character follows \
124
125/(?X)ab\idef/
126Failed: error 111 at offset 2: unrecognized character after (? or (?-
127
128/x{5,4}/
129Failed: error 104 at offset 5: numbers out of order in {} quantifier
130
131/z{65536}/
132Failed: error 105 at offset 7: number too big in {} quantifier
133
134/[abcd/
135Failed: error 106 at offset 5: missing terminating ] for character class
136
137/[\B]/B
138Failed: error 107 at offset 2: escape sequence is invalid in character class
139
140/[\R]/B
141Failed: error 107 at offset 2: escape sequence is invalid in character class
142
143/[\X]/B
144Failed: error 107 at offset 2: escape sequence is invalid in character class
145
146/[z-a]/
147Failed: error 108 at offset 3: range out of order in character class
148
149/^*/
150Failed: error 109 at offset 1: quantifier does not follow a repeatable item
151
152/(abc/
153Failed: error 114 at offset 4: missing closing parenthesis
154
155/(?# abc/
156Failed: error 118 at offset 7: missing ) after (?# comment
157
158/(?z)abc/
159Failed: error 111 at offset 2: unrecognized character after (? or (?-
160
161/.*b/I
162Capture group count = 0
163First code unit at start or follows newline
164Last code unit = 'b'
165Subject length lower bound = 1
166
167/.*?b/I
168Capture group count = 0
169First code unit at start or follows newline
170Last code unit = 'b'
171Subject length lower bound = 1
172
173/cat|dog|elephant/I
174Capture group count = 0
175Starting code units: c d e
176Subject length lower bound = 3
177    this sentence eventually mentions a cat
178 0: cat
179    this sentences rambles on and on for a while and then reaches elephant
180 0: elephant
181
182/cat|dog|elephant/I
183Capture group count = 0
184Starting code units: c d e
185Subject length lower bound = 3
186    this sentence eventually mentions a cat
187 0: cat
188    this sentences rambles on and on for a while and then reaches elephant
189 0: elephant
190
191/cat|dog|elephant/Ii
192Capture group count = 0
193Options: caseless
194Starting code units: C D E c d e
195Subject length lower bound = 3
196    this sentence eventually mentions a CAT cat
197 0: CAT
198    this sentences rambles on and on for a while to elephant ElePhant
199 0: elephant
200
201/a|[bcd]/I
202Capture group count = 0
203Starting code units: a b c d
204Subject length lower bound = 1
205
206/(a|[^\dZ])/I
207Capture group count = 1
208Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
209  \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19
210  \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( ) * + , - . / : ; < = >
211  ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y [ \ ] ^ _ ` a b c d
212  e f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80 \x81 \x82 \x83
213  \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92
214  \x93 \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa0 \xa1
215  \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0
216  \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf
217  \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce
218  \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd
219  \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec
220  \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb
221  \xfc \xfd \xfe \xff
222Subject length lower bound = 1
223
224/(a|b)*[\s]/I
225Capture group count = 1
226Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 a b
227Subject length lower bound = 1
228
229/(ab\2)/
230Failed: error 115 at offset 4: reference to non-existent subpattern
231
232/{4,5}abc/
233Failed: error 109 at offset 4: quantifier does not follow a repeatable item
234
235/(a)(b)(c)\2/I
236Capture group count = 3
237Max back reference = 2
238First code unit = 'a'
239Last code unit = 'c'
240Subject length lower bound = 4
241    abcb
242 0: abcb
243 1: a
244 2: b
245 3: c
246    abcb\=ovector=0
247 0: abcb
248 1: a
249 2: b
250 3: c
251    abcb\=ovector=1
252Matched, but too many substrings
253 0: abcb
254    abcb\=ovector=2
255Matched, but too many substrings
256 0: abcb
257 1: a
258    abcb\=ovector=3
259Matched, but too many substrings
260 0: abcb
261 1: a
262 2: b
263    abcb\=ovector=4
264 0: abcb
265 1: a
266 2: b
267 3: c
268
269/(a)bc|(a)(b)\2/I
270Capture group count = 3
271Max back reference = 2
272First code unit = 'a'
273Subject length lower bound = 3
274    abc
275 0: abc
276 1: a
277    abc\=ovector=0
278 0: abc
279 1: a
280    abc\=ovector=1
281Matched, but too many substrings
282 0: abc
283    abc\=ovector=2
284 0: abc
285 1: a
286    aba
287 0: aba
288 1: <unset>
289 2: a
290 3: b
291    aba\=ovector=0
292 0: aba
293 1: <unset>
294 2: a
295 3: b
296    aba\=ovector=1
297Matched, but too many substrings
298 0: aba
299    aba\=ovector=2
300Matched, but too many substrings
301 0: aba
302 1: <unset>
303    aba\=ovector=3
304Matched, but too many substrings
305 0: aba
306 1: <unset>
307 2: a
308    aba\=ovector=4
309 0: aba
310 1: <unset>
311 2: a
312 3: b
313
314/abc$/I,dollar_endonly
315Capture group count = 0
316Options: dollar_endonly
317First code unit = 'a'
318Last code unit = 'c'
319Subject length lower bound = 3
320    abc
321 0: abc
322\= Expect no match
323    abc\n
324No match
325    abc\ndef
326No match
327
328/(a)(b)(c)(d)(e)\6/
329Failed: error 115 at offset 16: reference to non-existent subpattern
330
331/the quick brown fox/I
332Capture group count = 0
333First code unit = 't'
334Last code unit = 'x'
335Subject length lower bound = 19
336    the quick brown fox
337 0: the quick brown fox
338    this is a line with the quick brown fox
339 0: the quick brown fox
340
341/the quick brown fox/I,anchored
342Capture group count = 0
343Options: anchored
344First code unit = 't'
345Subject length lower bound = 19
346    the quick brown fox
347 0: the quick brown fox
348\= Expect no match
349    this is a line with the quick brown fox
350No match
351
352/ab(?z)cd/
353Failed: error 111 at offset 4: unrecognized character after (? or (?-
354
355/^abc|def/I
356Capture group count = 0
357Starting code units: a d
358Subject length lower bound = 3
359    abcdef
360 0: abc
361    abcdef\=notbol
362 0: def
363
364/.*((abc)$|(def))/I
365Capture group count = 3
366First code unit at start or follows newline
367Subject length lower bound = 3
368    defabc
369 0: defabc
370 1: abc
371 2: abc
372    defabc\=noteol
373 0: def
374 1: def
375 2: <unset>
376 3: def
377
378/)/
379Failed: error 122 at offset 0: unmatched closing parenthesis
380
381/a[]b/
382Failed: error 106 at offset 4: missing terminating ] for character class
383
384/[^aeiou ]{3,}/I
385Capture group count = 0
386Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
387  \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19
388  \x1a \x1b \x1c \x1d \x1e \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6
389  7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [
390  \ ] ^ _ ` b c d f g h j k l m n p q r s t v w x y z { | } ~ \x7f \x80 \x81
391  \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90
392  \x91 \x92 \x93 \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f
393  \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae
394  \xaf \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd
395  \xbe \xbf \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc
396  \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb
397  \xdc \xdd \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea
398  \xeb \xec \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9
399  \xfa \xfb \xfc \xfd \xfe \xff
400Subject length lower bound = 3
401    co-processors, and for
402 0: -pr
403
404/<.*>/I
405Capture group count = 0
406First code unit = '<'
407Last code unit = '>'
408Subject length lower bound = 2
409    abc<def>ghi<klm>nop
410 0: <def>ghi<klm>
411
412/<.*?>/I
413Capture group count = 0
414First code unit = '<'
415Last code unit = '>'
416Subject length lower bound = 2
417    abc<def>ghi<klm>nop
418 0: <def>
419
420/<.*>/I,ungreedy
421Capture group count = 0
422Options: ungreedy
423First code unit = '<'
424Last code unit = '>'
425Subject length lower bound = 2
426    abc<def>ghi<klm>nop
427 0: <def>
428
429/(?U)<.*>/I
430Capture group count = 0
431First code unit = '<'
432Last code unit = '>'
433Subject length lower bound = 2
434    abc<def>ghi<klm>nop
435 0: <def>
436
437/<.*?>/I,ungreedy
438Capture group count = 0
439Options: ungreedy
440First code unit = '<'
441Last code unit = '>'
442Subject length lower bound = 2
443    abc<def>ghi<klm>nop
444 0: <def>ghi<klm>
445
446/={3,}/I,ungreedy
447Capture group count = 0
448Options: ungreedy
449First code unit = '='
450Last code unit = '='
451Subject length lower bound = 3
452    abc========def
453 0: ===
454
455/(?U)={3,}?/I
456Capture group count = 0
457First code unit = '='
458Last code unit = '='
459Subject length lower bound = 3
460    abc========def
461 0: ========
462
463/(?<!bar|cattle)foo/I
464Capture group count = 0
465Max lookbehind = 6
466First code unit = 'f'
467Last code unit = 'o'
468Subject length lower bound = 3
469    foo
470 0: foo
471    catfoo
472 0: foo
473\= Expect no match
474    the barfoo
475No match
476    and cattlefoo
477No match
478
479/abc(?<=a+)b/
480Failed: error 125 at offset 3: lookbehind assertion is not fixed length
481
482/12345(?<=aaa|b{0,3})b/
483Failed: error 125 at offset 5: lookbehind assertion is not fixed length
484
485/(?<!(foo)a\1)bar/
486
487/(?i)abc/I
488Capture group count = 0
489First code unit = 'a' (caseless)
490Last code unit = 'c' (caseless)
491Subject length lower bound = 3
492
493/(a|(?m)a)/I
494Capture group count = 1
495First code unit = 'a'
496Subject length lower bound = 1
497
498/(?i)^1234/I
499Capture group count = 0
500Compile options: <none>
501Overall options: anchored
502First code unit = '1'
503Subject length lower bound = 4
504
505/(^b|(?i)^d)/I
506Capture group count = 1
507Compile options: <none>
508Overall options: anchored
509Starting code units: D b d
510Subject length lower bound = 1
511
512/(?s).*/I
513Capture group count = 0
514May match empty string
515Compile options: <none>
516Overall options: anchored
517Subject length lower bound = 0
518
519/[abcd]/I
520Capture group count = 0
521Starting code units: a b c d
522Subject length lower bound = 1
523
524/(?i)[abcd]/I
525Capture group count = 0
526Starting code units: A B C D a b c d
527Subject length lower bound = 1
528
529/(?m)[xy]|(b|c)/I
530Capture group count = 1
531Starting code units: b c x y
532Subject length lower bound = 1
533
534/(^a|^b)/Im
535Capture group count = 1
536Options: multiline
537First code unit at start or follows newline
538Subject length lower bound = 1
539
540/(?i)(^a|^b)/Im
541Capture group count = 1
542Options: multiline
543First code unit at start or follows newline
544Subject length lower bound = 1
545
546/(a)(?(1)a|b|c)/
547Failed: error 127 at offset 3: conditional subpattern contains more than two branches
548
549/(?(?=a)a|b|c)/
550Failed: error 127 at offset 0: conditional subpattern contains more than two branches
551
552/(?(1a)/
553Failed: error 124 at offset 4: missing closing parenthesis for condition
554
555/(?(1a))/
556Failed: error 124 at offset 4: missing closing parenthesis for condition
557
558/(?(?i))/
559Failed: error 128 at offset 2: assertion expected after (?( or (?(?C)
560
561/(?(abc))/
562Failed: error 115 at offset 3: reference to non-existent subpattern
563
564/(?(?<ab))/
565Failed: error 128 at offset 2: assertion expected after (?( or (?(?C)
566
567/((?s)blah)\s+\1/I
568Capture group count = 1
569Max back reference = 1
570First code unit = 'b'
571Last code unit = 'h'
572Subject length lower bound = 9
573
574/((?i)blah)\s+\1/I
575Capture group count = 1
576Max back reference = 1
577First code unit = 'b' (caseless)
578Last code unit = 'h' (caseless)
579Subject length lower bound = 9
580
581/((?i)b)/IB
582------------------------------------------------------------------
583        Bra
584        CBra 1
585     /i b
586        Ket
587        Ket
588        End
589------------------------------------------------------------------
590Capture group count = 1
591First code unit = 'b' (caseless)
592Subject length lower bound = 1
593
594/(a*b|(?i:c*(?-i)d))/I
595Capture group count = 1
596Starting code units: C a b c d
597Subject length lower bound = 1
598
599/a$/I
600Capture group count = 0
601First code unit = 'a'
602Subject length lower bound = 1
603    a
604 0: a
605    a\n
606 0: a
607\= Expect no match
608    a\=noteol
609No match
610    a\n\=noteol
611No match
612
613/a$/Im
614Capture group count = 0
615Options: multiline
616First code unit = 'a'
617Subject length lower bound = 1
618    a
619 0: a
620    a\n
621 0: a
622    a\n\=noteol
623 0: a
624\= Expect no match
625    a\=noteol
626No match
627
628/\Aabc/Im
629Capture group count = 0
630Max lookbehind = 1
631Compile options: multiline
632Overall options: anchored multiline
633First code unit = 'a'
634Subject length lower bound = 3
635
636/^abc/Im
637Capture group count = 0
638Options: multiline
639First code unit at start or follows newline
640Last code unit = 'c'
641Subject length lower bound = 3
642
643/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/I
644Capture group count = 5
645Compile options: <none>
646Overall options: anchored
647First code unit = 'a'
648Subject length lower bound = 3
649  aaaaabbbbbcccccdef
650 0: aaaaabbbbbcccccdef
651 1: aaaaabbbbbcccccdef
652 2: aaaaa
653 3: b
654 4: bbbbccccc
655 5: def
656
657/(?<=foo)[ab]/I
658Capture group count = 0
659Max lookbehind = 3
660Starting code units: a b
661Subject length lower bound = 1
662
663/(?<!foo)(alpha|omega)/I
664Capture group count = 1
665Max lookbehind = 3
666Starting code units: a o
667Last code unit = 'a'
668Subject length lower bound = 5
669
670/(?!alphabet)[ab]/I
671Capture group count = 0
672Starting code units: a b
673Subject length lower bound = 1
674
675/(?<=foo\n)^bar/Im
676Capture group count = 0
677Max lookbehind = 4
678Contains explicit CR or LF match
679Options: multiline
680Last code unit = 'r'
681Subject length lower bound = 3
682    foo\nbarbar
683 0: bar
684\= Expect no match
685    rhubarb
686No match
687    barbell
688No match
689    abc\nbarton
690No match
691
692/^(?<=foo\n)bar/Im
693Capture group count = 0
694Max lookbehind = 4
695Contains explicit CR or LF match
696Options: multiline
697First code unit at start or follows newline
698Last code unit = 'r'
699Subject length lower bound = 3
700    foo\nbarbar
701 0: bar
702\= Expect no match
703    rhubarb
704No match
705    barbell
706No match
707    abc\nbarton
708No match
709
710/(?>^abc)/Im
711Capture group count = 0
712Options: multiline
713First code unit at start or follows newline
714Last code unit = 'c'
715Subject length lower bound = 3
716    abc
717 0: abc
718    def\nabc
719 0: abc
720\= Expect no match
721    defabc
722No match
723
724/(?<=ab(c+)d)ef/
725Failed: error 125 at offset 0: lookbehind assertion is not fixed length
726
727/(?<=ab(?<=c+)d)ef/
728Failed: error 125 at offset 6: lookbehind assertion is not fixed length
729
730/(?<=ab(c|de)f)g/
731Failed: error 125 at offset 0: lookbehind assertion is not fixed length
732
733/The next three are in testinput2 because they have variable length branches/
734
735/(?<=bullock|donkey)-cart/I
736Capture group count = 0
737Max lookbehind = 7
738First code unit = '-'
739Last code unit = 't'
740Subject length lower bound = 5
741    the bullock-cart
742 0: -cart
743    a donkey-cart race
744 0: -cart
745\= Expect no match
746    cart
747No match
748    horse-and-cart
749No match
750
751/(?<=ab(?i)x|y|z)/I
752Capture group count = 0
753Max lookbehind = 3
754May match empty string
755Subject length lower bound = 0
756
757/(?>.*)(?<=(abcd)|(xyz))/I
758Capture group count = 2
759Max lookbehind = 4
760May match empty string
761Subject length lower bound = 0
762    alphabetabcd
763 0: alphabetabcd
764 1: abcd
765    endingxyz
766 0: endingxyz
767 1: <unset>
768 2: xyz
769
770/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/I
771Capture group count = 0
772Max lookbehind = 4
773First code unit = 'Z'
774Last code unit = 'Z'
775Subject length lower bound = 2
776    abxyZZ
777 0: ZZ
778    abXyZZ
779 0: ZZ
780    ZZZ
781 0: ZZ
782    zZZ
783 0: ZZ
784    bZZ
785 0: ZZ
786    BZZ
787 0: ZZ
788\= Expect no match
789    ZZ
790No match
791    abXYZZ
792No match
793    zzz
794No match
795    bzz
796No match
797
798/(?<!(foo)a)bar/I
799Capture group count = 1
800Max lookbehind = 4
801First code unit = 'b'
802Last code unit = 'r'
803Subject length lower bound = 3
804    bar
805 0: bar
806    foobbar
807 0: bar
808\= Expect no match
809    fooabar
810No match
811
812# Perl does not fail these two for the final subjects.
813
814/^(xa|=?\1a){2}$/
815    xa=xaa
816 0: xa=xaa
817 1: =xaa
818\= Expect no match
819    xa=xaaa
820No match
821
822/^(xa|=?\1a)+$/
823    xa=xaa
824 0: xa=xaa
825 1: =xaa
826\= Expect no match
827    xa=xaaa
828No match
829
830# These are syntax tests from Perl 5.005
831
832/a[b-a]/
833Failed: error 108 at offset 4: range out of order in character class
834
835/a[]b/
836Failed: error 106 at offset 4: missing terminating ] for character class
837
838/a[/
839Failed: error 106 at offset 2: missing terminating ] for character class
840
841/*a/
842Failed: error 109 at offset 0: quantifier does not follow a repeatable item
843
844/(*)b/
845Failed: error 109 at offset 1: quantifier does not follow a repeatable item
846
847/abc)/
848Failed: error 122 at offset 3: unmatched closing parenthesis
849
850/(abc/
851Failed: error 114 at offset 4: missing closing parenthesis
852
853/a**/
854Failed: error 109 at offset 2: quantifier does not follow a repeatable item
855
856/)(/
857Failed: error 122 at offset 0: unmatched closing parenthesis
858
859/\1/
860Failed: error 115 at offset 1: reference to non-existent subpattern
861
862/\2/
863Failed: error 115 at offset 1: reference to non-existent subpattern
864
865/(a)|\2/
866Failed: error 115 at offset 5: reference to non-existent subpattern
867
868/a[b-a]/Ii
869Failed: error 108 at offset 4: range out of order in character class
870
871/a[]b/Ii
872Failed: error 106 at offset 4: missing terminating ] for character class
873
874/a[/Ii
875Failed: error 106 at offset 2: missing terminating ] for character class
876
877/*a/Ii
878Failed: error 109 at offset 0: quantifier does not follow a repeatable item
879
880/(*)b/Ii
881Failed: error 109 at offset 1: quantifier does not follow a repeatable item
882
883/abc)/Ii
884Failed: error 122 at offset 3: unmatched closing parenthesis
885
886/(abc/Ii
887Failed: error 114 at offset 4: missing closing parenthesis
888
889/a**/Ii
890Failed: error 109 at offset 2: quantifier does not follow a repeatable item
891
892/)(/Ii
893Failed: error 122 at offset 0: unmatched closing parenthesis
894
895/:(?:/
896Failed: error 114 at offset 4: missing closing parenthesis
897
898/(?<%)b/
899Failed: error 162 at offset 3: subpattern name expected
900
901/a(?{)b/
902Failed: error 111 at offset 3: unrecognized character after (? or (?-
903
904/a(?{{})b/
905Failed: error 111 at offset 3: unrecognized character after (? or (?-
906
907/a(?{}})b/
908Failed: error 111 at offset 3: unrecognized character after (? or (?-
909
910/a(?{"{"})b/
911Failed: error 111 at offset 3: unrecognized character after (? or (?-
912
913/a(?{"{"}})b/
914Failed: error 111 at offset 3: unrecognized character after (? or (?-
915
916/(?(1?)a|b)/
917Failed: error 124 at offset 4: missing closing parenthesis for condition
918
919/[a[:xyz:/
920Failed: error 106 at offset 8: missing terminating ] for character class
921
922/(?<=x+)y/
923Failed: error 125 at offset 0: lookbehind assertion is not fixed length
924
925/a{37,17}/
926Failed: error 104 at offset 7: numbers out of order in {} quantifier
927
928/abc/\
929Failed: error 101 at offset 4: \ at end of pattern
930
931/abc/\i
932Failed: error 101 at offset 4: \ at end of pattern
933
934/(a)bc(d)/I
935Capture group count = 2
936First code unit = 'a'
937Last code unit = 'd'
938Subject length lower bound = 4
939    abcd
940 0: abcd
941 1: a
942 2: d
943    abcd\=copy=2
944 0: abcd
945 1: a
946 2: d
947 2C d (1)
948    abcd\=copy=5
949 0: abcd
950 1: a
951 2: d
952Copy substring 5 failed (-49): unknown substring
953
954/(.{20})/I
955Capture group count = 1
956Subject length lower bound = 20
957    abcdefghijklmnopqrstuvwxyz
958 0: abcdefghijklmnopqrst
959 1: abcdefghijklmnopqrst
960    abcdefghijklmnopqrstuvwxyz\=copy=1
961 0: abcdefghijklmnopqrst
962 1: abcdefghijklmnopqrst
963 1C abcdefghijklmnopqrst (20)
964    abcdefghijklmnopqrstuvwxyz\=get=1
965 0: abcdefghijklmnopqrst
966 1: abcdefghijklmnopqrst
967 1G abcdefghijklmnopqrst (20)
968
969/(.{15})/I
970Capture group count = 1
971Subject length lower bound = 15
972    abcdefghijklmnopqrstuvwxyz
973 0: abcdefghijklmno
974 1: abcdefghijklmno
975    abcdefghijklmnopqrstuvwxyz\=copy=1,get=1
976 0: abcdefghijklmno
977 1: abcdefghijklmno
978 1C abcdefghijklmno (15)
979 1G abcdefghijklmno (15)
980
981/(.{16})/I
982Capture group count = 1
983Subject length lower bound = 16
984    abcdefghijklmnopqrstuvwxyz
985 0: abcdefghijklmnop
986 1: abcdefghijklmnop
987    abcdefghijklmnopqrstuvwxyz\=copy=1,get=1,getall
988 0: abcdefghijklmnop
989 1: abcdefghijklmnop
990 1C abcdefghijklmnop (16)
991 1G abcdefghijklmnop (16)
992 0L abcdefghijklmnop
993 1L abcdefghijklmnop
994
995/^(a|(bc))de(f)/I
996Capture group count = 3
997Compile options: <none>
998Overall options: anchored
999Starting code units: a b
1000Subject length lower bound = 4
1001    adef\=get=1,get=2,get=3,get=4,getall
1002 0: adef
1003 1: a
1004 2: <unset>
1005 3: f
1006 1G a (1)
1007Get substring 2 failed (-55): requested value is not set
1008 3G f (1)
1009Get substring 4 failed (-49): unknown substring
1010 0L adef
1011 1L a
1012 2L
1013 3L f
1014    bcdef\=get=1,get=2,get=3,get=4,getall
1015 0: bcdef
1016 1: bc
1017 2: bc
1018 3: f
1019 1G bc (2)
1020 2G bc (2)
1021 3G f (1)
1022Get substring 4 failed (-49): unknown substring
1023 0L bcdef
1024 1L bc
1025 2L bc
1026 3L f
1027    adefghijk\=copy=0
1028 0: adef
1029 1: a
1030 2: <unset>
1031 3: f
1032 0C adef (4)
1033
1034/^abc\00def/I
1035Capture group count = 0
1036Compile options: <none>
1037Overall options: anchored
1038First code unit = 'a'
1039Subject length lower bound = 7
1040    abc\00def\=copy=0,getall
1041 0: abc\x00def
1042 0C abc\x00def (7)
1043 0L abc\x00def
1044
1045/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
1046)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
1047)?)?)?)?)?)?)?)?)?otherword/I
1048Capture group count = 8
1049Contains explicit CR or LF match
1050First code unit = 'w'
1051Last code unit = 'd'
1052Subject length lower bound = 14
1053
1054/.*X/IB
1055------------------------------------------------------------------
1056        Bra
1057        Any*
1058        X
1059        Ket
1060        End
1061------------------------------------------------------------------
1062Capture group count = 0
1063First code unit at start or follows newline
1064Last code unit = 'X'
1065Subject length lower bound = 1
1066
1067/.*X/IBs
1068------------------------------------------------------------------
1069        Bra
1070        AllAny*
1071        X
1072        Ket
1073        End
1074------------------------------------------------------------------
1075Capture group count = 0
1076Compile options: dotall
1077Overall options: anchored dotall
1078Last code unit = 'X'
1079Subject length lower bound = 1
1080
1081/(.*X|^B)/IB
1082------------------------------------------------------------------
1083        Bra
1084        CBra 1
1085        Any*
1086        X
1087        Alt
1088        ^
1089        B
1090        Ket
1091        Ket
1092        End
1093------------------------------------------------------------------
1094Capture group count = 1
1095First code unit at start or follows newline
1096Subject length lower bound = 1
1097
1098/(.*X|^B)/IBs
1099------------------------------------------------------------------
1100        Bra
1101        CBra 1
1102        AllAny*
1103        X
1104        Alt
1105        ^
1106        B
1107        Ket
1108        Ket
1109        End
1110------------------------------------------------------------------
1111Capture group count = 1
1112Compile options: dotall
1113Overall options: anchored dotall
1114Subject length lower bound = 1
1115
1116/(?s)(.*X|^B)/IB
1117------------------------------------------------------------------
1118        Bra
1119        CBra 1
1120        AllAny*
1121        X
1122        Alt
1123        ^
1124        B
1125        Ket
1126        Ket
1127        End
1128------------------------------------------------------------------
1129Capture group count = 1
1130Compile options: <none>
1131Overall options: anchored
1132Subject length lower bound = 1
1133
1134/(?s:.*X|^B)/IB
1135------------------------------------------------------------------
1136        Bra
1137        Bra
1138        AllAny*
1139        X
1140        Alt
1141        ^
1142        B
1143        Ket
1144        Ket
1145        End
1146------------------------------------------------------------------
1147Capture group count = 0
1148Compile options: <none>
1149Overall options: anchored
1150Subject length lower bound = 1
1151
1152/\Biss\B/I,aftertext
1153Capture group count = 0
1154Max lookbehind = 1
1155First code unit = 'i'
1156Last code unit = 's'
1157Subject length lower bound = 3
1158    Mississippi
1159 0: iss
1160 0+ issippi
1161
1162/iss/I,aftertext,altglobal
1163Capture group count = 0
1164First code unit = 'i'
1165Last code unit = 's'
1166Subject length lower bound = 3
1167    Mississippi
1168 0: iss
1169 0+ issippi
1170 0: iss
1171 0+ ippi
1172
1173/\Biss\B/I,aftertext,altglobal
1174Capture group count = 0
1175Max lookbehind = 1
1176First code unit = 'i'
1177Last code unit = 's'
1178Subject length lower bound = 3
1179    Mississippi
1180 0: iss
1181 0+ issippi
1182
1183/\Biss\B/Ig,aftertext
1184Capture group count = 0
1185Max lookbehind = 1
1186First code unit = 'i'
1187Last code unit = 's'
1188Subject length lower bound = 3
1189    Mississippi
1190 0: iss
1191 0+ issippi
1192 0: iss
1193 0+ ippi
1194\= Expect no match
1195    Mississippi\=anchored
1196No match
1197
1198/(?<=[Ms])iss/Ig,aftertext
1199Capture group count = 0
1200Max lookbehind = 1
1201First code unit = 'i'
1202Last code unit = 's'
1203Subject length lower bound = 3
1204    Mississippi
1205 0: iss
1206 0+ issippi
1207 0: iss
1208 0+ ippi
1209
1210/(?<=[Ms])iss/I,aftertext,altglobal
1211Capture group count = 0
1212Max lookbehind = 1
1213First code unit = 'i'
1214Last code unit = 's'
1215Subject length lower bound = 3
1216    Mississippi
1217 0: iss
1218 0+ issippi
1219
1220/^iss/Ig,aftertext
1221Capture group count = 0
1222Compile options: <none>
1223Overall options: anchored
1224First code unit = 'i'
1225Subject length lower bound = 3
1226    ississippi
1227 0: iss
1228 0+ issippi
1229
1230/.*iss/Ig,aftertext
1231Capture group count = 0
1232First code unit at start or follows newline
1233Last code unit = 's'
1234Subject length lower bound = 3
1235    abciss\nxyzisspqr
1236 0: abciss
1237 0+ \x0axyzisspqr
1238 0: xyziss
1239 0+ pqr
1240
1241/.i./Ig,aftertext
1242Capture group count = 0
1243Last code unit = 'i'
1244Subject length lower bound = 3
1245    Mississippi
1246 0: Mis
1247 0+ sissippi
1248 0: sis
1249 0+ sippi
1250 0: sip
1251 0+ pi
1252    Mississippi\=anchored
1253 0: Mis
1254 0+ sissippi
1255 0: sis
1256 0+ sippi
1257 0: sip
1258 0+ pi
1259    Missouri river
1260 0: Mis
1261 0+ souri river
1262 0: ri
1263 0+ river
1264 0: riv
1265 0+ er
1266    Missouri river\=anchored
1267 0: Mis
1268 0+ souri river
1269
1270/^.is/Ig,aftertext
1271Capture group count = 0
1272Compile options: <none>
1273Overall options: anchored
1274Subject length lower bound = 3
1275    Mississippi
1276 0: Mis
1277 0+ sissippi
1278
1279/^ab\n/Ig,aftertext
1280Capture group count = 0
1281Contains explicit CR or LF match
1282Compile options: <none>
1283Overall options: anchored
1284First code unit = 'a'
1285Subject length lower bound = 3
1286    ab\nab\ncd
1287 0: ab\x0a
1288 0+ ab\x0acd
1289
1290/^ab\n/Igm,aftertext
1291Capture group count = 0
1292Contains explicit CR or LF match
1293Options: multiline
1294First code unit at start or follows newline
1295Last code unit = \x0a
1296Subject length lower bound = 3
1297    ab\nab\ncd
1298 0: ab\x0a
1299 0+ ab\x0acd
1300 0: ab\x0a
1301 0+ cd
1302
1303/^/gm,newline=any
1304    a\rb\nc\r\nxyz\=aftertext
1305 0:
1306 0+ a\x0db\x0ac\x0d\x0axyz
1307 0:
1308 0+ b\x0ac\x0d\x0axyz
1309 0:
1310 0+ c\x0d\x0axyz
1311 0:
1312 0+ xyz
1313
1314/abc/I
1315Capture group count = 0
1316First code unit = 'a'
1317Last code unit = 'c'
1318Subject length lower bound = 3
1319
1320/abc|bac/I
1321Capture group count = 0
1322Starting code units: a b
1323Last code unit = 'c'
1324Subject length lower bound = 3
1325
1326/(abc|bac)/I
1327Capture group count = 1
1328Starting code units: a b
1329Last code unit = 'c'
1330Subject length lower bound = 3
1331
1332/(abc|(c|dc))/I
1333Capture group count = 2
1334Starting code units: a c d
1335Last code unit = 'c'
1336Subject length lower bound = 1
1337
1338/(abc|(d|de)c)/I
1339Capture group count = 2
1340Starting code units: a d
1341Last code unit = 'c'
1342Subject length lower bound = 2
1343
1344/a*/I
1345Capture group count = 0
1346May match empty string
1347Subject length lower bound = 0
1348
1349/a+/I
1350Capture group count = 0
1351First code unit = 'a'
1352Subject length lower bound = 1
1353
1354/(baa|a+)/I
1355Capture group count = 1
1356Starting code units: a b
1357Last code unit = 'a'
1358Subject length lower bound = 1
1359
1360/a{0,3}/I
1361Capture group count = 0
1362May match empty string
1363Subject length lower bound = 0
1364
1365/baa{3,}/I
1366Capture group count = 0
1367First code unit = 'b'
1368Last code unit = 'a'
1369Subject length lower bound = 5
1370
1371/"([^\\"]+|\\.)*"/I
1372Capture group count = 1
1373First code unit = '"'
1374Last code unit = '"'
1375Subject length lower bound = 2
1376
1377/(abc|ab[cd])/I
1378Capture group count = 1
1379First code unit = 'a'
1380Subject length lower bound = 3
1381
1382/(a|.)/I
1383Capture group count = 1
1384Subject length lower bound = 1
1385
1386/a|ba|\w/I
1387Capture group count = 0
1388Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
1389  Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
1390Subject length lower bound = 1
1391
1392/abc(?=pqr)/I
1393Capture group count = 0
1394First code unit = 'a'
1395Last code unit = 'r'
1396Subject length lower bound = 3
1397
1398/...(?<=abc)/I
1399Capture group count = 0
1400Max lookbehind = 3
1401Subject length lower bound = 3
1402
1403/abc(?!pqr)/I
1404Capture group count = 0
1405First code unit = 'a'
1406Last code unit = 'c'
1407Subject length lower bound = 3
1408
1409/ab./I
1410Capture group count = 0
1411First code unit = 'a'
1412Last code unit = 'b'
1413Subject length lower bound = 3
1414
1415/ab[xyz]/I
1416Capture group count = 0
1417First code unit = 'a'
1418Last code unit = 'b'
1419Subject length lower bound = 3
1420
1421/abc*/I
1422Capture group count = 0
1423First code unit = 'a'
1424Last code unit = 'b'
1425Subject length lower bound = 2
1426
1427/ab.c*/I
1428Capture group count = 0
1429First code unit = 'a'
1430Last code unit = 'b'
1431Subject length lower bound = 3
1432
1433/a.c*/I
1434Capture group count = 0
1435First code unit = 'a'
1436Subject length lower bound = 2
1437
1438/.c*/I
1439Capture group count = 0
1440Subject length lower bound = 1
1441
1442/ac*/I
1443Capture group count = 0
1444First code unit = 'a'
1445Subject length lower bound = 1
1446
1447/(a.c*|b.c*)/I
1448Capture group count = 1
1449Starting code units: a b
1450Subject length lower bound = 2
1451
1452/a.c*|aba/I
1453Capture group count = 0
1454First code unit = 'a'
1455Subject length lower bound = 2
1456
1457/.+a/I
1458Capture group count = 0
1459Last code unit = 'a'
1460Subject length lower bound = 2
1461
1462/(?=abcda)a.*/I
1463Capture group count = 0
1464First code unit = 'a'
1465Last code unit = 'a'
1466Subject length lower bound = 2
1467
1468/(?=a)a.*/I
1469Capture group count = 0
1470First code unit = 'a'
1471Subject length lower bound = 1
1472
1473/a(b)*/I
1474Capture group count = 1
1475First code unit = 'a'
1476Subject length lower bound = 1
1477
1478/a\d*/I
1479Capture group count = 0
1480First code unit = 'a'
1481Subject length lower bound = 1
1482
1483/ab\d*/I
1484Capture group count = 0
1485First code unit = 'a'
1486Last code unit = 'b'
1487Subject length lower bound = 2
1488
1489/a(\d)*/I
1490Capture group count = 1
1491First code unit = 'a'
1492Subject length lower bound = 1
1493
1494/abcde{0,0}/I
1495Capture group count = 0
1496First code unit = 'a'
1497Last code unit = 'd'
1498Subject length lower bound = 4
1499
1500/ab\d+/I
1501Capture group count = 0
1502First code unit = 'a'
1503Last code unit = 'b'
1504Subject length lower bound = 3
1505
1506/a(?(1)b)(.)/I
1507Capture group count = 1
1508Max back reference = 1
1509First code unit = 'a'
1510Subject length lower bound = 2
1511
1512/a(?(1)bag|big)(.)/I
1513Capture group count = 1
1514Max back reference = 1
1515First code unit = 'a'
1516Last code unit = 'g'
1517Subject length lower bound = 5
1518
1519/a(?(1)bag|big)*(.)/I
1520Capture group count = 1
1521Max back reference = 1
1522First code unit = 'a'
1523Subject length lower bound = 2
1524
1525/a(?(1)bag|big)+(.)/I
1526Capture group count = 1
1527Max back reference = 1
1528First code unit = 'a'
1529Last code unit = 'g'
1530Subject length lower bound = 5
1531
1532/a(?(1)b..|b..)(.)/I
1533Capture group count = 1
1534Max back reference = 1
1535First code unit = 'a'
1536Last code unit = 'b'
1537Subject length lower bound = 5
1538
1539/ab\d{0}e/I
1540Capture group count = 0
1541First code unit = 'a'
1542Last code unit = 'e'
1543Subject length lower bound = 3
1544
1545/a?b?/I
1546Capture group count = 0
1547May match empty string
1548Subject length lower bound = 0
1549    a
1550 0: a
1551    b
1552 0: b
1553    ab
1554 0: ab
1555    \
1556 0:
1557\= Expect no match
1558    \=notempty
1559No match
1560
1561/|-/I
1562Capture group count = 0
1563May match empty string
1564Subject length lower bound = 0
1565    abcd
1566 0:
1567    -abc
1568 0:
1569    ab-c\=notempty
1570 0: -
1571\= Expect no match
1572    abc\=notempty
1573No match
1574
1575/^.?abcd/I
1576Capture group count = 0
1577Compile options: <none>
1578Overall options: anchored
1579Last code unit = 'd'
1580Subject length lower bound = 4
1581
1582/\(             # ( at start
1583  (?:           # Non-capturing bracket
1584  (?>[^()]+)    # Either a sequence of non-brackets (no backtracking)
1585  |             # Or
1586  (?R)          # Recurse - i.e. nested bracketed string
1587  )*            # Zero or more contents
1588  \)            # Closing )
1589  /Ix
1590Capture group count = 0
1591Options: extended
1592First code unit = '('
1593Last code unit = ')'
1594Subject length lower bound = 2
1595    (abcd)
1596 0: (abcd)
1597    (abcd)xyz
1598 0: (abcd)
1599    xyz(abcd)
1600 0: (abcd)
1601    (ab(xy)cd)pqr
1602 0: (ab(xy)cd)
1603    (ab(xycd)pqr
1604 0: (xycd)
1605    () abc ()
1606 0: ()
1607    12(abcde(fsh)xyz(foo(bar))lmno)89
1608 0: (abcde(fsh)xyz(foo(bar))lmno)
1609\= Expect no match
1610    abcd
1611No match
1612    abcd)
1613No match
1614    (abcd
1615No match
1616
1617/\(  ( (?>[^()]+) | (?R) )* \) /Igx
1618Capture group count = 1
1619Options: extended
1620First code unit = '('
1621Last code unit = ')'
1622Subject length lower bound = 2
1623    (ab(xy)cd)pqr
1624 0: (ab(xy)cd)
1625 1: cd
1626    1(abcd)(x(y)z)pqr
1627 0: (abcd)
1628 1: abcd
1629 0: (x(y)z)
1630 1: z
1631
1632/\(  (?: (?>[^()]+) | (?R) ) \) /Ix
1633Capture group count = 0
1634Options: extended
1635First code unit = '('
1636Last code unit = ')'
1637Subject length lower bound = 3
1638    (abcd)
1639 0: (abcd)
1640    (ab(xy)cd)
1641 0: (xy)
1642    (a(b(c)d)e)
1643 0: (c)
1644    ((ab))
1645 0: ((ab))
1646\= Expect no match
1647    ()
1648No match
1649
1650/\(  (?: (?>[^()]+) | (?R) )? \) /Ix
1651Capture group count = 0
1652Options: extended
1653First code unit = '('
1654Last code unit = ')'
1655Subject length lower bound = 2
1656    ()
1657 0: ()
1658    12(abcde(fsh)xyz(foo(bar))lmno)89
1659 0: (fsh)
1660
1661/\(  ( (?>[^()]+) | (?R) )* \) /Ix
1662Capture group count = 1
1663Options: extended
1664First code unit = '('
1665Last code unit = ')'
1666Subject length lower bound = 2
1667    (ab(xy)cd)
1668 0: (ab(xy)cd)
1669 1: cd
1670
1671/\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix
1672Capture group count = 2
1673Options: extended
1674First code unit = '('
1675Last code unit = ')'
1676Subject length lower bound = 2
1677    (ab(xy)cd)
1678 0: (ab(xy)cd)
1679 1: ab(xy)cd
1680 2: cd
1681
1682/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix
1683Capture group count = 3
1684Options: extended
1685First code unit = '('
1686Last code unit = ')'
1687Subject length lower bound = 2
1688    (ab(xy)cd)
1689 0: (ab(xy)cd)
1690 1: <unset>
1691 2: ab(xy)cd
1692 3: cd
1693    (123ab(xy)cd)
1694 0: (123ab(xy)cd)
1695 1: 123
1696 2: ab(xy)cd
1697 3: cd
1698
1699/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix
1700Capture group count = 3
1701Options: extended
1702First code unit = '('
1703Last code unit = ')'
1704Subject length lower bound = 2
1705    (ab(xy)cd)
1706 0: (ab(xy)cd)
1707 1: ab(xy)cd
1708 2: <unset>
1709 3: cd
1710    (123ab(xy)cd)
1711 0: (123ab(xy)cd)
1712 1: 123ab(xy)cd
1713 2: 123
1714 3: cd
1715
1716/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix
1717Capture group count = 11
1718Options: extended
1719First code unit = '('
1720Last code unit = ')'
1721Subject length lower bound = 2
1722    (ab(xy)cd)
1723 0: (ab(xy)cd)
1724 1: ab(xy)cd
1725 2: ab(xy)cd
1726 3: ab(xy)cd
1727 4: ab(xy)cd
1728 5: ab(xy)cd
1729 6: ab(xy)cd
1730 7: ab(xy)cd
1731 8: ab(xy)cd
1732 9: ab(xy)cd
173310: ab(xy)cd
173411: cd
1735
1736/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix
1737Capture group count = 3
1738Options: extended
1739First code unit = '('
1740Last code unit = ')'
1741Subject length lower bound = 2
1742    (abcd(xyz<p>qrs)123)
1743 0: (abcd(xyz<p>qrs)123)
1744 1: abcd(xyz<p>qrs)123
1745 2: 123
1746
1747/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix
1748Capture group count = 3
1749Options: extended
1750First code unit = '('
1751Last code unit = ')'
1752Subject length lower bound = 2
1753    (ab(cd)ef)
1754 0: (ab(cd)ef)
1755 1: ab(cd)ef
1756 2: ef
1757 3: (cd)
1758    (ab(cd(ef)gh)ij)
1759 0: (ab(cd(ef)gh)ij)
1760 1: ab(cd(ef)gh)ij
1761 2: ij
1762 3: (cd(ef)gh)
1763
1764/^[[:alnum:]]/IB
1765------------------------------------------------------------------
1766        Bra
1767        ^
1768        [0-9A-Za-z]
1769        Ket
1770        End
1771------------------------------------------------------------------
1772Capture group count = 0
1773Compile options: <none>
1774Overall options: anchored
1775Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
1776  Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z
1777Subject length lower bound = 1
1778
1779/^[[:^alnum:]]/IB
1780------------------------------------------------------------------
1781        Bra
1782        ^
1783        [\x00-/:-@[-`{-\xff] (neg)
1784        Ket
1785        End
1786------------------------------------------------------------------
1787Capture group count = 0
1788Compile options: <none>
1789Overall options: anchored
1790Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
1791  \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19
1792  \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( ) * + , - . / : ; < = >
1793  ? @ [ \ ] ^ _ ` { | } ~ \x7f \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88
1794  \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 \x94 \x95 \x96 \x97
1795  \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6
1796  \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0 \xb1 \xb2 \xb3 \xb4 \xb5
1797  \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf \xc0 \xc1 \xc2 \xc3 \xc4
1798  \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3
1799  \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf \xe0 \xe1 \xe2
1800  \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee \xef \xf0 \xf1
1801  \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe \xff
1802Subject length lower bound = 1
1803
1804/^[[:alpha:]]/IB
1805------------------------------------------------------------------
1806        Bra
1807        ^
1808        [A-Za-z]
1809        Ket
1810        End
1811------------------------------------------------------------------
1812Capture group count = 0
1813Compile options: <none>
1814Overall options: anchored
1815Starting code units: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1816  a b c d e f g h i j k l m n o p q r s t u v w x y z
1817Subject length lower bound = 1
1818
1819/^[[:^alpha:]]/IB
1820------------------------------------------------------------------
1821        Bra
1822        ^
1823        [\x00-@[-`{-\xff] (neg)
1824        Ket
1825        End
1826------------------------------------------------------------------
1827Capture group count = 0
1828Compile options: <none>
1829Overall options: anchored
1830Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
1831  \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19
1832  \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4
1833  5 6 7 8 9 : ; < = > ? @ [ \ ] ^ _ ` { | } ~ \x7f \x80 \x81 \x82 \x83 \x84
1834  \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93
1835  \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa0 \xa1 \xa2
1836  \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0 \xb1
1837  \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf \xc0
1838  \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf
1839  \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde
1840  \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed
1841  \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc
1842  \xfd \xfe \xff
1843Subject length lower bound = 1
1844
1845/[_[:alpha:]]/I
1846Capture group count = 0
1847Starting code units: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1848  _ a b c d e f g h i j k l m n o p q r s t u v w x y z
1849Subject length lower bound = 1
1850
1851/^[[:ascii:]]/IB
1852------------------------------------------------------------------
1853        Bra
1854        ^
1855        [\x00-\x7f]
1856        Ket
1857        End
1858------------------------------------------------------------------
1859Capture group count = 0
1860Compile options: <none>
1861Overall options: anchored
1862Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
1863  \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19
1864  \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4
1865  5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y
1866  Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
1867  \x7f
1868Subject length lower bound = 1
1869
1870/^[[:^ascii:]]/IB
1871------------------------------------------------------------------
1872        Bra
1873        ^
1874        [\x80-\xff] (neg)
1875        Ket
1876        End
1877------------------------------------------------------------------
1878Capture group count = 0
1879Compile options: <none>
1880Overall options: anchored
1881Starting code units: \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a
1882  \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 \x94 \x95 \x96 \x97 \x98 \x99
1883  \x9a \x9b \x9c \x9d \x9e \x9f \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8
1884  \xa9 \xaa \xab \xac \xad \xae \xaf \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7
1885  \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6
1886  \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5
1887  \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4
1888  \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee \xef \xf0 \xf1 \xf2 \xf3
1889  \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe \xff
1890Subject length lower bound = 1
1891
1892/^[[:blank:]]/IB
1893------------------------------------------------------------------
1894        Bra
1895        ^
1896        [\x09 ]
1897        Ket
1898        End
1899------------------------------------------------------------------
1900Capture group count = 0
1901Compile options: <none>
1902Overall options: anchored
1903Starting code units: \x09 \x20
1904Subject length lower bound = 1
1905
1906/^[[:^blank:]]/IB
1907------------------------------------------------------------------
1908        Bra
1909        ^
1910        [\x00-\x08\x0a-\x1f!-\xff] (neg)
1911        Ket
1912        End
1913------------------------------------------------------------------
1914Capture group count = 0
1915Compile options: <none>
1916Overall options: anchored
1917Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0a \x0b
1918  \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a
1919  \x1b \x1c \x1d \x1e \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9
1920  : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^
1921  _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80
1922  \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f
1923  \x90 \x91 \x92 \x93 \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e
1924  \x9f \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad
1925  \xae \xaf \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc
1926  \xbd \xbe \xbf \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb
1927  \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda
1928  \xdb \xdc \xdd \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9
1929  \xea \xeb \xec \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8
1930  \xf9 \xfa \xfb \xfc \xfd \xfe \xff
1931Subject length lower bound = 1
1932
1933/[\n\x0b\x0c\x0d[:blank:]]/I
1934Capture group count = 0
1935Contains explicit CR or LF match
1936Starting code units: \x09 \x0a \x0b \x0c \x0d \x20
1937Subject length lower bound = 1
1938
1939/^[[:cntrl:]]/IB
1940------------------------------------------------------------------
1941        Bra
1942        ^
1943        [\x00-\x1f\x7f]
1944        Ket
1945        End
1946------------------------------------------------------------------
1947Capture group count = 0
1948Compile options: <none>
1949Overall options: anchored
1950Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
1951  \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19
1952  \x1a \x1b \x1c \x1d \x1e \x1f \x7f
1953Subject length lower bound = 1
1954
1955/^[[:digit:]]/IB
1956------------------------------------------------------------------
1957        Bra
1958        ^
1959        [0-9]
1960        Ket
1961        End
1962------------------------------------------------------------------
1963Capture group count = 0
1964Compile options: <none>
1965Overall options: anchored
1966Starting code units: 0 1 2 3 4 5 6 7 8 9
1967Subject length lower bound = 1
1968
1969/^[[:graph:]]/IB
1970------------------------------------------------------------------
1971        Bra
1972        ^
1973        [!-~]
1974        Ket
1975        End
1976------------------------------------------------------------------
1977Capture group count = 0
1978Compile options: <none>
1979Overall options: anchored
1980Starting code units: ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 :
1981  ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _
1982  ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
1983Subject length lower bound = 1
1984
1985/^[[:lower:]]/IB
1986------------------------------------------------------------------
1987        Bra
1988        ^
1989        [a-z]
1990        Ket
1991        End
1992------------------------------------------------------------------
1993Capture group count = 0
1994Compile options: <none>
1995Overall options: anchored
1996Starting code units: a b c d e f g h i j k l m n o p q r s t u v w x y z
1997Subject length lower bound = 1
1998
1999/^[[:print:]]/IB
2000------------------------------------------------------------------
2001        Bra
2002        ^
2003        [ -~]
2004        Ket
2005        End
2006------------------------------------------------------------------
2007Capture group count = 0
2008Compile options: <none>
2009Overall options: anchored
2010Starting code units: \x20 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8
2011  9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ]
2012  ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
2013Subject length lower bound = 1
2014
2015/^[[:punct:]]/IB
2016------------------------------------------------------------------
2017        Bra
2018        ^
2019        [!-/:-@[-`{-~]
2020        Ket
2021        End
2022------------------------------------------------------------------
2023Capture group count = 0
2024Compile options: <none>
2025Overall options: anchored
2026Starting code units: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^
2027  _ ` { | } ~
2028Subject length lower bound = 1
2029
2030/^[[:space:]]/IB
2031------------------------------------------------------------------
2032        Bra
2033        ^
2034        [\x09-\x0d ]
2035        Ket
2036        End
2037------------------------------------------------------------------
2038Capture group count = 0
2039Compile options: <none>
2040Overall options: anchored
2041Starting code units: \x09 \x0a \x0b \x0c \x0d \x20
2042Subject length lower bound = 1
2043
2044/^[[:upper:]]/IB
2045------------------------------------------------------------------
2046        Bra
2047        ^
2048        [A-Z]
2049        Ket
2050        End
2051------------------------------------------------------------------
2052Capture group count = 0
2053Compile options: <none>
2054Overall options: anchored
2055Starting code units: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
2056Subject length lower bound = 1
2057
2058/^[[:xdigit:]]/IB
2059------------------------------------------------------------------
2060        Bra
2061        ^
2062        [0-9A-Fa-f]
2063        Ket
2064        End
2065------------------------------------------------------------------
2066Capture group count = 0
2067Compile options: <none>
2068Overall options: anchored
2069Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
2070Subject length lower bound = 1
2071
2072/^[[:word:]]/IB
2073------------------------------------------------------------------
2074        Bra
2075        ^
2076        [0-9A-Z_a-z]
2077        Ket
2078        End
2079------------------------------------------------------------------
2080Capture group count = 0
2081Compile options: <none>
2082Overall options: anchored
2083Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
2084  Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
2085Subject length lower bound = 1
2086
2087/^[[:^cntrl:]]/IB
2088------------------------------------------------------------------
2089        Bra
2090        ^
2091        [ -~\x80-\xff] (neg)
2092        Ket
2093        End
2094------------------------------------------------------------------
2095Capture group count = 0
2096Compile options: <none>
2097Overall options: anchored
2098Starting code units: \x20 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8
2099  9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ]
2100  ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ \x80 \x81
2101  \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90
2102  \x91 \x92 \x93 \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f
2103  \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae
2104  \xaf \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd
2105  \xbe \xbf \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc
2106  \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb
2107  \xdc \xdd \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea
2108  \xeb \xec \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9
2109  \xfa \xfb \xfc \xfd \xfe \xff
2110Subject length lower bound = 1
2111
2112/^[12[:^digit:]]/IB
2113------------------------------------------------------------------
2114        Bra
2115        ^
2116        [\x00-/12:-\xff] (neg)
2117        Ket
2118        End
2119------------------------------------------------------------------
2120Capture group count = 0
2121Compile options: <none>
2122Overall options: anchored
2123Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
2124  \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19
2125  \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( ) * + , - . / 1 2 : ; <
2126  = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a
2127  b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80 \x81 \x82
2128  \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91
2129  \x92 \x93 \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa0
2130  \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf
2131  \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe
2132  \xbf \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd
2133  \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc
2134  \xdd \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb
2135  \xec \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa
2136  \xfb \xfc \xfd \xfe \xff
2137Subject length lower bound = 1
2138
2139/^[[:^blank:]]/IB
2140------------------------------------------------------------------
2141        Bra
2142        ^
2143        [\x00-\x08\x0a-\x1f!-\xff] (neg)
2144        Ket
2145        End
2146------------------------------------------------------------------
2147Capture group count = 0
2148Compile options: <none>
2149Overall options: anchored
2150Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0a \x0b
2151  \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a
2152  \x1b \x1c \x1d \x1e \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9
2153  : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^
2154  _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80
2155  \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f
2156  \x90 \x91 \x92 \x93 \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e
2157  \x9f \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad
2158  \xae \xaf \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc
2159  \xbd \xbe \xbf \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb
2160  \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda
2161  \xdb \xdc \xdd \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9
2162  \xea \xeb \xec \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8
2163  \xf9 \xfa \xfb \xfc \xfd \xfe \xff
2164Subject length lower bound = 1
2165
2166/[01[:alpha:]%]/IB
2167------------------------------------------------------------------
2168        Bra
2169        [%01A-Za-z]
2170        Ket
2171        End
2172------------------------------------------------------------------
2173Capture group count = 0
2174Starting code units: % 0 1 A B C D E F G H I J K L M N O P Q R S T U V W
2175  X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z
2176Subject length lower bound = 1
2177
2178/[[.ch.]]/I
2179Failed: error 113 at offset 1: POSIX collating elements are not supported
2180
2181/[[=ch=]]/I
2182Failed: error 113 at offset 1: POSIX collating elements are not supported
2183
2184/[[:rhubarb:]]/I
2185Failed: error 130 at offset 3: unknown POSIX class name
2186
2187/[[:upper:]]/Ii
2188Capture group count = 0
2189Options: caseless
2190Starting code units: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
2191  a b c d e f g h i j k l m n o p q r s t u v w x y z
2192Subject length lower bound = 1
2193    A
2194 0: A
2195    a
2196 0: a
2197
2198/[[:lower:]]/Ii
2199Capture group count = 0
2200Options: caseless
2201Starting code units: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
2202  a b c d e f g h i j k l m n o p q r s t u v w x y z
2203Subject length lower bound = 1
2204    A
2205 0: A
2206    a
2207 0: a
2208
2209/((?-i)[[:lower:]])[[:lower:]]/Ii
2210Capture group count = 1
2211Options: caseless
2212Starting code units: a b c d e f g h i j k l m n o p q r s t u v w x y z
2213Subject length lower bound = 2
2214    ab
2215 0: ab
2216 1: a
2217    aB
2218 0: aB
2219 1: a
2220\= Expect no match
2221    Ab
2222No match
2223    AB
2224No match
2225
2226/[\200-\110]/I
2227Failed: error 108 at offset 9: range out of order in character class
2228
2229/^(?(0)f|b)oo/I
2230Failed: error 115 at offset 5: reference to non-existent subpattern
2231
2232# This one's here because of the large output vector needed
2233
2234/(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\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
2235Capture group count = 271
2236Max back reference = 270
2237Starting code units: 0 1 2 3 4 5 6 7 8 9
2238Subject length lower bound = 1
2239     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
2240 0: 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
2241 1: 1
2242 2: 2
2243 3: 3
2244 4: 4
2245 5: 5
2246 6: 6
2247 7: 7
2248 8: 8
2249 9: 9
225010: 10
225111: 11
225212: 12
225313: 13
225414: 14
225515: 15
225616: 16
225717: 17
225818: 18
225919: 19
226020: 20
226121: 21
226222: 22
226323: 23
226424: 24
226525: 25
226626: 26
226727: 27
226828: 28
226929: 29
227030: 30
227131: 31
227232: 32
227333: 33
227434: 34
227535: 35
227636: 36
227737: 37
227838: 38
227939: 39
228040: 40
228141: 41
228242: 42
228343: 43
228444: 44
228545: 45
228646: 46
228747: 47
228848: 48
228949: 49
229050: 50
229151: 51
229252: 52
229353: 53
229454: 54
229555: 55
229656: 56
229757: 57
229858: 58
229959: 59
230060: 60
230161: 61
230262: 62
230363: 63
230464: 64
230565: 65
230666: 66
230767: 67
230868: 68
230969: 69
231070: 70
231171: 71
231272: 72
231373: 73
231474: 74
231575: 75
231676: 76
231777: 77
231878: 78
231979: 79
232080: 80
232181: 81
232282: 82
232383: 83
232484: 84
232585: 85
232686: 86
232787: 87
232888: 88
232989: 89
233090: 90
233191: 91
233292: 92
233393: 93
233494: 94
233595: 95
233696: 96
233797: 97
233898: 98
233999: 99
2340100: 100
2341101: 101
2342102: 102
2343103: 103
2344104: 104
2345105: 105
2346106: 106
2347107: 107
2348108: 108
2349109: 109
2350110: 110
2351111: 111
2352112: 112
2353113: 113
2354114: 114
2355115: 115
2356116: 116
2357117: 117
2358118: 118
2359119: 119
2360120: 120
2361121: 121
2362122: 122
2363123: 123
2364124: 124
2365125: 125
2366126: 126
2367127: 127
2368128: 128
2369129: 129
2370130: 130
2371131: 131
2372132: 132
2373133: 133
2374134: 134
2375135: 135
2376136: 136
2377137: 137
2378138: 138
2379139: 139
2380140: 140
2381141: 141
2382142: 142
2383143: 143
2384144: 144
2385145: 145
2386146: 146
2387147: 147
2388148: 148
2389149: 149
2390150: 150
2391151: 151
2392152: 152
2393153: 153
2394154: 154
2395155: 155
2396156: 156
2397157: 157
2398158: 158
2399159: 159
2400160: 160
2401161: 161
2402162: 162
2403163: 163
2404164: 164
2405165: 165
2406166: 166
2407167: 167
2408168: 168
2409169: 169
2410170: 170
2411171: 171
2412172: 172
2413173: 173
2414174: 174
2415175: 175
2416176: 176
2417177: 177
2418178: 178
2419179: 179
2420180: 180
2421181: 181
2422182: 182
2423183: 183
2424184: 184
2425185: 185
2426186: 186
2427187: 187
2428188: 188
2429189: 189
2430190: 190
2431191: 191
2432192: 192
2433193: 193
2434194: 194
2435195: 195
2436196: 196
2437197: 197
2438198: 198
2439199: 199
2440200: 200
2441201: 201
2442202: 202
2443203: 203
2444204: 204
2445205: 205
2446206: 206
2447207: 207
2448208: 208
2449209: 209
2450210: 210
2451211: 211
2452212: 212
2453213: 213
2454214: 214
2455215: 215
2456216: 216
2457217: 217
2458218: 218
2459219: 219
2460220: 220
2461221: 221
2462222: 222
2463223: 223
2464224: 224
2465225: 225
2466226: 226
2467227: 227
2468228: 228
2469229: 229
2470230: 230
2471231: 231
2472232: 232
2473233: 233
2474234: 234
2475235: 235
2476236: 236
2477237: 237
2478238: 238
2479239: 239
2480240: 240
2481241: 241
2482242: 242
2483243: 243
2484244: 244
2485245: 245
2486246: 246
2487247: 247
2488248: 248
2489249: 249
2490250: 250
2491251: 251
2492252: 252
2493253: 253
2494254: 254
2495255: 255
2496256: 256
2497257: 257
2498258: 258
2499259: 259
2500260: 260
2501261: 261
2502262: 262
2503263: 263
2504264: 264
2505265: 265
2506266: 266
2507267: 267
2508268: 268
2509269: 269
2510270: ABC
2511271: ABC
2512
2513# This one's here because Perl does this differently and PCRE2 can't at present
2514
2515/(main(O)?)+/I
2516Capture group count = 2
2517First code unit = 'm'
2518Last code unit = 'n'
2519Subject length lower bound = 4
2520    mainmain
2521 0: mainmain
2522 1: main
2523    mainOmain
2524 0: mainOmain
2525 1: main
2526 2: O
2527
2528# These are all cases where Perl does it differently (nested captures)
2529
2530/^(a(b)?)+$/I
2531Capture group count = 2
2532Compile options: <none>
2533Overall options: anchored
2534First code unit = 'a'
2535Subject length lower bound = 1
2536    aba
2537 0: aba
2538 1: a
2539 2: b
2540
2541/^(aa(bb)?)+$/I
2542Capture group count = 2
2543Compile options: <none>
2544Overall options: anchored
2545First code unit = 'a'
2546Subject length lower bound = 2
2547    aabbaa
2548 0: aabbaa
2549 1: aa
2550 2: bb
2551
2552/^(aa|aa(bb))+$/I
2553Capture group count = 2
2554Compile options: <none>
2555Overall options: anchored
2556First code unit = 'a'
2557Subject length lower bound = 2
2558    aabbaa
2559 0: aabbaa
2560 1: aa
2561 2: bb
2562
2563/^(aa(bb)??)+$/I
2564Capture group count = 2
2565Compile options: <none>
2566Overall options: anchored
2567First code unit = 'a'
2568Subject length lower bound = 2
2569    aabbaa
2570 0: aabbaa
2571 1: aa
2572 2: bb
2573
2574/^(?:aa(bb)?)+$/I
2575Capture group count = 1
2576Compile options: <none>
2577Overall options: anchored
2578First code unit = 'a'
2579Subject length lower bound = 2
2580    aabbaa
2581 0: aabbaa
2582 1: bb
2583
2584/^(aa(b(b))?)+$/I
2585Capture group count = 3
2586Compile options: <none>
2587Overall options: anchored
2588First code unit = 'a'
2589Subject length lower bound = 2
2590    aabbaa
2591 0: aabbaa
2592 1: aa
2593 2: bb
2594 3: b
2595
2596/^(?:aa(b(b))?)+$/I
2597Capture group count = 2
2598Compile options: <none>
2599Overall options: anchored
2600First code unit = 'a'
2601Subject length lower bound = 2
2602    aabbaa
2603 0: aabbaa
2604 1: bb
2605 2: b
2606
2607/^(?:aa(b(?:b))?)+$/I
2608Capture group count = 1
2609Compile options: <none>
2610Overall options: anchored
2611First code unit = 'a'
2612Subject length lower bound = 2
2613    aabbaa
2614 0: aabbaa
2615 1: bb
2616
2617/^(?:aa(bb(?:b))?)+$/I
2618Capture group count = 1
2619Compile options: <none>
2620Overall options: anchored
2621First code unit = 'a'
2622Subject length lower bound = 2
2623    aabbbaa
2624 0: aabbbaa
2625 1: bbb
2626
2627/^(?:aa(b(?:bb))?)+$/I
2628Capture group count = 1
2629Compile options: <none>
2630Overall options: anchored
2631First code unit = 'a'
2632Subject length lower bound = 2
2633    aabbbaa
2634 0: aabbbaa
2635 1: bbb
2636
2637/^(?:aa(?:b(b))?)+$/I
2638Capture group count = 1
2639Compile options: <none>
2640Overall options: anchored
2641First code unit = 'a'
2642Subject length lower bound = 2
2643    aabbaa
2644 0: aabbaa
2645 1: b
2646
2647/^(?:aa(?:b(bb))?)+$/I
2648Capture group count = 1
2649Compile options: <none>
2650Overall options: anchored
2651First code unit = 'a'
2652Subject length lower bound = 2
2653    aabbbaa
2654 0: aabbbaa
2655 1: bb
2656
2657/^(aa(b(bb))?)+$/I
2658Capture group count = 3
2659Compile options: <none>
2660Overall options: anchored
2661First code unit = 'a'
2662Subject length lower bound = 2
2663    aabbbaa
2664 0: aabbbaa
2665 1: aa
2666 2: bbb
2667 3: bb
2668
2669/^(aa(bb(bb))?)+$/I
2670Capture group count = 3
2671Compile options: <none>
2672Overall options: anchored
2673First code unit = 'a'
2674Subject length lower bound = 2
2675    aabbbbaa
2676 0: aabbbbaa
2677 1: aa
2678 2: bbbb
2679 3: bb
2680
2681# ----------------
2682
2683/#/IBx
2684------------------------------------------------------------------
2685        Bra
2686        Ket
2687        End
2688------------------------------------------------------------------
2689Capture group count = 0
2690May match empty string
2691Options: extended
2692Subject length lower bound = 0
2693
2694/a#/IBx
2695------------------------------------------------------------------
2696        Bra
2697        a
2698        Ket
2699        End
2700------------------------------------------------------------------
2701Capture group count = 0
2702Options: extended
2703First code unit = 'a'
2704Subject length lower bound = 1
2705
2706/[\s]/IB
2707------------------------------------------------------------------
2708        Bra
2709        [\x09-\x0d ]
2710        Ket
2711        End
2712------------------------------------------------------------------
2713Capture group count = 0
2714Starting code units: \x09 \x0a \x0b \x0c \x0d \x20
2715Subject length lower bound = 1
2716
2717/[\S]/IB
2718------------------------------------------------------------------
2719        Bra
2720        [\x00-\x08\x0e-\x1f!-\xff] (neg)
2721        Ket
2722        End
2723------------------------------------------------------------------
2724Capture group count = 0
2725Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f
2726  \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e
2727  \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C
2728  D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h
2729  i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80 \x81 \x82 \x83 \x84
2730  \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93
2731  \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa0 \xa1 \xa2
2732  \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0 \xb1
2733  \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf \xc0
2734  \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf
2735  \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde
2736  \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed
2737  \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc
2738  \xfd \xfe \xff
2739Subject length lower bound = 1
2740
2741/a(?i)b/IB
2742------------------------------------------------------------------
2743        Bra
2744        a
2745     /i b
2746        Ket
2747        End
2748------------------------------------------------------------------
2749Capture group count = 0
2750First code unit = 'a'
2751Last code unit = 'b' (caseless)
2752Subject length lower bound = 2
2753    ab
2754 0: ab
2755    aB
2756 0: aB
2757\= Expect no match
2758    AB
2759No match
2760
2761/(a(?i)b)/IB
2762------------------------------------------------------------------
2763        Bra
2764        CBra 1
2765        a
2766     /i b
2767        Ket
2768        Ket
2769        End
2770------------------------------------------------------------------
2771Capture group count = 1
2772First code unit = 'a'
2773Last code unit = 'b' (caseless)
2774Subject length lower bound = 2
2775    ab
2776 0: ab
2777 1: ab
2778    aB
2779 0: aB
2780 1: aB
2781\= Expect no match
2782    AB
2783No match
2784
2785/   (?i)abc/IBx
2786------------------------------------------------------------------
2787        Bra
2788     /i abc
2789        Ket
2790        End
2791------------------------------------------------------------------
2792Capture group count = 0
2793Options: extended
2794First code unit = 'a' (caseless)
2795Last code unit = 'c' (caseless)
2796Subject length lower bound = 3
2797
2798/#this is a comment
2799  (?i)abc/IBx
2800------------------------------------------------------------------
2801        Bra
2802     /i abc
2803        Ket
2804        End
2805------------------------------------------------------------------
2806Capture group count = 0
2807Options: extended
2808First code unit = 'a' (caseless)
2809Last code unit = 'c' (caseless)
2810Subject length lower bound = 3
2811
2812/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB
2813------------------------------------------------------------------
2814        Bra
2815        123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
2816        Ket
2817        End
2818------------------------------------------------------------------
2819Capture group count = 0
2820First code unit = '1'
2821Last code unit = '0'
2822Subject length lower bound = 300
2823
2824/\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB
2825------------------------------------------------------------------
2826        Bra
2827        123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
2828        Ket
2829        End
2830------------------------------------------------------------------
2831Capture group count = 0
2832First code unit = '1'
2833Last code unit = '0'
2834Subject length lower bound = 300
2835
2836/\Q\E/IB
2837------------------------------------------------------------------
2838        Bra
2839        Ket
2840        End
2841------------------------------------------------------------------
2842Capture group count = 0
2843May match empty string
2844Subject length lower bound = 0
2845    \
2846 0:
2847
2848/\Q\Ex/IB
2849------------------------------------------------------------------
2850        Bra
2851        x
2852        Ket
2853        End
2854------------------------------------------------------------------
2855Capture group count = 0
2856First code unit = 'x'
2857Subject length lower bound = 1
2858
2859/ \Q\E/IB
2860------------------------------------------------------------------
2861        Bra
2862
2863        Ket
2864        End
2865------------------------------------------------------------------
2866Capture group count = 0
2867First code unit = ' '
2868Subject length lower bound = 1
2869
2870/a\Q\E/IB
2871------------------------------------------------------------------
2872        Bra
2873        a
2874        Ket
2875        End
2876------------------------------------------------------------------
2877Capture group count = 0
2878First code unit = 'a'
2879Subject length lower bound = 1
2880  abc
2881 0: a
2882  bca
2883 0: a
2884  bac
2885 0: a
2886
2887/a\Q\Eb/IB
2888------------------------------------------------------------------
2889        Bra
2890        ab
2891        Ket
2892        End
2893------------------------------------------------------------------
2894Capture group count = 0
2895First code unit = 'a'
2896Last code unit = 'b'
2897Subject length lower bound = 2
2898  abc
2899 0: ab
2900
2901/\Q\Eabc/IB
2902------------------------------------------------------------------
2903        Bra
2904        abc
2905        Ket
2906        End
2907------------------------------------------------------------------
2908Capture group count = 0
2909First code unit = 'a'
2910Last code unit = 'c'
2911Subject length lower bound = 3
2912
2913/x*+\w/IB
2914------------------------------------------------------------------
2915        Bra
2916        x*+
2917        \w
2918        Ket
2919        End
2920------------------------------------------------------------------
2921Capture group count = 0
2922Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
2923  Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
2924Subject length lower bound = 1
2925\= Expect no match
2926    xxxxx
2927No match
2928
2929/x?+/IB
2930------------------------------------------------------------------
2931        Bra
2932        x?+
2933        Ket
2934        End
2935------------------------------------------------------------------
2936Capture group count = 0
2937May match empty string
2938Subject length lower bound = 0
2939
2940/x++/IB
2941------------------------------------------------------------------
2942        Bra
2943        x++
2944        Ket
2945        End
2946------------------------------------------------------------------
2947Capture group count = 0
2948First code unit = 'x'
2949Subject length lower bound = 1
2950
2951/x{1,3}+/B,no_auto_possess
2952------------------------------------------------------------------
2953        Bra
2954        x
2955        x{0,2}+
2956        Ket
2957        End
2958------------------------------------------------------------------
2959
2960/x{1,3}+/Bi,no_auto_possess
2961------------------------------------------------------------------
2962        Bra
2963     /i x
2964     /i x{0,2}+
2965        Ket
2966        End
2967------------------------------------------------------------------
2968
2969/[^x]{1,3}+/B,no_auto_possess
2970------------------------------------------------------------------
2971        Bra
2972        [^x]
2973        [^x]{0,2}+
2974        Ket
2975        End
2976------------------------------------------------------------------
2977
2978/[^x]{1,3}+/Bi,no_auto_possess
2979------------------------------------------------------------------
2980        Bra
2981     /i [^x]
2982     /i [^x]{0,2}+
2983        Ket
2984        End
2985------------------------------------------------------------------
2986
2987/(x)*+/IB
2988------------------------------------------------------------------
2989        Bra
2990        Braposzero
2991        CBraPos 1
2992        x
2993        KetRpos
2994        Ket
2995        End
2996------------------------------------------------------------------
2997Capture group count = 1
2998May match empty string
2999Subject length lower bound = 0
3000
3001/^(\w++|\s++)*$/I
3002Capture group count = 1
3003May match empty string
3004Compile options: <none>
3005Overall options: anchored
3006Subject length lower bound = 0
3007    now is the time for all good men to come to the aid of the party
3008 0: now is the time for all good men to come to the aid of the party
3009 1: party
3010\= Expect no match
3011    this is not a line with only words and spaces!
3012No match
3013
3014/(\d++)(\w)/I
3015Capture group count = 2
3016Starting code units: 0 1 2 3 4 5 6 7 8 9
3017Subject length lower bound = 2
3018    12345a
3019 0: 12345a
3020 1: 12345
3021 2: a
3022\= Expect no match
3023    12345+
3024No match
3025
3026/a++b/I
3027Capture group count = 0
3028First code unit = 'a'
3029Last code unit = 'b'
3030Subject length lower bound = 2
3031    aaab
3032 0: aaab
3033
3034/(a++b)/I
3035Capture group count = 1
3036First code unit = 'a'
3037Last code unit = 'b'
3038Subject length lower bound = 2
3039    aaab
3040 0: aaab
3041 1: aaab
3042
3043/(a++)b/I
3044Capture group count = 1
3045First code unit = 'a'
3046Last code unit = 'b'
3047Subject length lower bound = 2
3048    aaab
3049 0: aaab
3050 1: aaa
3051
3052/([^()]++|\([^()]*\))+/I
3053Capture group count = 1
3054Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
3055  \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19
3056  \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( * + , - . / 0 1 2 3 4 5
3057  6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
3058  [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f
3059  \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e
3060  \x8f \x90 \x91 \x92 \x93 \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d
3061  \x9e \x9f \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac
3062  \xad \xae \xaf \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb
3063  \xbc \xbd \xbe \xbf \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca
3064  \xcb \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9
3065  \xda \xdb \xdc \xdd \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8
3066  \xe9 \xea \xeb \xec \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7
3067  \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe \xff
3068Subject length lower bound = 1
3069    ((abc(ade)ufh()()x
3070 0: abc(ade)ufh()()x
3071 1: x
3072
3073/\(([^()]++|\([^()]+\))+\)/I
3074Capture group count = 1
3075First code unit = '('
3076Last code unit = ')'
3077Subject length lower bound = 3
3078    (abc)
3079 0: (abc)
3080 1: abc
3081    (abc(def)xyz)
3082 0: (abc(def)xyz)
3083 1: xyz
3084\= Expect no match
3085    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3086No match
3087
3088/(abc){1,3}+/IB
3089------------------------------------------------------------------
3090        Bra
3091        Once
3092        CBra 1
3093        abc
3094        Ket
3095        Brazero
3096        Bra
3097        CBra 1
3098        abc
3099        Ket
3100        Brazero
3101        CBra 1
3102        abc
3103        Ket
3104        Ket
3105        Ket
3106        Ket
3107        End
3108------------------------------------------------------------------
3109Capture group count = 1
3110First code unit = 'a'
3111Last code unit = 'c'
3112Subject length lower bound = 3
3113
3114/a+?+/I
3115Failed: error 109 at offset 3: quantifier does not follow a repeatable item
3116
3117/a{2,3}?+b/I
3118Failed: error 109 at offset 7: quantifier does not follow a repeatable item
3119
3120/(?U)a+?+/I
3121Failed: error 109 at offset 7: quantifier does not follow a repeatable item
3122
3123/a{2,3}?+b/I,ungreedy
3124Failed: error 109 at offset 7: quantifier does not follow a repeatable item
3125
3126/x(?U)a++b/IB
3127------------------------------------------------------------------
3128        Bra
3129        x
3130        a++
3131        b
3132        Ket
3133        End
3134------------------------------------------------------------------
3135Capture group count = 0
3136First code unit = 'x'
3137Last code unit = 'b'
3138Subject length lower bound = 3
3139    xaaaab
3140 0: xaaaab
3141
3142/(?U)xa++b/IB
3143------------------------------------------------------------------
3144        Bra
3145        x
3146        a++
3147        b
3148        Ket
3149        End
3150------------------------------------------------------------------
3151Capture group count = 0
3152First code unit = 'x'
3153Last code unit = 'b'
3154Subject length lower bound = 3
3155    xaaaab
3156 0: xaaaab
3157
3158/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/IB
3159------------------------------------------------------------------
3160        Bra
3161        ^
3162        CBra 1
3163        CBra 2
3164        a+
3165        Ket
3166        CBra 3
3167        [ab]+?
3168        Ket
3169        CBra 4
3170        [bc]+
3171        Ket
3172        CBra 5
3173        \w*+
3174        Ket
3175        Ket
3176        Ket
3177        End
3178------------------------------------------------------------------
3179Capture group count = 5
3180Compile options: <none>
3181Overall options: anchored
3182First code unit = 'a'
3183Subject length lower bound = 3
3184
3185/^x(?U)a+b/IB
3186------------------------------------------------------------------
3187        Bra
3188        ^
3189        x
3190        a++
3191        b
3192        Ket
3193        End
3194------------------------------------------------------------------
3195Capture group count = 0
3196Compile options: <none>
3197Overall options: anchored
3198First code unit = 'x'
3199Last code unit = 'b'
3200Subject length lower bound = 3
3201
3202/^x(?U)(a+)b/IB
3203------------------------------------------------------------------
3204        Bra
3205        ^
3206        x
3207        CBra 1
3208        a+?
3209        Ket
3210        b
3211        Ket
3212        End
3213------------------------------------------------------------------
3214Capture group count = 1
3215Compile options: <none>
3216Overall options: anchored
3217First code unit = 'x'
3218Last code unit = 'b'
3219Subject length lower bound = 3
3220
3221/[.x.]/I
3222Failed: error 113 at offset 0: POSIX collating elements are not supported
3223
3224/[=x=]/I
3225Failed: error 113 at offset 0: POSIX collating elements are not supported
3226
3227/[:x:]/I
3228Failed: error 112 at offset 0: POSIX named classes are supported only within a class
3229
3230/\F/I
3231Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
3232
3233/\l/I
3234Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
3235
3236/\L/I
3237Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
3238
3239/\N{name}/I
3240Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
3241
3242/\u/I
3243Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
3244
3245/\U/I
3246Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
3247
3248/a{1,3}b/ungreedy
3249    ab
3250 0: ab
3251
3252/[/I
3253Failed: error 106 at offset 1: missing terminating ] for character class
3254
3255/[a-/I
3256Failed: error 106 at offset 3: missing terminating ] for character class
3257
3258/[[:space:]/I
3259Failed: error 106 at offset 10: missing terminating ] for character class
3260
3261/[\s]/IB
3262------------------------------------------------------------------
3263        Bra
3264        [\x09-\x0d ]
3265        Ket
3266        End
3267------------------------------------------------------------------
3268Capture group count = 0
3269Starting code units: \x09 \x0a \x0b \x0c \x0d \x20
3270Subject length lower bound = 1
3271
3272/[[:space:]]/IB
3273------------------------------------------------------------------
3274        Bra
3275        [\x09-\x0d ]
3276        Ket
3277        End
3278------------------------------------------------------------------
3279Capture group count = 0
3280Starting code units: \x09 \x0a \x0b \x0c \x0d \x20
3281Subject length lower bound = 1
3282
3283/[[:space:]abcde]/IB
3284------------------------------------------------------------------
3285        Bra
3286        [\x09-\x0d a-e]
3287        Ket
3288        End
3289------------------------------------------------------------------
3290Capture group count = 0
3291Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 a b c d e
3292Subject length lower bound = 1
3293
3294/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/Ix
3295Capture group count = 0
3296Options: extended
3297First code unit = '<'
3298Last code unit = '>'
3299Subject length lower bound = 2
3300    <>
3301 0: <>
3302    <abcd>
3303 0: <abcd>
3304    <abc <123> hij>
3305 0: <abc <123> hij>
3306    <abc <def> hij>
3307 0: <def>
3308    <abc<>def>
3309 0: <abc<>def>
3310    <abc<>
3311 0: <>
3312\= Expect no match
3313    <abc
3314No match
3315
3316/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
3317------------------------------------------------------------------
3318        Bra
3319        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
3320        \b
3321        Ket
3322        End
3323------------------------------------------------------------------
3324Capture group count = 0
3325Max lookbehind = 1
3326First code unit = '8'
3327Last code unit = 'X'
3328Subject length lower bound = 409
3329
3330/\$\<\.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
3331------------------------------------------------------------------
3332        Bra
3333        $<.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
3334        \b
3335        Ket
3336        End
3337------------------------------------------------------------------
3338Capture group count = 0
3339Max lookbehind = 1
3340First code unit = '$'
3341Last code unit = 'X'
3342Subject length lower bound = 404
3343
3344/(.*)\d+\1/I
3345Capture group count = 1
3346Max back reference = 1
3347Subject length lower bound = 1
3348
3349/(.*)\d+/I
3350Capture group count = 1
3351First code unit at start or follows newline
3352Subject length lower bound = 1
3353
3354/(.*)\d+\1/Is
3355Capture group count = 1
3356Max back reference = 1
3357Options: dotall
3358Subject length lower bound = 1
3359
3360/(.*)\d+/Is
3361Capture group count = 1
3362Compile options: dotall
3363Overall options: anchored dotall
3364Subject length lower bound = 1
3365
3366/(.*(xyz))\d+\2/I
3367Capture group count = 2
3368Max back reference = 2
3369First code unit at start or follows newline
3370Last code unit = 'z'
3371Subject length lower bound = 7
3372
3373/((.*))\d+\1/I
3374Capture group count = 2
3375Max back reference = 1
3376Subject length lower bound = 1
3377    abc123bc
3378 0: bc123bc
3379 1: bc
3380 2: bc
3381
3382/a[b]/I
3383Capture group count = 0
3384First code unit = 'a'
3385Last code unit = 'b'
3386Subject length lower bound = 2
3387
3388/(?=a).*/I
3389Capture group count = 0
3390May match empty string
3391First code unit = 'a'
3392Subject length lower bound = 1
3393
3394/(?=abc).xyz/Ii
3395Capture group count = 0
3396Options: caseless
3397First code unit = 'a' (caseless)
3398Last code unit = 'z' (caseless)
3399Subject length lower bound = 4
3400
3401/(?=abc)(?i).xyz/I
3402Capture group count = 0
3403First code unit = 'a'
3404Last code unit = 'z' (caseless)
3405Subject length lower bound = 4
3406
3407/(?=a)(?=b)/I
3408Capture group count = 0
3409May match empty string
3410First code unit = 'a'
3411Subject length lower bound = 1
3412
3413/(?=.)a/I
3414Capture group count = 0
3415First code unit = 'a'
3416Subject length lower bound = 1
3417
3418/((?=abcda)a)/I
3419Capture group count = 1
3420First code unit = 'a'
3421Last code unit = 'a'
3422Subject length lower bound = 2
3423
3424/((?=abcda)ab)/I
3425Capture group count = 1
3426First code unit = 'a'
3427Last code unit = 'b'
3428Subject length lower bound = 2
3429
3430/()a/I
3431Capture group count = 1
3432First code unit = 'a'
3433Subject length lower bound = 1
3434
3435/(?:(?=.)|(?<!x))a/I
3436Capture group count = 0
3437Max lookbehind = 1
3438First code unit = 'a'
3439Subject length lower bound = 1
3440
3441/(?(1)ab|ac)(.)/I
3442Capture group count = 1
3443Max back reference = 1
3444First code unit = 'a'
3445Subject length lower bound = 3
3446
3447/(?(1)abz|acz)(.)/I
3448Capture group count = 1
3449Max back reference = 1
3450First code unit = 'a'
3451Last code unit = 'z'
3452Subject length lower bound = 4
3453
3454/(?(1)abz)(.)/I
3455Capture group count = 1
3456Max back reference = 1
3457Subject length lower bound = 1
3458
3459/(?(1)abz)(1)23/I
3460Capture group count = 1
3461Max back reference = 1
3462Last code unit = '3'
3463Subject length lower bound = 3
3464
3465/(a)+/I
3466Capture group count = 1
3467First code unit = 'a'
3468Subject length lower bound = 1
3469
3470/(a){2,3}/I
3471Capture group count = 1
3472First code unit = 'a'
3473Last code unit = 'a'
3474Subject length lower bound = 2
3475
3476/(a)*/I
3477Capture group count = 1
3478May match empty string
3479Subject length lower bound = 0
3480
3481/[a]/I
3482Capture group count = 0
3483First code unit = 'a'
3484Subject length lower bound = 1
3485
3486/[ab]/I
3487Capture group count = 0
3488Starting code units: a b
3489Subject length lower bound = 1
3490
3491/[ab]/I
3492Capture group count = 0
3493Starting code units: a b
3494Subject length lower bound = 1
3495
3496/[^a]/I
3497Capture group count = 0
3498Subject length lower bound = 1
3499
3500/\d456/I
3501Capture group count = 0
3502Starting code units: 0 1 2 3 4 5 6 7 8 9
3503Last code unit = '6'
3504Subject length lower bound = 4
3505
3506/\d456/I
3507Capture group count = 0
3508Starting code units: 0 1 2 3 4 5 6 7 8 9
3509Last code unit = '6'
3510Subject length lower bound = 4
3511
3512/a^b/I
3513Capture group count = 0
3514First code unit = 'a'
3515Last code unit = 'b'
3516Subject length lower bound = 2
3517
3518/^a/Im
3519Capture group count = 0
3520Options: multiline
3521First code unit at start or follows newline
3522Last code unit = 'a'
3523Subject length lower bound = 1
3524  abcde
3525 0: a
3526  xy\nabc
3527 0: a
3528\= Expect no match
3529  xyabc
3530No match
3531
3532/c|abc/I
3533Capture group count = 0
3534Starting code units: a c
3535Last code unit = 'c'
3536Subject length lower bound = 1
3537
3538/(?i)[ab]/I
3539Capture group count = 0
3540Starting code units: A B a b
3541Subject length lower bound = 1
3542
3543/[ab](?i)cd/I
3544Capture group count = 0
3545Starting code units: a b
3546Last code unit = 'd' (caseless)
3547Subject length lower bound = 3
3548
3549/abc(?C)def/I
3550Capture group count = 0
3551First code unit = 'a'
3552Last code unit = 'f'
3553Subject length lower bound = 6
3554    abcdef
3555--->abcdef
3556  0 ^  ^       d
3557 0: abcdef
3558    1234abcdef
3559--->1234abcdef
3560  0     ^  ^       d
3561 0: abcdef
3562\= Expect no match
3563    abcxyz
3564No match
3565    abcxyzf
3566--->abcxyzf
3567  0 ^  ^        d
3568No match
3569
3570/abc(?C)de(?C1)f/I
3571Capture group count = 0
3572First code unit = 'a'
3573Last code unit = 'f'
3574Subject length lower bound = 6
3575    123abcdef
3576--->123abcdef
3577  0    ^  ^       d
3578  1    ^    ^     f
3579 0: abcdef
3580
3581/(?C1)\dabc(?C2)def/I
3582Capture group count = 0
3583Starting code units: 0 1 2 3 4 5 6 7 8 9
3584Last code unit = 'f'
3585Subject length lower bound = 7
3586    1234abcdef
3587--->1234abcdef
3588  1 ^              \d
3589  1  ^             \d
3590  1   ^            \d
3591  1    ^           \d
3592  2    ^   ^       d
3593 0: 4abcdef
3594\= Expect no match
3595    abcdef
3596No match
3597
3598/(?C1)\dabc(?C2)def/I
3599Capture group count = 0
3600Starting code units: 0 1 2 3 4 5 6 7 8 9
3601Last code unit = 'f'
3602Subject length lower bound = 7
3603    1234abcdef
3604--->1234abcdef
3605  1 ^              \d
3606  1  ^             \d
3607  1   ^            \d
3608  1    ^           \d
3609  2    ^   ^       d
3610 0: 4abcdef
3611\= Expect no match
3612    abcdef
3613No match
3614
3615/(?C255)ab/I
3616Capture group count = 0
3617First code unit = 'a'
3618Last code unit = 'b'
3619Subject length lower bound = 2
3620
3621/(?C256)ab/I
3622Failed: error 138 at offset 6: number after (?C is greater than 255
3623
3624/(?Cab)xx/I
3625Failed: error 182 at offset 3: unrecognized string delimiter follows (?C
3626
3627/(?C12vr)x/I
3628Failed: error 139 at offset 5: closing parenthesis for (?C expected
3629
3630/abc(?C)def/I
3631Capture group count = 0
3632First code unit = 'a'
3633Last code unit = 'f'
3634Subject length lower bound = 6
3635    \x83\x0\x61bcdef
3636--->\x83\x00abcdef
3637  0         ^  ^       d
3638 0: abcdef
3639
3640/(abc)(?C)de(?C1)f/I
3641Capture group count = 1
3642First code unit = 'a'
3643Last code unit = 'f'
3644Subject length lower bound = 6
3645    123abcdef
3646--->123abcdef
3647  0    ^  ^       d
3648  1    ^    ^     f
3649 0: abcdef
3650 1: abc
3651    123abcdef\=callout_capture
3652Callout 0: last capture = 1
3653 1: abc
3654--->123abcdef
3655       ^  ^       d
3656Callout 1: last capture = 1
3657 1: abc
3658--->123abcdef
3659       ^    ^     f
3660 0: abcdef
3661 1: abc
3662    123abcdefC-\=callout_none
3663 0: abcdef
3664 1: abc
3665\= Expect no match
3666    123abcdef\=callout_fail=1
3667--->123abcdef
3668  0    ^  ^       d
3669  1    ^    ^     f
3670No match
3671
3672/(?C0)(abc(?C1))*/I
3673Capture group count = 1
3674May match empty string
3675Subject length lower bound = 0
3676    abcabcabc
3677--->abcabcabc
3678  0 ^             (
3679  1 ^  ^          )*
3680  1 ^     ^       )*
3681  1 ^        ^    )*
3682 0: abcabcabc
3683 1: abc
3684    abcabc\=callout_fail=1:4
3685--->abcabc
3686  0 ^          (
3687  1 ^  ^       )*
3688  1 ^     ^    )*
3689 0: abcabc
3690 1: abc
3691    abcabcabc\=callout_fail=1:4
3692--->abcabcabc
3693  0 ^             (
3694  1 ^  ^          )*
3695  1 ^     ^       )*
3696  1 ^        ^    )*
3697 0: abcabc
3698 1: abc
3699
3700/(\d{3}(?C))*/I
3701Capture group count = 1
3702May match empty string
3703Subject length lower bound = 0
3704    123\=callout_capture
3705Callout 0: last capture = 0
3706--->123
3707    ^  ^    )*
3708 0: 123
3709 1: 123
3710    123456\=callout_capture
3711Callout 0: last capture = 0
3712--->123456
3713    ^  ^       )*
3714Callout 0: last capture = 1
3715 1: 123
3716--->123456
3717    ^     ^    )*
3718 0: 123456
3719 1: 456
3720    123456789\=callout_capture
3721Callout 0: last capture = 0
3722--->123456789
3723    ^  ^          )*
3724Callout 0: last capture = 1
3725 1: 123
3726--->123456789
3727    ^     ^       )*
3728Callout 0: last capture = 1
3729 1: 456
3730--->123456789
3731    ^        ^    )*
3732 0: 123456789
3733 1: 789
3734
3735/((xyz)(?C)p|(?C1)xyzabc)/I
3736Capture group count = 2
3737First code unit = 'x'
3738Subject length lower bound = 4
3739    xyzabc\=callout_capture
3740Callout 0: last capture = 2
3741 1: <unset>
3742 2: xyz
3743--->xyzabc
3744    ^  ^       p
3745Callout 1: last capture = 0
3746--->xyzabc
3747    ^          x
3748 0: xyzabc
3749 1: xyzabc
3750
3751/(X)((xyz)(?C)p|(?C1)xyzabc)/I
3752Capture group count = 3
3753First code unit = 'X'
3754Last code unit = 'x'
3755Subject length lower bound = 5
3756    Xxyzabc\=callout_capture
3757Callout 0: last capture = 3
3758 1: X
3759 2: <unset>
3760 3: xyz
3761--->Xxyzabc
3762    ^   ^       p
3763Callout 1: last capture = 1
3764 1: X
3765--->Xxyzabc
3766    ^^          x
3767 0: Xxyzabc
3768 1: X
3769 2: xyzabc
3770
3771/(?=(abc))(?C)abcdef/I
3772Capture group count = 1
3773First code unit = 'a'
3774Last code unit = 'f'
3775Subject length lower bound = 6
3776    abcdef\=callout_capture
3777Callout 0: last capture = 1
3778 1: abc
3779--->abcdef
3780    ^          a
3781 0: abcdef
3782 1: abc
3783
3784/(?!(abc)(?C1)d)(?C2)abcxyz/I
3785Capture group count = 1
3786First code unit = 'a'
3787Last code unit = 'z'
3788Subject length lower bound = 6
3789    abcxyz\=callout_capture
3790Callout 1: last capture = 1
3791 1: abc
3792--->abcxyz
3793    ^  ^       d
3794Callout 2: last capture = 0
3795--->abcxyz
3796    ^          a
3797 0: abcxyz
3798
3799/(?<=(abc)(?C))xyz/I
3800Capture group count = 1
3801Max lookbehind = 3
3802First code unit = 'x'
3803Last code unit = 'z'
3804Subject length lower bound = 3
3805   abcxyz\=callout_capture
3806Callout 0: last capture = 1
3807 1: abc
3808--->abcxyz
3809       ^       )
3810 0: xyz
3811 1: abc
3812
3813/a(b+)(c*)(?C1)/I
3814Capture group count = 2
3815First code unit = 'a'
3816Last code unit = 'b'
3817Subject length lower bound = 2
3818\= Expect no match
3819    abbbbbccc\=callout_data=1
3820--->abbbbbccc
3821  1 ^        ^    End of pattern
3822Callout data = 1
3823No match
3824
3825/a(b+?)(c*?)(?C1)/I
3826Capture group count = 2
3827First code unit = 'a'
3828Last code unit = 'b'
3829Subject length lower bound = 2
3830\= Expect no match
3831    abbbbbccc\=callout_data=1
3832--->abbbbbccc
3833  1 ^ ^           End of pattern
3834Callout data = 1
3835  1 ^  ^          End of pattern
3836Callout data = 1
3837  1 ^   ^         End of pattern
3838Callout data = 1
3839  1 ^    ^        End of pattern
3840Callout data = 1
3841  1 ^     ^       End of pattern
3842Callout data = 1
3843  1 ^      ^      End of pattern
3844Callout data = 1
3845  1 ^       ^     End of pattern
3846Callout data = 1
3847  1 ^        ^    End of pattern
3848Callout data = 1
3849No match
3850
3851/(?C)abc/I
3852Capture group count = 0
3853First code unit = 'a'
3854Last code unit = 'c'
3855Subject length lower bound = 3
3856
3857/(?C)^abc/I
3858Capture group count = 0
3859Compile options: <none>
3860Overall options: anchored
3861First code unit = 'a'
3862Subject length lower bound = 3
3863
3864/(?C)a|b/I
3865Capture group count = 0
3866Starting code units: a b
3867Subject length lower bound = 1
3868
3869/a|(b)(?C)/I
3870Capture group count = 1
3871Starting code units: a b
3872Subject length lower bound = 1
3873    b
3874--->b
3875  0 ^^    End of pattern
3876 0: b
3877 1: b
3878
3879/x(ab|(bc|(de|(?R))))/I
3880Capture group count = 3
3881First code unit = 'x'
3882Subject length lower bound = 3
3883    xab
3884 0: xab
3885 1: ab
3886    xbc
3887 0: xbc
3888 1: bc
3889 2: bc
3890    xde
3891 0: xde
3892 1: de
3893 2: de
3894 3: de
3895    xxab
3896 0: xxab
3897 1: xab
3898 2: xab
3899 3: xab
3900    xxxab
3901 0: xxxab
3902 1: xxab
3903 2: xxab
3904 3: xxab
3905\= Expect no match
3906    xyab
3907No match
3908
3909/^([^()]|\((?1)*\))*$/I
3910Capture group count = 1
3911May match empty string
3912Compile options: <none>
3913Overall options: anchored
3914Subject length lower bound = 0
3915    abc
3916 0: abc
3917 1: c
3918    a(b)c
3919 0: a(b)c
3920 1: c
3921    a(b(c))d
3922 0: a(b(c))d
3923 1: d
3924\= Expect no match)
3925    a(b(c)d
3926No match
3927
3928/^>abc>([^()]|\((?1)*\))*<xyz<$/I
3929Capture group count = 1
3930Compile options: <none>
3931Overall options: anchored
3932First code unit = '>'
3933Last code unit = '<'
3934Subject length lower bound = 10
3935   >abc>123<xyz<
3936 0: >abc>123<xyz<
3937 1: 3
3938   >abc>1(2)3<xyz<
3939 0: >abc>1(2)3<xyz<
3940 1: 3
3941   >abc>(1(2)3)<xyz<
3942 0: >abc>(1(2)3)<xyz<
3943 1: (1(2)3)
3944
3945/(a(?1)b)/IB
3946------------------------------------------------------------------
3947        Bra
3948        CBra 1
3949        a
3950        Recurse
3951        b
3952        Ket
3953        Ket
3954        End
3955------------------------------------------------------------------
3956Capture group count = 1
3957First code unit = 'a'
3958Last code unit = 'b'
3959Subject length lower bound = 2
3960
3961/(a(?1)+b)/IB
3962------------------------------------------------------------------
3963        Bra
3964        CBra 1
3965        a
3966        SBra
3967        Recurse
3968        KetRmax
3969        b
3970        Ket
3971        Ket
3972        End
3973------------------------------------------------------------------
3974Capture group count = 1
3975First code unit = 'a'
3976Last code unit = 'b'
3977Subject length lower bound = 2
3978
3979/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/I
3980Capture group count = 2
3981Compile options: <none>
3982Overall options: anchored
3983Starting code units: ( - 0 1 2 3 4 5 6 7 8 9
3984Subject length lower bound = 1
3985    12
3986 0: 12
3987 1: 12
3988    (((2+2)*-3)-7)
3989 0: (((2+2)*-3)-7)
3990 1: (((2+2)*-3)-7)
3991 2: -
3992    -12
3993 0: -12
3994 1: -12
3995\= Expect no match
3996    ((2+2)*-3)-7)
3997No match
3998
3999/^(x(y|(?1){2})z)/I
4000Capture group count = 2
4001Compile options: <none>
4002Overall options: anchored
4003First code unit = 'x'
4004Subject length lower bound = 3
4005    xyz
4006 0: xyz
4007 1: xyz
4008 2: y
4009    xxyzxyzz
4010 0: xxyzxyzz
4011 1: xxyzxyzz
4012 2: xyzxyz
4013\= Expect no match
4014    xxyzz
4015No match
4016    xxyzxyzxyzz
4017No match
4018
4019/((< (?: (?(R) \d++  | [^<>]*+) | (?2)) * >))/Ix
4020Capture group count = 2
4021Options: extended
4022First code unit = '<'
4023Last code unit = '>'
4024Subject length lower bound = 2
4025    <>
4026 0: <>
4027 1: <>
4028 2: <>
4029    <abcd>
4030 0: <abcd>
4031 1: <abcd>
4032 2: <abcd>
4033    <abc <123> hij>
4034 0: <abc <123> hij>
4035 1: <abc <123> hij>
4036 2: <abc <123> hij>
4037    <abc <def> hij>
4038 0: <def>
4039 1: <def>
4040 2: <def>
4041    <abc<>def>
4042 0: <abc<>def>
4043 1: <abc<>def>
4044 2: <abc<>def>
4045    <abc<>
4046 0: <>
4047 1: <>
4048 2: <>
4049\= Expect no match
4050    <abc
4051No match
4052
4053/(?1)/I
4054Failed: error 115 at offset 3: reference to non-existent subpattern
4055
4056/((?2)(abc)/I
4057Failed: error 114 at offset 10: missing closing parenthesis
4058
4059/^(abc)def(?1)/I
4060Capture group count = 1
4061Compile options: <none>
4062Overall options: anchored
4063First code unit = 'a'
4064Subject length lower bound = 9
4065    abcdefabc
4066 0: abcdefabc
4067 1: abc
4068
4069/^(a|b|c)=(?1)+/I
4070Capture group count = 1
4071Compile options: <none>
4072Overall options: anchored
4073Starting code units: a b c
4074Subject length lower bound = 2
4075    a=a
4076 0: a=a
4077 1: a
4078    a=b
4079 0: a=b
4080 1: a
4081    a=bc
4082 0: a=bc
4083 1: a
4084
4085/^(a|b|c)=((?1))+/I
4086Capture group count = 2
4087Compile options: <none>
4088Overall options: anchored
4089Starting code units: a b c
4090Subject length lower bound = 2
4091    a=a
4092 0: a=a
4093 1: a
4094 2: a
4095    a=b
4096 0: a=b
4097 1: a
4098 2: b
4099    a=bc
4100 0: a=bc
4101 1: a
4102 2: c
4103
4104/a(?P<name1>b|c)d(?P<longername2>e)/IB
4105------------------------------------------------------------------
4106        Bra
4107        a
4108        CBra 1
4109        b
4110        Alt
4111        c
4112        Ket
4113        d
4114        CBra 2
4115        e
4116        Ket
4117        Ket
4118        End
4119------------------------------------------------------------------
4120Capture group count = 2
4121Named capture groups:
4122  longername2   2
4123  name1         1
4124First code unit = 'a'
4125Last code unit = 'e'
4126Subject length lower bound = 4
4127    abde
4128 0: abde
4129 1: b
4130 2: e
4131    acde
4132 0: acde
4133 1: c
4134 2: e
4135
4136/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/IB
4137------------------------------------------------------------------
4138        Bra
4139        Bra
4140        a
4141        CBra 1
4142        c
4143        CBra 2
4144        d
4145        Ket
4146        Ket
4147        Ket
4148        CBra 3
4149        a
4150        Ket
4151        Ket
4152        End
4153------------------------------------------------------------------
4154Capture group count = 3
4155Named capture groups:
4156  a   3
4157  c   1
4158  d   2
4159First code unit = 'a'
4160Last code unit = 'a'
4161Subject length lower bound = 4
4162
4163/(?P<a>a)...(?P=a)bbb(?P>a)d/IB
4164------------------------------------------------------------------
4165        Bra
4166        CBra 1
4167        a
4168        Ket
4169        Any
4170        Any
4171        Any
4172        \1
4173        bbb
4174        Recurse
4175        d
4176        Ket
4177        End
4178------------------------------------------------------------------
4179Capture group count = 1
4180Max back reference = 1
4181Named capture groups:
4182  a   1
4183First code unit = 'a'
4184Last code unit = 'd'
4185Subject length lower bound = 10
4186
4187/^\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
4188Capture group count = 4
4189Max back reference = 4
4190Named capture groups:
4191  four    4
4192  one     1
4193  three   3
4194  two     2
4195May match empty string
4196Compile options: caseless
4197Overall options: anchored caseless
4198Subject length lower bound = 0
4199    1221
4200 0: 1221
4201 1: 1221
4202 2: 1
4203    Satan, oscillate my metallic sonatas!
4204 0: Satan, oscillate my metallic sonatas!
4205 1: <unset>
4206 2: <unset>
4207 3: Satan, oscillate my metallic sonatas
4208 4: S
4209    A man, a plan, a canal: Panama!
4210 0: A man, a plan, a canal: Panama!
4211 1: <unset>
4212 2: <unset>
4213 3: A man, a plan, a canal: Panama
4214 4: A
4215    Able was I ere I saw Elba.
4216 0: Able was I ere I saw Elba.
4217 1: <unset>
4218 2: <unset>
4219 3: Able was I ere I saw Elba
4220 4: A
4221\= Expect no match
4222    The quick brown fox
4223No match
4224
4225/((?(R)a|b))\1(?1)?/I
4226Capture group count = 1
4227Max back reference = 1
4228Subject length lower bound = 2
4229  bb
4230 0: bb
4231 1: b
4232  bbaa
4233 0: bba
4234 1: b
4235
4236/(.*)a/Is
4237Capture group count = 1
4238Compile options: dotall
4239Overall options: anchored dotall
4240Last code unit = 'a'
4241Subject length lower bound = 1
4242
4243/(.*)a\1/Is
4244Capture group count = 1
4245Max back reference = 1
4246Options: dotall
4247Last code unit = 'a'
4248Subject length lower bound = 1
4249
4250/(.*)a(b)\2/Is
4251Capture group count = 2
4252Max back reference = 2
4253Compile options: dotall
4254Overall options: anchored dotall
4255Last code unit = 'b'
4256Subject length lower bound = 3
4257
4258/((.*)a|(.*)b)z/Is
4259Capture group count = 3
4260Compile options: dotall
4261Overall options: anchored dotall
4262Last code unit = 'z'
4263Subject length lower bound = 2
4264
4265/((.*)a|(.*)b)z\1/Is
4266Capture group count = 3
4267Max back reference = 1
4268Options: dotall
4269Last code unit = 'z'
4270Subject length lower bound = 3
4271
4272/((.*)a|(.*)b)z\2/Is
4273Capture group count = 3
4274Max back reference = 2
4275Options: dotall
4276Last code unit = 'z'
4277Subject length lower bound = 2
4278
4279/((.*)a|(.*)b)z\3/Is
4280Capture group count = 3
4281Max back reference = 3
4282Options: dotall
4283Last code unit = 'z'
4284Subject length lower bound = 2
4285
4286/((.*)a|^(.*)b)z\3/Is
4287Capture group count = 3
4288Max back reference = 3
4289Compile options: dotall
4290Overall options: anchored dotall
4291Last code unit = 'z'
4292Subject length lower bound = 2
4293
4294/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is
4295Capture group count = 31
4296May match empty string
4297Compile options: dotall
4298Overall options: anchored dotall
4299Subject length lower bound = 0
4300
4301/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is
4302Capture group count = 31
4303Max back reference = 31
4304May match empty string
4305Options: dotall
4306Subject length lower bound = 0
4307
4308/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is
4309Capture group count = 32
4310Max back reference = 32
4311May match empty string
4312Options: dotall
4313Subject length lower bound = 0
4314
4315/(a)(bc)/IB,no_auto_capture
4316------------------------------------------------------------------
4317        Bra
4318        Bra
4319        a
4320        Ket
4321        Bra
4322        bc
4323        Ket
4324        Ket
4325        End
4326------------------------------------------------------------------
4327Capture group count = 0
4328Options: no_auto_capture
4329First code unit = 'a'
4330Last code unit = 'c'
4331Subject length lower bound = 3
4332  abc
4333 0: abc
4334
4335/(?P<one>a)(bc)/IB,no_auto_capture
4336------------------------------------------------------------------
4337        Bra
4338        CBra 1
4339        a
4340        Ket
4341        Bra
4342        bc
4343        Ket
4344        Ket
4345        End
4346------------------------------------------------------------------
4347Capture group count = 1
4348Named capture groups:
4349  one   1
4350Options: no_auto_capture
4351First code unit = 'a'
4352Last code unit = 'c'
4353Subject length lower bound = 3
4354  abc
4355 0: abc
4356 1: a
4357
4358/(a)(?P<named>bc)/IB,no_auto_capture
4359------------------------------------------------------------------
4360        Bra
4361        Bra
4362        a
4363        Ket
4364        CBra 1
4365        bc
4366        Ket
4367        Ket
4368        End
4369------------------------------------------------------------------
4370Capture group count = 1
4371Named capture groups:
4372  named   1
4373Options: no_auto_capture
4374First code unit = 'a'
4375Last code unit = 'c'
4376Subject length lower bound = 3
4377
4378/(aaa(?C1)bbb|ab)/I
4379Capture group count = 1
4380First code unit = 'a'
4381Last code unit = 'b'
4382Subject length lower bound = 2
4383   aaabbb
4384--->aaabbb
4385  1 ^  ^       b
4386 0: aaabbb
4387 1: aaabbb
4388   aaabbb\=callout_data=0
4389--->aaabbb
4390  1 ^  ^       b
4391 0: aaabbb
4392 1: aaabbb
4393   aaabbb\=callout_data=1
4394--->aaabbb
4395  1 ^  ^       b
4396Callout data = 1
4397 0: ab
4398 1: ab
4399\= Expect no match
4400   aaabbb\=callout_data=-1
4401--->aaabbb
4402  1 ^  ^       b
4403Callout data = -1
4404No match
4405
4406/ab(?P<one>cd)ef(?P<two>gh)/I
4407Capture group count = 2
4408Named capture groups:
4409  one   1
4410  two   2
4411First code unit = 'a'
4412Last code unit = 'h'
4413Subject length lower bound = 8
4414    abcdefgh
4415 0: abcdefgh
4416 1: cd
4417 2: gh
4418    abcdefgh\=copy=1,get=two
4419 0: abcdefgh
4420 1: cd
4421 2: gh
4422 1C cd (2)
4423  G gh (2) two (group 2)
4424    abcdefgh\=copy=one,copy=two
4425 0: abcdefgh
4426 1: cd
4427 2: gh
4428  C cd (2) one (group 1)
4429  C gh (2) two (group 2)
4430    abcdefgh\=copy=three
4431 0: abcdefgh
4432 1: cd
4433 2: gh
4434Number not found for group 'three'
4435Copy substring 'three' failed (-49): unknown substring
4436
4437/(?P<Tes>)(?P<Test>)/IB
4438------------------------------------------------------------------
4439        Bra
4440        CBra 1
4441        Ket
4442        CBra 2
4443        Ket
4444        Ket
4445        End
4446------------------------------------------------------------------
4447Capture group count = 2
4448Named capture groups:
4449  Tes    1
4450  Test   2
4451May match empty string
4452Subject length lower bound = 0
4453
4454/(?P<Test>)(?P<Tes>)/IB
4455------------------------------------------------------------------
4456        Bra
4457        CBra 1
4458        Ket
4459        CBra 2
4460        Ket
4461        Ket
4462        End
4463------------------------------------------------------------------
4464Capture group count = 2
4465Named capture groups:
4466  Tes    2
4467  Test   1
4468May match empty string
4469Subject length lower bound = 0
4470
4471/(?P<Z>zz)(?P<A>aa)/I
4472Capture group count = 2
4473Named capture groups:
4474  A   2
4475  Z   1
4476First code unit = 'z'
4477Last code unit = 'a'
4478Subject length lower bound = 4
4479    zzaa\=copy=Z
4480 0: zzaa
4481 1: zz
4482 2: aa
4483  C zz (2) Z (group 1)
4484    zzaa\=copy=A
4485 0: zzaa
4486 1: zz
4487 2: aa
4488  C aa (2) A (group 2)
4489
4490/(?P<x>eks)(?P<x>eccs)/I
4491Failed: error 143 at offset 16: two named subpatterns have the same name (PCRE2_DUPNAMES not set)
4492
4493/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/I
4494Failed: error 143 at offset 31: two named subpatterns have the same name (PCRE2_DUPNAMES not set)
4495
4496"\[((?P<elem>\d+)(,(?P>elem))*)\]"I
4497Capture group count = 3
4498Named capture groups:
4499  elem   2
4500First code unit = '['
4501Last code unit = ']'
4502Subject length lower bound = 3
4503    [10,20,30,5,5,4,4,2,43,23,4234]
4504 0: [10,20,30,5,5,4,4,2,43,23,4234]
4505 1: 10,20,30,5,5,4,4,2,43,23,4234
4506 2: 10
4507 3: ,4234
4508\= Expect no match
4509    []
4510No match
4511
4512"\[((?P<elem>\d+)(,(?P>elem))*)?\]"I
4513Capture group count = 3
4514Named capture groups:
4515  elem   2
4516First code unit = '['
4517Last code unit = ']'
4518Subject length lower bound = 2
4519    [10,20,30,5,5,4,4,2,43,23,4234]
4520 0: [10,20,30,5,5,4,4,2,43,23,4234]
4521 1: 10,20,30,5,5,4,4,2,43,23,4234
4522 2: 10
4523 3: ,4234
4524    []
4525 0: []
4526
4527/(a(b(?2)c))?/IB
4528------------------------------------------------------------------
4529        Bra
4530        Brazero
4531        CBra 1
4532        a
4533        CBra 2
4534        b
4535        Recurse
4536        c
4537        Ket
4538        Ket
4539        Ket
4540        End
4541------------------------------------------------------------------
4542Capture group count = 2
4543May match empty string
4544Subject length lower bound = 0
4545
4546/(a(b(?2)c))*/IB
4547------------------------------------------------------------------
4548        Bra
4549        Brazero
4550        CBra 1
4551        a
4552        CBra 2
4553        b
4554        Recurse
4555        c
4556        Ket
4557        KetRmax
4558        Ket
4559        End
4560------------------------------------------------------------------
4561Capture group count = 2
4562May match empty string
4563Subject length lower bound = 0
4564
4565/(a(b(?2)c)){0,2}/IB
4566------------------------------------------------------------------
4567        Bra
4568        Brazero
4569        Bra
4570        CBra 1
4571        a
4572        CBra 2
4573        b
4574        Recurse
4575        c
4576        Ket
4577        Ket
4578        Brazero
4579        CBra 1
4580        a
4581        CBra 2
4582        b
4583        Recurse
4584        c
4585        Ket
4586        Ket
4587        Ket
4588        Ket
4589        End
4590------------------------------------------------------------------
4591Capture group count = 2
4592May match empty string
4593Subject length lower bound = 0
4594
4595/[ab]{1}+/B
4596------------------------------------------------------------------
4597        Bra
4598        [ab]
4599        Ket
4600        End
4601------------------------------------------------------------------
4602
4603/()(?1){1}/B
4604------------------------------------------------------------------
4605        Bra
4606        CBra 1
4607        Ket
4608        Recurse
4609        Ket
4610        End
4611------------------------------------------------------------------
4612
4613/()(?1)/B
4614------------------------------------------------------------------
4615        Bra
4616        CBra 1
4617        Ket
4618        Recurse
4619        Ket
4620        End
4621------------------------------------------------------------------
4622
4623/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
4624Capture group count = 3
4625Options: caseless
4626Last code unit = 'g' (caseless)
4627Subject length lower bound = 8
4628     Baby Bjorn Active Carrier - With free SHIPPING!!
4629 0: Baby Bjorn Active Carrier - With free SHIPPING!!
4630 1: Baby Bjorn Active Carrier - With free SHIPPING!!
4631
4632/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii
4633Capture group count = 3
4634Options: caseless
4635Last code unit = 'g' (caseless)
4636Subject length lower bound = 8
4637     Baby Bjorn Active Carrier - With free SHIPPING!!
4638 0: Baby Bjorn Active Carrier - With free SHIPPING!!
4639 1: Baby Bjorn Active Carrier - With free SHIPPING!!
4640
4641/a*.*b/IB
4642------------------------------------------------------------------
4643        Bra
4644        a*
4645        Any*
4646        b
4647        Ket
4648        End
4649------------------------------------------------------------------
4650Capture group count = 0
4651Last code unit = 'b'
4652Subject length lower bound = 1
4653
4654/(a|b)*.?c/IB
4655------------------------------------------------------------------
4656        Bra
4657        Brazero
4658        CBra 1
4659        a
4660        Alt
4661        b
4662        KetRmax
4663        Any?
4664        c
4665        Ket
4666        End
4667------------------------------------------------------------------
4668Capture group count = 1
4669Last code unit = 'c'
4670Subject length lower bound = 1
4671
4672/abc(?C255)de(?C)f/IB
4673------------------------------------------------------------------
4674        Bra
4675        abc
4676        Callout 255 10 1
4677        de
4678        Callout 0 16 1
4679        f
4680        Ket
4681        End
4682------------------------------------------------------------------
4683Capture group count = 0
4684First code unit = 'a'
4685Last code unit = 'f'
4686Subject length lower bound = 6
4687
4688/abcde/IB,auto_callout
4689------------------------------------------------------------------
4690        Bra
4691        Callout 255 0 1
4692        a
4693        Callout 255 1 1
4694        b
4695        Callout 255 2 1
4696        c
4697        Callout 255 3 1
4698        d
4699        Callout 255 4 1
4700        e
4701        Callout 255 5 0
4702        Ket
4703        End
4704------------------------------------------------------------------
4705Capture group count = 0
4706Options: auto_callout
4707First code unit = 'a'
4708Last code unit = 'e'
4709Subject length lower bound = 5
4710  abcde
4711--->abcde
4712 +0 ^         a
4713 +1 ^^        b
4714 +2 ^ ^       c
4715 +3 ^  ^      d
4716 +4 ^   ^     e
4717 +5 ^    ^    End of pattern
4718 0: abcde
4719\= Expect no match
4720  abcdfe
4721--->abcdfe
4722 +0 ^          a
4723 +1 ^^         b
4724 +2 ^ ^        c
4725 +3 ^  ^       d
4726 +4 ^   ^      e
4727No match
4728
4729/a*b/IB,auto_callout
4730------------------------------------------------------------------
4731        Bra
4732        Callout 255 0 2
4733        a*+
4734        Callout 255 2 1
4735        b
4736        Callout 255 3 0
4737        Ket
4738        End
4739------------------------------------------------------------------
4740Capture group count = 0
4741Options: auto_callout
4742Starting code units: a b
4743Last code unit = 'b'
4744Subject length lower bound = 1
4745  ab
4746--->ab
4747 +0 ^      a*
4748 +2 ^^     b
4749 +3 ^ ^    End of pattern
4750 0: ab
4751  aaaab
4752--->aaaab
4753 +0 ^         a*
4754 +2 ^   ^     b
4755 +3 ^    ^    End of pattern
4756 0: aaaab
4757  aaaacb
4758--->aaaacb
4759 +0 ^          a*
4760 +2 ^   ^      b
4761 +0  ^         a*
4762 +2  ^  ^      b
4763 +0   ^        a*
4764 +2   ^ ^      b
4765 +0    ^       a*
4766 +2    ^^      b
4767 +0      ^     a*
4768 +2      ^     b
4769 +3      ^^    End of pattern
4770 0: b
4771
4772/a*b/IB,auto_callout
4773------------------------------------------------------------------
4774        Bra
4775        Callout 255 0 2
4776        a*+
4777        Callout 255 2 1
4778        b
4779        Callout 255 3 0
4780        Ket
4781        End
4782------------------------------------------------------------------
4783Capture group count = 0
4784Options: auto_callout
4785Starting code units: a b
4786Last code unit = 'b'
4787Subject length lower bound = 1
4788  ab
4789--->ab
4790 +0 ^      a*
4791 +2 ^^     b
4792 +3 ^ ^    End of pattern
4793 0: ab
4794  aaaab
4795--->aaaab
4796 +0 ^         a*
4797 +2 ^   ^     b
4798 +3 ^    ^    End of pattern
4799 0: aaaab
4800  aaaacb
4801--->aaaacb
4802 +0 ^          a*
4803 +2 ^   ^      b
4804 +0  ^         a*
4805 +2  ^  ^      b
4806 +0   ^        a*
4807 +2   ^ ^      b
4808 +0    ^       a*
4809 +2    ^^      b
4810 +0      ^     a*
4811 +2      ^     b
4812 +3      ^^    End of pattern
4813 0: b
4814
4815/a+b/IB,auto_callout
4816------------------------------------------------------------------
4817        Bra
4818        Callout 255 0 2
4819        a++
4820        Callout 255 2 1
4821        b
4822        Callout 255 3 0
4823        Ket
4824        End
4825------------------------------------------------------------------
4826Capture group count = 0
4827Options: auto_callout
4828First code unit = 'a'
4829Last code unit = 'b'
4830Subject length lower bound = 2
4831  ab
4832--->ab
4833 +0 ^      a+
4834 +2 ^^     b
4835 +3 ^ ^    End of pattern
4836 0: ab
4837  aaaab
4838--->aaaab
4839 +0 ^         a+
4840 +2 ^   ^     b
4841 +3 ^    ^    End of pattern
4842 0: aaaab
4843\= Expect no match
4844  aaaacb
4845--->aaaacb
4846 +0 ^          a+
4847 +2 ^   ^      b
4848 +0  ^         a+
4849 +2  ^  ^      b
4850 +0   ^        a+
4851 +2   ^ ^      b
4852 +0    ^       a+
4853 +2    ^^      b
4854No match
4855
4856/(abc|def)x/IB,auto_callout
4857------------------------------------------------------------------
4858        Bra
4859        Callout 255 0 1
4860        CBra 1
4861        Callout 255 1 1
4862        a
4863        Callout 255 2 1
4864        b
4865        Callout 255 3 1
4866        c
4867        Callout 255 4 1
4868        Alt
4869        Callout 255 5 1
4870        d
4871        Callout 255 6 1
4872        e
4873        Callout 255 7 1
4874        f
4875        Callout 255 8 1
4876        Ket
4877        Callout 255 9 1
4878        x
4879        Callout 255 10 0
4880        Ket
4881        End
4882------------------------------------------------------------------
4883Capture group count = 1
4884Options: auto_callout
4885Starting code units: a d
4886Last code unit = 'x'
4887Subject length lower bound = 4
4888  abcx
4889--->abcx
4890 +0 ^        (
4891 +1 ^        a
4892 +2 ^^       b
4893 +3 ^ ^      c
4894 +4 ^  ^     |
4895 +9 ^  ^     x
4896+10 ^   ^    End of pattern
4897 0: abcx
4898 1: abc
4899  defx
4900--->defx
4901 +0 ^        (
4902 +1 ^        a
4903 +5 ^        d
4904 +6 ^^       e
4905 +7 ^ ^      f
4906 +8 ^  ^     )
4907 +9 ^  ^     x
4908+10 ^   ^    End of pattern
4909 0: defx
4910 1: def
4911\= Expect no match
4912  abcdefzx
4913--->abcdefzx
4914 +0 ^            (
4915 +1 ^            a
4916 +2 ^^           b
4917 +3 ^ ^          c
4918 +4 ^  ^         |
4919 +9 ^  ^         x
4920 +5 ^            d
4921 +0    ^         (
4922 +1    ^         a
4923 +5    ^         d
4924 +6    ^^        e
4925 +7    ^ ^       f
4926 +8    ^  ^      )
4927 +9    ^  ^      x
4928No match
4929
4930/(abc|def)x/IB,auto_callout
4931------------------------------------------------------------------
4932        Bra
4933        Callout 255 0 1
4934        CBra 1
4935        Callout 255 1 1
4936        a
4937        Callout 255 2 1
4938        b
4939        Callout 255 3 1
4940        c
4941        Callout 255 4 1
4942        Alt
4943        Callout 255 5 1
4944        d
4945        Callout 255 6 1
4946        e
4947        Callout 255 7 1
4948        f
4949        Callout 255 8 1
4950        Ket
4951        Callout 255 9 1
4952        x
4953        Callout 255 10 0
4954        Ket
4955        End
4956------------------------------------------------------------------
4957Capture group count = 1
4958Options: auto_callout
4959Starting code units: a d
4960Last code unit = 'x'
4961Subject length lower bound = 4
4962  abcx
4963--->abcx
4964 +0 ^        (
4965 +1 ^        a
4966 +2 ^^       b
4967 +3 ^ ^      c
4968 +4 ^  ^     |
4969 +9 ^  ^     x
4970+10 ^   ^    End of pattern
4971 0: abcx
4972 1: abc
4973  defx
4974--->defx
4975 +0 ^        (
4976 +1 ^        a
4977 +5 ^        d
4978 +6 ^^       e
4979 +7 ^ ^      f
4980 +8 ^  ^     )
4981 +9 ^  ^     x
4982+10 ^   ^    End of pattern
4983 0: defx
4984 1: def
4985\= Expect no match
4986  abcdefzx
4987--->abcdefzx
4988 +0 ^            (
4989 +1 ^            a
4990 +2 ^^           b
4991 +3 ^ ^          c
4992 +4 ^  ^         |
4993 +9 ^  ^         x
4994 +5 ^            d
4995 +0    ^         (
4996 +1    ^         a
4997 +5    ^         d
4998 +6    ^^        e
4999 +7    ^ ^       f
5000 +8    ^  ^      )
5001 +9    ^  ^      x
5002No match
5003
5004/(ab|cd){3,4}/I,auto_callout
5005Capture group count = 1
5006Options: auto_callout
5007Starting code units: a c
5008Subject length lower bound = 6
5009  ababab
5010--->ababab
5011 +0 ^          (
5012 +1 ^          a
5013 +2 ^^         b
5014 +3 ^ ^        |
5015 +1 ^ ^        a
5016 +2 ^  ^       b
5017 +3 ^   ^      |
5018 +1 ^   ^      a
5019 +2 ^    ^     b
5020 +3 ^     ^    |
5021 +1 ^     ^    a
5022 +4 ^     ^    c
5023+12 ^     ^    End of pattern
5024 0: ababab
5025 1: ab
5026  abcdabcd
5027--->abcdabcd
5028 +0 ^            (
5029 +1 ^            a
5030 +2 ^^           b
5031 +3 ^ ^          |
5032 +1 ^ ^          a
5033 +4 ^ ^          c
5034 +5 ^  ^         d
5035 +6 ^   ^        ){3,4}
5036 +1 ^   ^        a
5037 +2 ^    ^       b
5038 +3 ^     ^      |
5039 +1 ^     ^      a
5040 +4 ^     ^      c
5041 +5 ^      ^     d
5042 +6 ^       ^    ){3,4}
5043+12 ^       ^    End of pattern
5044 0: abcdabcd
5045 1: cd
5046  abcdcdcdcdcd
5047--->abcdcdcdcdcd
5048 +0 ^                (
5049 +1 ^                a
5050 +2 ^^               b
5051 +3 ^ ^              |
5052 +1 ^ ^              a
5053 +4 ^ ^              c
5054 +5 ^  ^             d
5055 +6 ^   ^            ){3,4}
5056 +1 ^   ^            a
5057 +4 ^   ^            c
5058 +5 ^    ^           d
5059 +6 ^     ^          ){3,4}
5060 +1 ^     ^          a
5061 +4 ^     ^          c
5062 +5 ^      ^         d
5063 +6 ^       ^        ){3,4}
5064+12 ^       ^        End of pattern
5065 0: abcdcdcd
5066 1: cd
5067
5068/([ab]{,4}c|xy)/IB,auto_callout
5069------------------------------------------------------------------
5070        Bra
5071        Callout 255 0 1
5072        CBra 1
5073        Callout 255 1 4
5074        [ab]
5075        Callout 255 5 1
5076        {
5077        Callout 255 6 1
5078        ,
5079        Callout 255 7 1
5080        4
5081        Callout 255 8 1
5082        }
5083        Callout 255 9 1
5084        c
5085        Callout 255 10 1
5086        Alt
5087        Callout 255 11 1
5088        x
5089        Callout 255 12 1
5090        y
5091        Callout 255 13 1
5092        Ket
5093        Callout 255 14 0
5094        Ket
5095        End
5096------------------------------------------------------------------
5097Capture group count = 1
5098Options: auto_callout
5099Starting code units: a b x
5100Subject length lower bound = 2
5101\= Expect no match
5102    Note: that { does NOT introduce a quantifier
5103--->Note: that { does NOT introduce a quantifier
5104 +0         ^                                        (
5105 +1         ^                                        [ab]
5106 +5         ^^                                       {
5107+11         ^                                        x
5108 +0                                 ^                (
5109 +1                                 ^                [ab]
5110 +5                                 ^^               {
5111+11                                 ^                x
5112 +0                                     ^            (
5113 +1                                     ^            [ab]
5114 +5                                     ^^           {
5115+11                                     ^            x
5116No match
5117
5118/([ab]{,4}c|xy)/IB,auto_callout
5119------------------------------------------------------------------
5120        Bra
5121        Callout 255 0 1
5122        CBra 1
5123        Callout 255 1 4
5124        [ab]
5125        Callout 255 5 1
5126        {
5127        Callout 255 6 1
5128        ,
5129        Callout 255 7 1
5130        4
5131        Callout 255 8 1
5132        }
5133        Callout 255 9 1
5134        c
5135        Callout 255 10 1
5136        Alt
5137        Callout 255 11 1
5138        x
5139        Callout 255 12 1
5140        y
5141        Callout 255 13 1
5142        Ket
5143        Callout 255 14 0
5144        Ket
5145        End
5146------------------------------------------------------------------
5147Capture group count = 1
5148Options: auto_callout
5149Starting code units: a b x
5150Subject length lower bound = 2
5151\= Expect no match
5152    Note: that { does NOT introduce a quantifier
5153--->Note: that { does NOT introduce a quantifier
5154 +0         ^                                        (
5155 +1         ^                                        [ab]
5156 +5         ^^                                       {
5157+11         ^                                        x
5158 +0                                 ^                (
5159 +1                                 ^                [ab]
5160 +5                                 ^^               {
5161+11                                 ^                x
5162 +0                                     ^            (
5163 +1                                     ^            [ab]
5164 +5                                     ^^           {
5165+11                                     ^            x
5166No match
5167
5168/([ab]{1,4}c|xy){4,5}?123/IB,auto_callout
5169------------------------------------------------------------------
5170        Bra
5171        Callout 255 0 1
5172        CBra 1
5173        Callout 255 1 9
5174        [ab]{1,4}+
5175        Callout 255 10 1
5176        c
5177        Callout 255 11 1
5178        Alt
5179        Callout 255 12 1
5180        x
5181        Callout 255 13 1
5182        y
5183        Callout 255 14 7
5184        Ket
5185        CBra 1
5186        Callout 255 1 9
5187        [ab]{1,4}+
5188        Callout 255 10 1
5189        c
5190        Callout 255 11 1
5191        Alt
5192        Callout 255 12 1
5193        x
5194        Callout 255 13 1
5195        y
5196        Callout 255 14 7
5197        Ket
5198        CBra 1
5199        Callout 255 1 9
5200        [ab]{1,4}+
5201        Callout 255 10 1
5202        c
5203        Callout 255 11 1
5204        Alt
5205        Callout 255 12 1
5206        x
5207        Callout 255 13 1
5208        y
5209        Callout 255 14 7
5210        Ket
5211        CBra 1
5212        Callout 255 1 9
5213        [ab]{1,4}+
5214        Callout 255 10 1
5215        c
5216        Callout 255 11 1
5217        Alt
5218        Callout 255 12 1
5219        x
5220        Callout 255 13 1
5221        y
5222        Callout 255 14 7
5223        Ket
5224        Braminzero
5225        CBra 1
5226        Callout 255 1 9
5227        [ab]{1,4}+
5228        Callout 255 10 1
5229        c
5230        Callout 255 11 1
5231        Alt
5232        Callout 255 12 1
5233        x
5234        Callout 255 13 1
5235        y
5236        Callout 255 14 7
5237        Ket
5238        Callout 255 21 1
5239        1
5240        Callout 255 22 1
5241        2
5242        Callout 255 23 1
5243        3
5244        Callout 255 24 0
5245        Ket
5246        End
5247------------------------------------------------------------------
5248Capture group count = 1
5249Options: auto_callout
5250Starting code units: a b x
5251Last code unit = '3'
5252Subject length lower bound = 11
5253    aacaacaacaacaac123
5254--->aacaacaacaacaac123
5255 +0 ^                      (
5256 +1 ^                      [ab]{1,4}
5257+10 ^ ^                    c
5258+11 ^  ^                   |
5259 +1 ^  ^                   [ab]{1,4}
5260+10 ^    ^                 c
5261+11 ^     ^                |
5262 +1 ^     ^                [ab]{1,4}
5263+10 ^       ^              c
5264+11 ^        ^             |
5265 +1 ^        ^             [ab]{1,4}
5266+10 ^          ^           c
5267+11 ^           ^          |
5268+21 ^           ^          1
5269 +1 ^           ^          [ab]{1,4}
5270+10 ^             ^        c
5271+11 ^              ^       |
5272+21 ^              ^       1
5273+22 ^               ^      2
5274+23 ^                ^     3
5275+24 ^                 ^    End of pattern
5276 0: aacaacaacaacaac123
5277 1: aac
5278
5279/\b.*/I
5280Capture group count = 0
5281Max lookbehind = 1
5282May match empty string
5283Subject length lower bound = 0
5284  ab cd\=offset=1
5285 0:  cd
5286
5287/\b.*/Is
5288Capture group count = 0
5289Max lookbehind = 1
5290May match empty string
5291Options: dotall
5292Subject length lower bound = 0
5293  ab cd\=startoffset=1
5294 0:  cd
5295
5296/(?!.bcd).*/I
5297Capture group count = 0
5298May match empty string
5299Subject length lower bound = 0
5300  Xbcd12345
5301 0: bcd12345
5302
5303/abcde/I
5304Capture group count = 0
5305First code unit = 'a'
5306Last code unit = 'e'
5307Subject length lower bound = 5
5308    ab\=ps
5309Partial match: ab
5310    abc\=ps
5311Partial match: abc
5312    abcd\=ps
5313Partial match: abcd
5314    abcde\=ps
5315 0: abcde
5316    the quick brown abc\=ps
5317Partial match: abc
5318\= Expect no match\=ps
5319    the quick brown abxyz fox\=ps
5320No match
5321
5322"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I
5323Capture group count = 3
5324Compile options: <none>
5325Overall options: anchored
5326Starting code units: 0 1 2 3 4 5 6 7 8 9
5327Last code unit = '/'
5328Subject length lower bound = 6
5329    13/05/04\=ps
5330 0: 13/05/04
5331 1: 13
5332 2: 05
5333    13/5/2004\=ps
5334 0: 13/5/2004
5335 1: 13
5336 2: 5
5337 3: 20
5338    02/05/09\=ps
5339 0: 02/05/09
5340 1: 02
5341 2: 05
5342    1\=ps
5343Partial match: 1
5344    1/2\=ps
5345Partial match: 1/2
5346    1/2/0\=ps
5347Partial match: 1/2/0
5348    1/2/04\=ps
5349 0: 1/2/04
5350 1: 1
5351 2: 2
5352    0\=ps
5353Partial match: 0
5354    02/\=ps
5355Partial match: 02/
5356    02/0\=ps
5357Partial match: 02/0
5358    02/1\=ps
5359Partial match: 02/1
5360\= Expect no match\=ps
5361    \=ps
5362No match
5363    123\=ps
5364No match
5365    33/4/04\=ps
5366No match
5367    3/13/04\=ps
5368No match
5369    0/1/2003\=ps
5370No match
5371    0/\=ps
5372No match
5373    02/0/\=ps
5374No match
5375    02/13\=ps
5376No match
5377
5378/0{0,2}ABC/I
5379Capture group count = 0
5380Starting code units: 0 A
5381Last code unit = 'C'
5382Subject length lower bound = 3
5383
5384/\d{3,}ABC/I
5385Capture group count = 0
5386Starting code units: 0 1 2 3 4 5 6 7 8 9
5387Last code unit = 'C'
5388Subject length lower bound = 6
5389
5390/\d*ABC/I
5391Capture group count = 0
5392Starting code units: 0 1 2 3 4 5 6 7 8 9 A
5393Last code unit = 'C'
5394Subject length lower bound = 3
5395
5396/[abc]+DE/I
5397Capture group count = 0
5398Starting code units: a b c
5399Last code unit = 'E'
5400Subject length lower bound = 3
5401
5402/[abc]?123/I
5403Capture group count = 0
5404Starting code units: 1 a b c
5405Last code unit = '3'
5406Subject length lower bound = 3
5407    123\=ps
5408 0: 123
5409    a\=ps
5410Partial match: a
5411    b\=ps
5412Partial match: b
5413    c\=ps
5414Partial match: c
5415    c12\=ps
5416Partial match: c12
5417    c123\=ps
5418 0: c123
5419
5420/^(?:\d){3,5}X/I
5421Capture group count = 0
5422Compile options: <none>
5423Overall options: anchored
5424Starting code units: 0 1 2 3 4 5 6 7 8 9
5425Last code unit = 'X'
5426Subject length lower bound = 4
5427    1\=ps
5428Partial match: 1
5429    123\=ps
5430Partial match: 123
5431    123X
5432 0: 123X
5433    1234\=ps
5434Partial match: 1234
5435    1234X
5436 0: 1234X
5437    12345\=ps
5438Partial match: 12345
5439    12345X
5440 0: 12345X
5441\= Expect no match
5442    1X
5443No match
5444    123456\=ps
5445No match
5446
5447"<(\w+)/?>(.)*</(\1)>"Igms
5448Capture group count = 3
5449Max back reference = 1
5450Options: dotall multiline
5451First code unit = '<'
5452Last code unit = '>'
5453Subject length lower bound = 7
5454    <!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
5455 0: <seite>\x0a<dokumenteninformation>\x0a<seitentitel>Partner der LCO</seitentitel>\x0a<sprache>de</sprache>\x0a<seitenbeschreibung>Partner der LINEAS Consulting\x0aGmbH</seitenbeschreibung>\x0a<schluesselworte>LINEAS Consulting GmbH Hamburg\x0aPartnerfirmen</schluesselworte>\x0a<revisit>30 days</revisit>\x0a<robots>index,follow</robots>\x0a<menueinformation>\x0a<aktiv>ja</aktiv>\x0a<menueposition>3</menueposition>\x0a<menuetext>Partner</menuetext>\x0a</menueinformation>\x0a<lastedited>\x0a<autor>LCO</autor>\x0a<firma>LINEAS Consulting</firma>\x0a<datum>15.10.2003</datum>\x0a</lastedited>\x0a</dokumenteninformation>\x0a<inhalt>\x0a\x0a<absatzueberschrift>Die Partnerfirmen der LINEAS Consulting\x0aGmbH</absatzueberschrift>\x0a\x0a<absatz><link ziel="http://www.ca.com/" zielfenster="_blank">\x0a<bild name="logo_ca.gif" rahmen="no"/></link> <link\x0aziel="http://www.ey.com/" zielfenster="_blank"><bild\x0aname="logo_euy.gif" rahmen="no"/></link>\x0a</absatz>\x0a\x0a<absatz><link ziel="http://www.cisco.de/" zielfenster="_blank">\x0a<bild name="logo_cisco.gif" rahmen="ja"/></link></absatz>\x0a\x0a<absatz><link ziel="http://www.atelion.de/"\x0azielfenster="_blank"><bild\x0aname="logo_atelion.gif" rahmen="no"/></link>\x0a</absatz>\x0a\x0a<absatz><link ziel="http://www.line-information.de/"\x0azielfenster="_blank">\x0a<bild name="logo_line_information.gif" rahmen="no"/></link>\x0a</absatz>\x0a\x0a<absatz><bild name="logo_aw.gif" rahmen="no"/></absatz>\x0a\x0a<absatz><link ziel="http://www.incognis.de/"\x0azielfenster="_blank"><bild\x0aname="logo_incognis.gif" rahmen="no"/></link></absatz>\x0a\x0a<absatz><link ziel="http://www.addcraft.com/"\x0azielfenster="_blank"><bild\x0aname="logo_addcraft.gif" rahmen="no"/></link></absatz>\x0a\x0a<absatz><link ziel="http://www.comendo.com/"\x0azielfenster="_blank"><bild\x0aname="logo_comendo.gif" rahmen="no"/></link></absatz>\x0a\x0a</inhalt>\x0a</seite>
5456 1: seite
5457 2: \x0a
5458 3: seite
5459
5460/line\nbreak/I
5461Capture group count = 0
5462Contains explicit CR or LF match
5463First code unit = 'l'
5464Last code unit = 'k'
5465Subject length lower bound = 10
5466    this is a line\nbreak
5467 0: line\x0abreak
5468    line one\nthis is a line\nbreak in the second line
5469 0: line\x0abreak
5470
5471/line\nbreak/I,firstline
5472Capture group count = 0
5473Contains explicit CR or LF match
5474Options: firstline
5475First code unit = 'l'
5476Last code unit = 'k'
5477Subject length lower bound = 10
5478    this is a line\nbreak
5479 0: line\x0abreak
5480\= Expect no match
5481    line one\nthis is a line\nbreak in the second line
5482No match
5483
5484/line\nbreak/Im,firstline
5485Capture group count = 0
5486Contains explicit CR or LF match
5487Options: firstline multiline
5488First code unit = 'l'
5489Last code unit = 'k'
5490Subject length lower bound = 10
5491    this is a line\nbreak
5492 0: line\x0abreak
5493\= Expect no match
5494    line one\nthis is a line\nbreak in the second line
5495No match
5496
5497/(?i)(?-i)AbCd/I
5498Capture group count = 0
5499First code unit = 'A'
5500Last code unit = 'd'
5501Subject length lower bound = 4
5502    AbCd
5503 0: AbCd
5504\= Expect no match
5505    abcd
5506No match
5507
5508/a{11111111111111111111}/I
5509Failed: error 105 at offset 8: number too big in {} quantifier
5510
5511/(){64294967295}/I
5512Failed: error 105 at offset 9: number too big in {} quantifier
5513
5514/(){2,4294967295}/I
5515Failed: error 105 at offset 11: number too big in {} quantifier
5516
5517"(?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
5518Capture group count = 1
5519Max back reference = 1
5520First code unit = 'a' (caseless)
5521Last code unit = 'B'
5522Subject length lower bound = 15
5523    abcdefghijklAkB
5524 0: abcdefghijklAkB
5525 1: k
5526
5527"(?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
5528Capture group count = 12
5529Max back reference = 11
5530Named capture groups:
5531  n0    1
5532  n1    2
5533  n10  11
5534  n11  12
5535  n2    3
5536  n3    4
5537  n4    5
5538  n5    6
5539  n6    7
5540  n7    8
5541  n8    9
5542  n9   10
5543First code unit = 'a'
5544Last code unit = 'B'
5545Subject length lower bound = 15
5546    abcdefghijklAkB
5547 0: abcdefghijklAkB
5548 1: a
5549 2: b
5550 3: c
5551 4: d
5552 5: e
5553 6: f
5554 7: g
5555 8: h
5556 9: i
555710: j
555811: k
555912: l
5560
5561"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I
5562Capture group count = 12
5563Max back reference = 11
5564First code unit = 'a'
5565Last code unit = 'B'
5566Subject length lower bound = 15
5567    abcdefghijklAkB
5568 0: abcdefghijklAkB
5569 1: a
5570 2: b
5571 3: c
5572 4: d
5573 5: e
5574 6: f
5575 7: g
5576 8: h
5577 9: i
557810: j
557911: k
558012: l
5581
5582"(?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
5583Capture group count = 101
5584Named capture groups:
5585  name0     1
5586  name1     2
5587  name10   11
5588  name100 101
5589  name11   12
5590  name12   13
5591  name13   14
5592  name14   15
5593  name15   16
5594  name16   17
5595  name17   18
5596  name18   19
5597  name19   20
5598  name2     3
5599  name20   21
5600  name21   22
5601  name22   23
5602  name23   24
5603  name24   25
5604  name25   26
5605  name26   27
5606  name27   28
5607  name28   29
5608  name29   30
5609  name3     4
5610  name30   31
5611  name31   32
5612  name32   33
5613  name33   34
5614  name34   35
5615  name35   36
5616  name36   37
5617  name37   38
5618  name38   39
5619  name39   40
5620  name4     5
5621  name40   41
5622  name41   42
5623  name42   43
5624  name43   44
5625  name44   45
5626  name45   46
5627  name46   47
5628  name47   48
5629  name48   49
5630  name49   50
5631  name5     6
5632  name50   51
5633  name51   52
5634  name52   53
5635  name53   54
5636  name54   55
5637  name55   56
5638  name56   57
5639  name57   58
5640  name58   59
5641  name59   60
5642  name6     7
5643  name60   61
5644  name61   62
5645  name62   63
5646  name63   64
5647  name64   65
5648  name65   66
5649  name66   67
5650  name67   68
5651  name68   69
5652  name69   70
5653  name7     8
5654  name70   71
5655  name71   72
5656  name72   73
5657  name73   74
5658  name74   75
5659  name75   76
5660  name76   77
5661  name77   78
5662  name78   79
5663  name79   80
5664  name8     9
5665  name80   81
5666  name81   82
5667  name82   83
5668  name83   84
5669  name84   85
5670  name85   86
5671  name86   87
5672  name87   88
5673  name88   89
5674  name89   90
5675  name9    10
5676  name90   91
5677  name91   92
5678  name92   93
5679  name93   94
5680  name94   95
5681  name95   96
5682  name96   97
5683  name97   98
5684  name98   99
5685  name99  100
5686First code unit = 'a'
5687Last code unit = 'a'
5688Subject length lower bound = 101
5689    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
5690Matched, but too many substrings
5691 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
5692 1: a
5693 2: a
5694 3: a
5695 4: a
5696 5: a
5697 6: a
5698 7: a
5699 8: a
5700 9: a
570110: a
570211: a
570312: a
570413: a
570514: a
5706
5707"(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
5708Capture group count = 101
5709First code unit = 'a'
5710Last code unit = 'a'
5711Subject length lower bound = 101
5712    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
5713Matched, but too many substrings
5714 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
5715 1: a
5716 2: a
5717 3: a
5718 4: a
5719 5: a
5720 6: a
5721 7: a
5722 8: a
5723 9: a
572410: a
572511: a
572612: a
572713: a
572814: a
5729
5730/[^()]*(?:\((?R)\)[^()]*)*/I
5731Capture group count = 0
5732May match empty string
5733Subject length lower bound = 0
5734    (this(and)that
5735 0:
5736    (this(and)that)
5737 0: (this(and)that)
5738    (this(and)that)stuff
5739 0: (this(and)that)stuff
5740
5741/[^()]*(?:\((?>(?R))\)[^()]*)*/I
5742Capture group count = 0
5743May match empty string
5744Subject length lower bound = 0
5745    (this(and)that
5746 0:
5747    (this(and)that)
5748 0: (this(and)that)
5749
5750/[^()]*(?:\((?R)\))*[^()]*/I
5751Capture group count = 0
5752May match empty string
5753Subject length lower bound = 0
5754    (this(and)that
5755 0:
5756    (this(and)that)
5757 0: (this(and)that)
5758
5759/(?:\((?R)\))*[^()]*/I
5760Capture group count = 0
5761May match empty string
5762Subject length lower bound = 0
5763    (this(and)that
5764 0:
5765    (this(and)that)
5766 0:
5767    ((this))
5768 0: ((this))
5769
5770/(?:\((?R)\))|[^()]*/I
5771Capture group count = 0
5772May match empty string
5773Subject length lower bound = 0
5774    (this(and)that
5775 0:
5776    (this(and)that)
5777 0:
5778    (this)
5779 0: (this)
5780    ((this))
5781 0: ((this))
5782
5783/\x{0000ff}/I
5784Capture group count = 0
5785First code unit = \xff
5786Subject length lower bound = 1
5787
5788/^((?P<A>a1)|(?P<A>a2)b)/I
5789Failed: error 143 at offset 18: two named subpatterns have the same name (PCRE2_DUPNAMES not set)
5790
5791/^((?P<A>a1)|(?P<A>a2)b)/I,dupnames
5792Capture group count = 3
5793Named capture groups:
5794  A   2
5795  A   3
5796Compile options: dupnames
5797Overall options: anchored dupnames
5798First code unit = 'a'
5799Subject length lower bound = 2
5800    a1b\=copy=A
5801 0: a1
5802 1: a1
5803 2: a1
5804  C a1 (2) A (non-unique)
5805    a2b\=copy=A
5806 0: a2b
5807 1: a2b
5808 2: <unset>
5809 3: a2
5810  C a2 (2) A (non-unique)
5811    a1b\=copy=Z,copy=A
5812 0: a1
5813 1: a1
5814 2: a1
5815Number not found for group 'Z'
5816Copy substring 'Z' failed (-49): unknown substring
5817  C a1 (2) A (non-unique)
5818
5819/(?|(?<a>)(?<b>)(?<a>)|(?<a>)(?<b>)(?<a>))/I,dupnames
5820Capture group count = 3
5821Named capture groups:
5822  a   1
5823  a   3
5824  b   2
5825May match empty string
5826Options: dupnames
5827Subject length lower bound = 0
5828
5829/^(?P<A>a)(?P<A>b)/I,dupnames
5830Capture group count = 2
5831Named capture groups:
5832  A   1
5833  A   2
5834Compile options: dupnames
5835Overall options: anchored dupnames
5836First code unit = 'a'
5837Subject length lower bound = 2
5838    ab\=copy=A
5839 0: ab
5840 1: a
5841 2: b
5842  C a (1) A (non-unique)
5843
5844/^(?P<A>a)(?P<A>b)|cd/I,dupnames
5845Capture group count = 2
5846Named capture groups:
5847  A   1
5848  A   2
5849Options: dupnames
5850Starting code units: a c
5851Subject length lower bound = 2
5852    ab\=copy=A
5853 0: ab
5854 1: a
5855 2: b
5856  C a (1) A (non-unique)
5857    cd\=copy=A
5858 0: cd
5859Copy substring 'A' failed (-55): requested value is not set
5860
5861/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/I,dupnames
5862Capture group count = 4
5863Named capture groups:
5864  A   1
5865  A   2
5866  A   3
5867  A   4
5868Options: dupnames
5869Starting code units: a c
5870Subject length lower bound = 2
5871    cdefgh\=copy=A
5872 0: cdefgh
5873 1: <unset>
5874 2: <unset>
5875 3: ef
5876 4: gh
5877  C ef (2) A (non-unique)
5878
5879/^((?P<A>a1)|(?P<A>a2)b)/I,dupnames
5880Capture group count = 3
5881Named capture groups:
5882  A   2
5883  A   3
5884Compile options: dupnames
5885Overall options: anchored dupnames
5886First code unit = 'a'
5887Subject length lower bound = 2
5888    a1b\=get=A
5889 0: a1
5890 1: a1
5891 2: a1
5892  G a1 (2) A (non-unique)
5893    a2b\=get=A
5894 0: a2b
5895 1: a2b
5896 2: <unset>
5897 3: a2
5898  G a2 (2) A (non-unique)
5899    a1b\=get=Z,get=A
5900 0: a1
5901 1: a1
5902 2: a1
5903Number not found for group 'Z'
5904Get substring 'Z' failed (-49): unknown substring
5905  G a1 (2) A (non-unique)
5906
5907/^(?P<A>a)(?P<A>b)/I,dupnames
5908Capture group count = 2
5909Named capture groups:
5910  A   1
5911  A   2
5912Compile options: dupnames
5913Overall options: anchored dupnames
5914First code unit = 'a'
5915Subject length lower bound = 2
5916    ab\=get=A
5917 0: ab
5918 1: a
5919 2: b
5920  G a (1) A (non-unique)
5921
5922/^(?P<A>a)(?P<A>b)|cd/I,dupnames
5923Capture group count = 2
5924Named capture groups:
5925  A   1
5926  A   2
5927Options: dupnames
5928Starting code units: a c
5929Subject length lower bound = 2
5930    ab\=get=A
5931 0: ab
5932 1: a
5933 2: b
5934  G a (1) A (non-unique)
5935    cd\=get=A
5936 0: cd
5937Get substring 'A' failed (-55): requested value is not set
5938
5939/^(?P<A>a)(?P<A>b)|cd(?P<A>ef)(?P<A>gh)/I,dupnames
5940Capture group count = 4
5941Named capture groups:
5942  A   1
5943  A   2
5944  A   3
5945  A   4
5946Options: dupnames
5947Starting code units: a c
5948Subject length lower bound = 2
5949    cdefgh\=get=A
5950 0: cdefgh
5951 1: <unset>
5952 2: <unset>
5953 3: ef
5954 4: gh
5955  G ef (2) A (non-unique)
5956
5957/(?J)^((?P<A>a1)|(?P<A>a2)b)/I
5958Capture group count = 3
5959Named capture groups:
5960  A   2
5961  A   3
5962Compile options: <none>
5963Overall options: anchored
5964Duplicate name status changes
5965First code unit = 'a'
5966Subject length lower bound = 2
5967    a1b\=copy=A
5968 0: a1
5969 1: a1
5970 2: a1
5971  C a1 (2) A (non-unique)
5972    a2b\=copy=A
5973 0: a2b
5974 1: a2b
5975 2: <unset>
5976 3: a2
5977  C a2 (2) A (non-unique)
5978
5979/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<A>d)/I
5980Failed: error 143 at offset 38: two named subpatterns have the same name (PCRE2_DUPNAMES not set)
5981
5982# In this next test, J is not set at the outer level; consequently it isn't set
5983# in the pattern's options; consequently pcre2_substring_get_byname() produces
5984# a random value.
5985
5986/^(?P<A>a) (?J:(?P<B>b)(?P<B>c)) (?P<C>d)/I
5987Capture group count = 4
5988Named capture groups:
5989  A   1
5990  B   2
5991  B   3
5992  C   4
5993Compile options: <none>
5994Overall options: anchored
5995Duplicate name status changes
5996First code unit = 'a'
5997Subject length lower bound = 6
5998    a bc d\=copy=A,copy=B,copy=C
5999 0: a bc d
6000 1: a
6001 2: b
6002 3: c
6003 4: d
6004  C a (1) A (group 1)
6005  C b (1) B (non-unique)
6006  C d (1) C (group 4)
6007
6008/^(?P<A>a)?(?(A)a|b)/I
6009Capture group count = 1
6010Max back reference = 1
6011Named capture groups:
6012  A   1
6013Compile options: <none>
6014Overall options: anchored
6015Subject length lower bound = 1
6016    aabc
6017 0: aa
6018 1: a
6019    bc
6020 0: b
6021\= Expect no match
6022    abc
6023No match
6024
6025/(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
6026Capture group count = 1
6027Max back reference = 1
6028Named capture groups:
6029  ZZ   1
6030Last code unit = 'X'
6031Subject length lower bound = 2
6032    bXaX
6033 0: bXaX
6034 1: X
6035
6036/(?:(?(2y)a|b)(X))+/I
6037Failed: error 124 at offset 7: missing closing parenthesis for condition
6038
6039/(?:(?(ZA)a|b)(?P<ZZ>X))+/I
6040Failed: error 115 at offset 6: reference to non-existent subpattern
6041
6042/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
6043Capture group count = 1
6044Max back reference = 1
6045Named capture groups:
6046  ZZ   1
6047Last code unit = 'X'
6048Subject length lower bound = 3
6049    bbXaaX
6050 0: bbXaaX
6051 1: X
6052
6053/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
6054Capture group count = 1
6055Max back reference = 1
6056Named capture groups:
6057  ZZ   1
6058Last code unit = 'X'
6059Subject length lower bound = 3
6060    (b)\\Xa\\X
6061 0: (b)\Xa\X
6062 1: X
6063
6064/(?P<ABC/I
6065Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator?)
6066
6067/(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
6068Capture group count = 1
6069Max back reference = 1
6070Named capture groups:
6071  A   1
6072Subject length lower bound = 2
6073    bXXaYYaY
6074 0: bXXaYYaY
6075 1: Y
6076    bXYaXXaX
6077 0: bX
6078 1: X
6079
6080/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
6081Capture group count = 10
6082Max back reference = 10
6083Named capture groups:
6084  A  10
6085Subject length lower bound = 2
6086    bXXaYYaY
6087 0: bXXaYYaY
6088 1:
6089 2:
6090 3:
6091 4:
6092 5:
6093 6:
6094 7:
6095 8:
6096 9:
609710: Y
6098
6099/\s*,\s*/I
6100Capture group count = 0
6101Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 ,
6102Last code unit = ','
6103Subject length lower bound = 1
6104    \x0b,\x0b
6105 0: \x0b,\x0b
6106    \x0c,\x0d
6107 0: \x0c,\x0d
6108
6109/^abc/Im,newline=lf
6110Capture group count = 0
6111Options: multiline
6112Forced newline is LF
6113First code unit at start or follows newline
6114Last code unit = 'c'
6115Subject length lower bound = 3
6116    xyz\nabc
6117 0: abc
6118    xyz\r\nabc
6119 0: abc
6120\= Expect no match
6121    xyz\rabc
6122No match
6123    xyzabc\r
6124No match
6125    xyzabc\rpqr
6126No match
6127    xyzabc\r\n
6128No match
6129    xyzabc\r\npqr
6130No match
6131
6132/^abc/Im,newline=crlf
6133Capture group count = 0
6134Options: multiline
6135Forced newline is CRLF
6136First code unit at start or follows newline
6137Last code unit = 'c'
6138Subject length lower bound = 3
6139    xyz\r\nabclf>
6140 0: abc
6141\= Expect no match
6142    xyz\nabclf
6143No match
6144    xyz\rabclf
6145No match
6146
6147/^abc/Im,newline=cr
6148Capture group count = 0
6149Options: multiline
6150Forced newline is CR
6151First code unit at start or follows newline
6152Last code unit = 'c'
6153Subject length lower bound = 3
6154    xyz\rabc
6155 0: abc
6156\= Expect no match
6157    xyz\nabc
6158No match
6159    xyz\r\nabc
6160No match
6161
6162/^abc/Im,newline=bad
6163** Invalid value in 'newline=bad'
6164
6165/.*/I,newline=lf
6166Capture group count = 0
6167May match empty string
6168Forced newline is LF
6169First code unit at start or follows newline
6170Subject length lower bound = 0
6171    abc\ndef
6172 0: abc
6173    abc\rdef
6174 0: abc\x0ddef
6175    abc\r\ndef
6176 0: abc\x0d
6177
6178/.*/I,newline=cr
6179Capture group count = 0
6180May match empty string
6181Forced newline is CR
6182First code unit at start or follows newline
6183Subject length lower bound = 0
6184    abc\ndef
6185 0: abc\x0adef
6186    abc\rdef
6187 0: abc
6188    abc\r\ndef
6189 0: abc
6190
6191/.*/I,newline=crlf
6192Capture group count = 0
6193May match empty string
6194Forced newline is CRLF
6195First code unit at start or follows newline
6196Subject length lower bound = 0
6197    abc\ndef
6198 0: abc\x0adef
6199    abc\rdef
6200 0: abc\x0ddef
6201    abc\r\ndef
6202 0: abc
6203
6204/\w+(.)(.)?def/Is
6205Capture group count = 2
6206Options: dotall
6207Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
6208  Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
6209Last code unit = 'f'
6210Subject length lower bound = 5
6211    abc\ndef
6212 0: abc\x0adef
6213 1: \x0a
6214    abc\rdef
6215 0: abc\x0ddef
6216 1: \x0d
6217    abc\r\ndef
6218 0: abc\x0d\x0adef
6219 1: \x0d
6220 2: \x0a
6221
6222/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
6223Capture group count = 1
6224Named capture groups:
6225  B   1
6226Starting code units: 0 1 2 3 4 5 6 7 8 9
6227Last code unit = '.'
6228Subject length lower bound = 7
6229
6230/()()()()()()()()()()()()()()()()()()()()
6231 ()()()()()()()()()()()()()()()()()()()()
6232 ()()()()()()()()()()()()()()()()()()()()
6233 ()()()()()()()()()()()()()()()()()()()()
6234 ()()()()()()()()()()()()()()()()()()()()
6235 (.(.))/Ix
6236Capture group count = 102
6237Options: extended
6238Subject length lower bound = 2
6239    XY\=ovector=133
6240 0: XY
6241 1:
6242 2:
6243 3:
6244 4:
6245 5:
6246 6:
6247 7:
6248 8:
6249 9:
625010:
625111:
625212:
625313:
625414:
625515:
625616:
625717:
625818:
625919:
626020:
626121:
626222:
626323:
626424:
626525:
626626:
626727:
626828:
626929:
627030:
627131:
627232:
627333:
627434:
627535:
627636:
627737:
627838:
627939:
628040:
628141:
628242:
628343:
628444:
628545:
628646:
628747:
628848:
628949:
629050:
629151:
629252:
629353:
629454:
629555:
629656:
629757:
629858:
629959:
630060:
630161:
630262:
630363:
630464:
630565:
630666:
630767:
630868:
630969:
631070:
631171:
631272:
631373:
631474:
631575:
631676:
631777:
631878:
631979:
632080:
632181:
632282:
632383:
632484:
632585:
632686:
632787:
632888:
632989:
633090:
633191:
633292:
633393:
633494:
633595:
633696:
633797:
633898:
633999:
6340100:
6341101: XY
6342102: Y
6343
6344/(a*b|(?i:c*(?-i)d))/I
6345Capture group count = 1
6346Starting code units: C a b c d
6347Subject length lower bound = 1
6348
6349/()[ab]xyz/I
6350Capture group count = 1
6351Starting code units: a b
6352Last code unit = 'z'
6353Subject length lower bound = 4
6354
6355/(|)[ab]xyz/I
6356Capture group count = 1
6357Starting code units: a b
6358Last code unit = 'z'
6359Subject length lower bound = 4
6360
6361/(|c)[ab]xyz/I
6362Capture group count = 1
6363Starting code units: a b c
6364Last code unit = 'z'
6365Subject length lower bound = 4
6366
6367/(|c?)[ab]xyz/I
6368Capture group count = 1
6369Starting code units: a b c
6370Last code unit = 'z'
6371Subject length lower bound = 4
6372
6373/(d?|c?)[ab]xyz/I
6374Capture group count = 1
6375Starting code units: a b c d
6376Last code unit = 'z'
6377Subject length lower bound = 4
6378
6379/(d?|c)[ab]xyz/I
6380Capture group count = 1
6381Starting code units: a b c d
6382Last code unit = 'z'
6383Subject length lower bound = 4
6384
6385/^a*b\d/IB
6386------------------------------------------------------------------
6387        Bra
6388        ^
6389        a*+
6390        b
6391        \d
6392        Ket
6393        End
6394------------------------------------------------------------------
6395Capture group count = 0
6396Compile options: <none>
6397Overall options: anchored
6398Starting code units: a b
6399Last code unit = 'b'
6400Subject length lower bound = 2
6401
6402/^a*+b\d/IB
6403------------------------------------------------------------------
6404        Bra
6405        ^
6406        a*+
6407        b
6408        \d
6409        Ket
6410        End
6411------------------------------------------------------------------
6412Capture group count = 0
6413Compile options: <none>
6414Overall options: anchored
6415Starting code units: a b
6416Last code unit = 'b'
6417Subject length lower bound = 2
6418
6419/^a*?b\d/IB
6420------------------------------------------------------------------
6421        Bra
6422        ^
6423        a*+
6424        b
6425        \d
6426        Ket
6427        End
6428------------------------------------------------------------------
6429Capture group count = 0
6430Compile options: <none>
6431Overall options: anchored
6432Starting code units: a b
6433Last code unit = 'b'
6434Subject length lower bound = 2
6435
6436/^a+A\d/IB
6437------------------------------------------------------------------
6438        Bra
6439        ^
6440        a++
6441        A
6442        \d
6443        Ket
6444        End
6445------------------------------------------------------------------
6446Capture group count = 0
6447Compile options: <none>
6448Overall options: anchored
6449First code unit = 'a'
6450Last code unit = 'A'
6451Subject length lower bound = 3
6452    aaaA5
6453 0: aaaA5
6454\= Expect no match
6455    aaaa5
6456No match
6457
6458/^a*A\d/IBi
6459------------------------------------------------------------------
6460        Bra
6461        ^
6462     /i a*
6463     /i A
6464        \d
6465        Ket
6466        End
6467------------------------------------------------------------------
6468Capture group count = 0
6469Compile options: caseless
6470Overall options: anchored caseless
6471Starting code units: A a
6472Last code unit = 'A' (caseless)
6473Subject length lower bound = 2
6474    aaaA5
6475 0: aaaA5
6476    aaaa5
6477 0: aaaa5
6478    a5
6479 0: a5
6480
6481/(a*|b*)[cd]/I
6482Capture group count = 1
6483Starting code units: a b c d
6484Subject length lower bound = 1
6485
6486/(a+|b*)[cd]/I
6487Capture group count = 1
6488Starting code units: a b c d
6489Subject length lower bound = 1
6490
6491/(a*|b+)[cd]/I
6492Capture group count = 1
6493Starting code units: a b c d
6494Subject length lower bound = 1
6495
6496/(a+|b+)[cd]/I
6497Capture group count = 1
6498Starting code units: a b
6499Subject length lower bound = 2
6500
6501/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
6502 ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
6503 (((
6504 a
6505 ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
6506 ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
6507 )))
6508/Ix
6509Capture group count = 203
6510Options: extended
6511First code unit = 'a'
6512Subject length lower bound = 1
6513  large nest
6514Matched, but too many substrings
6515 0: a
6516 1: a
6517 2: a
6518 3: a
6519 4: a
6520 5: a
6521 6: a
6522 7: a
6523 8: a
6524 9: a
652510: a
652611: a
652712: a
652813: a
652914: a
6530
6531/a*\d/B
6532------------------------------------------------------------------
6533        Bra
6534        a*+
6535        \d
6536        Ket
6537        End
6538------------------------------------------------------------------
6539
6540/a*\D/B
6541------------------------------------------------------------------
6542        Bra
6543        a*
6544        \D
6545        Ket
6546        End
6547------------------------------------------------------------------
6548
6549/0*\d/B
6550------------------------------------------------------------------
6551        Bra
6552        0*
6553        \d
6554        Ket
6555        End
6556------------------------------------------------------------------
6557
6558/0*\D/B
6559------------------------------------------------------------------
6560        Bra
6561        0*+
6562        \D
6563        Ket
6564        End
6565------------------------------------------------------------------
6566
6567/a*\s/B
6568------------------------------------------------------------------
6569        Bra
6570        a*+
6571        \s
6572        Ket
6573        End
6574------------------------------------------------------------------
6575
6576/a*\S/B
6577------------------------------------------------------------------
6578        Bra
6579        a*
6580        \S
6581        Ket
6582        End
6583------------------------------------------------------------------
6584
6585/ *\s/B
6586------------------------------------------------------------------
6587        Bra
6588         *
6589        \s
6590        Ket
6591        End
6592------------------------------------------------------------------
6593
6594/ *\S/B
6595------------------------------------------------------------------
6596        Bra
6597         *+
6598        \S
6599        Ket
6600        End
6601------------------------------------------------------------------
6602
6603/a*\w/B
6604------------------------------------------------------------------
6605        Bra
6606        a*
6607        \w
6608        Ket
6609        End
6610------------------------------------------------------------------
6611
6612/a*\W/B
6613------------------------------------------------------------------
6614        Bra
6615        a*+
6616        \W
6617        Ket
6618        End
6619------------------------------------------------------------------
6620
6621/=*\w/B
6622------------------------------------------------------------------
6623        Bra
6624        =*+
6625        \w
6626        Ket
6627        End
6628------------------------------------------------------------------
6629
6630/=*\W/B
6631------------------------------------------------------------------
6632        Bra
6633        =*
6634        \W
6635        Ket
6636        End
6637------------------------------------------------------------------
6638
6639/\d*a/B
6640------------------------------------------------------------------
6641        Bra
6642        \d*+
6643        a
6644        Ket
6645        End
6646------------------------------------------------------------------
6647
6648/\d*2/B
6649------------------------------------------------------------------
6650        Bra
6651        \d*
6652        2
6653        Ket
6654        End
6655------------------------------------------------------------------
6656
6657/\d*\d/B
6658------------------------------------------------------------------
6659        Bra
6660        \d*
6661        \d
6662        Ket
6663        End
6664------------------------------------------------------------------
6665
6666/\d*\D/B
6667------------------------------------------------------------------
6668        Bra
6669        \d*+
6670        \D
6671        Ket
6672        End
6673------------------------------------------------------------------
6674
6675/\d*\s/B
6676------------------------------------------------------------------
6677        Bra
6678        \d*+
6679        \s
6680        Ket
6681        End
6682------------------------------------------------------------------
6683
6684/\d*\S/B
6685------------------------------------------------------------------
6686        Bra
6687        \d*
6688        \S
6689        Ket
6690        End
6691------------------------------------------------------------------
6692
6693/\d*\w/B
6694------------------------------------------------------------------
6695        Bra
6696        \d*
6697        \w
6698        Ket
6699        End
6700------------------------------------------------------------------
6701
6702/\d*\W/B
6703------------------------------------------------------------------
6704        Bra
6705        \d*+
6706        \W
6707        Ket
6708        End
6709------------------------------------------------------------------
6710
6711/\D*a/B
6712------------------------------------------------------------------
6713        Bra
6714        \D*
6715        a
6716        Ket
6717        End
6718------------------------------------------------------------------
6719
6720/\D*2/B
6721------------------------------------------------------------------
6722        Bra
6723        \D*+
6724        2
6725        Ket
6726        End
6727------------------------------------------------------------------
6728
6729/\D*\d/B
6730------------------------------------------------------------------
6731        Bra
6732        \D*+
6733        \d
6734        Ket
6735        End
6736------------------------------------------------------------------
6737
6738/\D*\D/B
6739------------------------------------------------------------------
6740        Bra
6741        \D*
6742        \D
6743        Ket
6744        End
6745------------------------------------------------------------------
6746
6747/\D*\s/B
6748------------------------------------------------------------------
6749        Bra
6750        \D*
6751        \s
6752        Ket
6753        End
6754------------------------------------------------------------------
6755
6756/\D*\S/B
6757------------------------------------------------------------------
6758        Bra
6759        \D*
6760        \S
6761        Ket
6762        End
6763------------------------------------------------------------------
6764
6765/\D*\w/B
6766------------------------------------------------------------------
6767        Bra
6768        \D*
6769        \w
6770        Ket
6771        End
6772------------------------------------------------------------------
6773
6774/\D*\W/B
6775------------------------------------------------------------------
6776        Bra
6777        \D*
6778        \W
6779        Ket
6780        End
6781------------------------------------------------------------------
6782
6783/\s*a/B
6784------------------------------------------------------------------
6785        Bra
6786        \s*+
6787        a
6788        Ket
6789        End
6790------------------------------------------------------------------
6791
6792/\s*2/B
6793------------------------------------------------------------------
6794        Bra
6795        \s*+
6796        2
6797        Ket
6798        End
6799------------------------------------------------------------------
6800
6801/\s*\d/B
6802------------------------------------------------------------------
6803        Bra
6804        \s*+
6805        \d
6806        Ket
6807        End
6808------------------------------------------------------------------
6809
6810/\s*\D/B
6811------------------------------------------------------------------
6812        Bra
6813        \s*
6814        \D
6815        Ket
6816        End
6817------------------------------------------------------------------
6818
6819/\s*\s/B
6820------------------------------------------------------------------
6821        Bra
6822        \s*
6823        \s
6824        Ket
6825        End
6826------------------------------------------------------------------
6827
6828/\s*\S/B
6829------------------------------------------------------------------
6830        Bra
6831        \s*+
6832        \S
6833        Ket
6834        End
6835------------------------------------------------------------------
6836
6837/\s*\w/B
6838------------------------------------------------------------------
6839        Bra
6840        \s*+
6841        \w
6842        Ket
6843        End
6844------------------------------------------------------------------
6845
6846/\s*\W/B
6847------------------------------------------------------------------
6848        Bra
6849        \s*
6850        \W
6851        Ket
6852        End
6853------------------------------------------------------------------
6854
6855/\S*a/B
6856------------------------------------------------------------------
6857        Bra
6858        \S*
6859        a
6860        Ket
6861        End
6862------------------------------------------------------------------
6863
6864/\S*2/B
6865------------------------------------------------------------------
6866        Bra
6867        \S*
6868        2
6869        Ket
6870        End
6871------------------------------------------------------------------
6872
6873/\S*\d/B
6874------------------------------------------------------------------
6875        Bra
6876        \S*
6877        \d
6878        Ket
6879        End
6880------------------------------------------------------------------
6881
6882/\S*\D/B
6883------------------------------------------------------------------
6884        Bra
6885        \S*
6886        \D
6887        Ket
6888        End
6889------------------------------------------------------------------
6890
6891/\S*\s/B
6892------------------------------------------------------------------
6893        Bra
6894        \S*+
6895        \s
6896        Ket
6897        End
6898------------------------------------------------------------------
6899
6900/\S*\S/B
6901------------------------------------------------------------------
6902        Bra
6903        \S*
6904        \S
6905        Ket
6906        End
6907------------------------------------------------------------------
6908
6909/\S*\w/B
6910------------------------------------------------------------------
6911        Bra
6912        \S*
6913        \w
6914        Ket
6915        End
6916------------------------------------------------------------------
6917
6918/\S*\W/B
6919------------------------------------------------------------------
6920        Bra
6921        \S*
6922        \W
6923        Ket
6924        End
6925------------------------------------------------------------------
6926
6927/\w*a/B
6928------------------------------------------------------------------
6929        Bra
6930        \w*
6931        a
6932        Ket
6933        End
6934------------------------------------------------------------------
6935
6936/\w*2/B
6937------------------------------------------------------------------
6938        Bra
6939        \w*
6940        2
6941        Ket
6942        End
6943------------------------------------------------------------------
6944
6945/\w*\d/B
6946------------------------------------------------------------------
6947        Bra
6948        \w*
6949        \d
6950        Ket
6951        End
6952------------------------------------------------------------------
6953
6954/\w*\D/B
6955------------------------------------------------------------------
6956        Bra
6957        \w*
6958        \D
6959        Ket
6960        End
6961------------------------------------------------------------------
6962
6963/\w*\s/B
6964------------------------------------------------------------------
6965        Bra
6966        \w*+
6967        \s
6968        Ket
6969        End
6970------------------------------------------------------------------
6971
6972/\w*\S/B
6973------------------------------------------------------------------
6974        Bra
6975        \w*
6976        \S
6977        Ket
6978        End
6979------------------------------------------------------------------
6980
6981/\w*\w/B
6982------------------------------------------------------------------
6983        Bra
6984        \w*
6985        \w
6986        Ket
6987        End
6988------------------------------------------------------------------
6989
6990/\w*\W/B
6991------------------------------------------------------------------
6992        Bra
6993        \w*+
6994        \W
6995        Ket
6996        End
6997------------------------------------------------------------------
6998
6999/\W*a/B
7000------------------------------------------------------------------
7001        Bra
7002        \W*+
7003        a
7004        Ket
7005        End
7006------------------------------------------------------------------
7007
7008/\W*2/B
7009------------------------------------------------------------------
7010        Bra
7011        \W*+
7012        2
7013        Ket
7014        End
7015------------------------------------------------------------------
7016
7017/\W*\d/B
7018------------------------------------------------------------------
7019        Bra
7020        \W*+
7021        \d
7022        Ket
7023        End
7024------------------------------------------------------------------
7025
7026/\W*\D/B
7027------------------------------------------------------------------
7028        Bra
7029        \W*
7030        \D
7031        Ket
7032        End
7033------------------------------------------------------------------
7034
7035/\W*\s/B
7036------------------------------------------------------------------
7037        Bra
7038        \W*
7039        \s
7040        Ket
7041        End
7042------------------------------------------------------------------
7043
7044/\W*\S/B
7045------------------------------------------------------------------
7046        Bra
7047        \W*
7048        \S
7049        Ket
7050        End
7051------------------------------------------------------------------
7052
7053/\W*\w/B
7054------------------------------------------------------------------
7055        Bra
7056        \W*+
7057        \w
7058        Ket
7059        End
7060------------------------------------------------------------------
7061
7062/\W*\W/B
7063------------------------------------------------------------------
7064        Bra
7065        \W*
7066        \W
7067        Ket
7068        End
7069------------------------------------------------------------------
7070
7071/[^a]+a/B
7072------------------------------------------------------------------
7073        Bra
7074        [^a]++
7075        a
7076        Ket
7077        End
7078------------------------------------------------------------------
7079
7080/[^a]+a/Bi
7081------------------------------------------------------------------
7082        Bra
7083     /i [^a]++
7084     /i a
7085        Ket
7086        End
7087------------------------------------------------------------------
7088
7089/[^a]+A/Bi
7090------------------------------------------------------------------
7091        Bra
7092     /i [^a]++
7093     /i A
7094        Ket
7095        End
7096------------------------------------------------------------------
7097
7098/[^a]+b/B
7099------------------------------------------------------------------
7100        Bra
7101        [^a]+
7102        b
7103        Ket
7104        End
7105------------------------------------------------------------------
7106
7107/[^a]+\d/B
7108------------------------------------------------------------------
7109        Bra
7110        [^a]+
7111        \d
7112        Ket
7113        End
7114------------------------------------------------------------------
7115
7116/a*[^a]/B
7117------------------------------------------------------------------
7118        Bra
7119        a*+
7120        [^a]
7121        Ket
7122        End
7123------------------------------------------------------------------
7124
7125/(?P<abc>x)(?P<xyz>y)/I
7126Capture group count = 2
7127Named capture groups:
7128  abc   1
7129  xyz   2
7130First code unit = 'x'
7131Last code unit = 'y'
7132Subject length lower bound = 2
7133    xy\=copy=abc,copy=xyz
7134 0: xy
7135 1: x
7136 2: y
7137  C x (1) abc (group 1)
7138  C y (1) xyz (group 2)
7139
7140/(?<abc>x)(?'xyz'y)/I
7141Capture group count = 2
7142Named capture groups:
7143  abc   1
7144  xyz   2
7145First code unit = 'x'
7146Last code unit = 'y'
7147Subject length lower bound = 2
7148    xy\=copy=abc,copy=xyz
7149 0: xy
7150 1: x
7151 2: y
7152  C x (1) abc (group 1)
7153  C y (1) xyz (group 2)
7154
7155/(?<abc'x)(?'xyz'y)/I
7156Failed: error 142 at offset 6: syntax error in subpattern name (missing terminator?)
7157
7158/(?<abc>x)(?'xyz>y)/I
7159Failed: error 142 at offset 15: syntax error in subpattern name (missing terminator?)
7160
7161/(?P'abc'x)(?P<xyz>y)/I
7162Failed: error 141 at offset 3: unrecognized character after (?P
7163
7164/^(?:(?(ZZ)a|b)(?<ZZ>X))+/
7165    bXaX
7166 0: bXaX
7167 1: X
7168    bXbX
7169 0: bX
7170 1: X
7171\= Expect no match
7172    aXaX
7173No match
7174    aXbX
7175No match
7176
7177/^(?P>abc)(?<abcd>xxx)/
7178Failed: error 115 at offset 5: reference to non-existent subpattern
7179
7180/^(?P>abc)(?<abc>x|y)/
7181    xx
7182 0: xx
7183 1: x
7184    xy
7185 0: xy
7186 1: y
7187    yy
7188 0: yy
7189 1: y
7190    yx
7191 0: yx
7192 1: x
7193
7194/^(?P>abc)(?P<abc>x|y)/
7195    xx
7196 0: xx
7197 1: x
7198    xy
7199 0: xy
7200 1: y
7201    yy
7202 0: yy
7203 1: y
7204    yx
7205 0: yx
7206 1: x
7207
7208/^((?(abc)a|b)(?<abc>x|y))+/
7209    bxay
7210 0: bxay
7211 1: ay
7212 2: y
7213    bxby
7214 0: bx
7215 1: bx
7216 2: x
7217\= Expect no match
7218    axby
7219No match
7220
7221/^(((?P=abc)|X)(?<abc>x|y))+/
7222    XxXxxx
7223 0: XxXxxx
7224 1: xx
7225 2: x
7226 3: x
7227    XxXyyx
7228 0: XxXyyx
7229 1: yx
7230 2: y
7231 3: x
7232    XxXyxx
7233 0: XxXy
7234 1: Xy
7235 2: X
7236 3: y
7237\= Expect no match
7238    x
7239No match
7240
7241/^(?1)(abc)/
7242    abcabc
7243 0: abcabc
7244 1: abc
7245
7246/^(?:(?:\1|X)(a|b))+/
7247    Xaaa
7248 0: Xaaa
7249 1: a
7250    Xaba
7251 0: Xa
7252 1: a
7253
7254/^[\E\Qa\E-\Qz\E]+/B
7255------------------------------------------------------------------
7256        Bra
7257        ^
7258        [a-z]++
7259        Ket
7260        End
7261------------------------------------------------------------------
7262
7263/^[a\Q]bc\E]/B
7264------------------------------------------------------------------
7265        Bra
7266        ^
7267        [\]a-c]
7268        Ket
7269        End
7270------------------------------------------------------------------
7271
7272/^[a-\Q\E]/B
7273------------------------------------------------------------------
7274        Bra
7275        ^
7276        [\-a]
7277        Ket
7278        End
7279------------------------------------------------------------------
7280
7281/^(?P>abc)[()](?<abc>)/B
7282------------------------------------------------------------------
7283        Bra
7284        ^
7285        Recurse
7286        [()]
7287        CBra 1
7288        Ket
7289        Ket
7290        End
7291------------------------------------------------------------------
7292
7293/^((?(abc)y)[()](?P<abc>x))+/B
7294------------------------------------------------------------------
7295        Bra
7296        ^
7297        CBra 1
7298        Cond
7299      2 Cond ref
7300        y
7301        Ket
7302        [()]
7303        CBra 2
7304        x
7305        Ket
7306        KetRmax
7307        Ket
7308        End
7309------------------------------------------------------------------
7310    (xy)x
7311 0: (xy)x
7312 1: y)x
7313 2: x
7314
7315/^(?P>abc)\Q()\E(?<abc>)/B
7316------------------------------------------------------------------
7317        Bra
7318        ^
7319        Recurse
7320        ()
7321        CBra 1
7322        Ket
7323        Ket
7324        End
7325------------------------------------------------------------------
7326
7327/^(?P>abc)[a\Q(]\E(](?<abc>)/B
7328------------------------------------------------------------------
7329        Bra
7330        ^
7331        Recurse
7332        [(\]a]
7333        CBra 1
7334        Ket
7335        Ket
7336        End
7337------------------------------------------------------------------
7338
7339/^(?P>abc) # this is (a comment)
7340  (?<abc>)/Bx
7341------------------------------------------------------------------
7342        Bra
7343        ^
7344        Recurse
7345        CBra 1
7346        Ket
7347        Ket
7348        End
7349------------------------------------------------------------------
7350
7351/^\W*(?:(?<one>(?<two>.)\W*(?&one)\W*\k<two>|)|(?<three>(?<four>.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii
7352Capture group count = 4
7353Max back reference = 4
7354Named capture groups:
7355  four    4
7356  one     1
7357  three   3
7358  two     2
7359May match empty string
7360Compile options: caseless
7361Overall options: anchored caseless
7362Subject length lower bound = 0
7363    1221
7364 0: 1221
7365 1: 1221
7366 2: 1
7367    Satan, oscillate my metallic sonatas!
7368 0: Satan, oscillate my metallic sonatas!
7369 1: <unset>
7370 2: <unset>
7371 3: Satan, oscillate my metallic sonatas
7372 4: S
7373    A man, a plan, a canal: Panama!
7374 0: A man, a plan, a canal: Panama!
7375 1: <unset>
7376 2: <unset>
7377 3: A man, a plan, a canal: Panama
7378 4: A
7379    Able was I ere I saw Elba.
7380 0: Able was I ere I saw Elba.
7381 1: <unset>
7382 2: <unset>
7383 3: Able was I ere I saw Elba
7384 4: A
7385\= Expect no match
7386    The quick brown fox
7387No match
7388
7389/(?=(\w+))\1:/I
7390Capture group count = 1
7391Max back reference = 1
7392Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
7393  Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
7394Last code unit = ':'
7395Subject length lower bound = 2
7396    abcd:
7397 0: abcd:
7398 1: abcd
7399
7400/(?=(?'abc'\w+))\k<abc>:/I
7401Capture group count = 1
7402Max back reference = 1
7403Named capture groups:
7404  abc   1
7405Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
7406  Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
7407Last code unit = ':'
7408Subject length lower bound = 2
7409    abcd:
7410 0: abcd:
7411 1: abcd
7412
7413/(?'abc'a|b)(?<abc>d|e)\k<abc>{2}/dupnames
7414    adaa
7415 0: adaa
7416 1: a
7417 2: d
7418\= Expect no match
7419    addd
7420No match
7421    adbb
7422No match
7423
7424/(?'abc'a|b)(?<abc>d|e)(?&abc){2}/dupnames
7425    bdaa
7426 0: bdaa
7427 1: b
7428 2: d
7429    bdab
7430 0: bdab
7431 1: b
7432 2: d
7433\= Expect no match
7434    bddd
7435No match
7436
7437/(?(<bc))/
7438Failed: error 142 at offset 6: syntax error in subpattern name (missing terminator?)
7439
7440/(?(''))/
7441Failed: error 162 at offset 4: subpattern name expected
7442
7443/(?('R')stuff)/
7444Failed: error 115 at offset 4: reference to non-existent subpattern
7445
7446/((abc (?(R) (?(R1)1) (?(R2)2) X  |  (?1)  (?2)   (?R) ))) /x
7447    abcabc1Xabc2XabcXabcabc
7448 0: abcabc1Xabc2XabcX
7449 1: abcabc1Xabc2XabcX
7450 2: abcabc1Xabc2XabcX
7451
7452/(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
7453    abcabc1Xabc2XabcXabcabc
7454 0: abcabc1Xabc2XabcX
7455 1: abcabc1Xabc2XabcX
7456 2: abcabc1Xabc2XabcX
7457
7458/(?<A> (?'B' abc (?(R) (?(R&C)1) (?(R&B)2) X  |  (?1)  (?2)   (?R) ))) /x
7459Failed: error 115 at offset 27: reference to non-existent subpattern
7460
7461/^(?(DEFINE) abc | xyz ) /x
7462Failed: error 154 at offset 4: DEFINE subpattern contains more than one branch
7463
7464/(?(DEFINE) abc) xyz/Ix
7465Capture group count = 0
7466Options: extended
7467First code unit = 'x'
7468Last code unit = 'z'
7469Subject length lower bound = 3
7470
7471/(a|)*\d/
7472  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4\=ovector=0
7473 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
7474 1:
7475\= Expect no match
7476  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=0
7477No match
7478
7479/^a.b/newline=lf
7480    a\rb
7481 0: a\x0db
7482\= Expect no match
7483    a\nb
7484No match
7485
7486/^a.b/newline=cr
7487    a\nb
7488 0: a\x0ab
7489\= Expect no match
7490    a\rb
7491No match
7492
7493/^a.b/newline=anycrlf
7494    a\x85b
7495 0: a\x85b
7496\= Expect no match
7497    a\rb
7498No match
7499
7500/^a.b/newline=any
7501\= Expect no match
7502    a\nb
7503No match
7504    a\rb
7505No match
7506    a\x85b
7507No match
7508
7509/^abc./gmx,newline=any
7510    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
7511 0: abc1
7512 0: abc2
7513 0: abc3
7514 0: abc4
7515 0: abc5
7516 0: abc6
7517 0: abc7
7518
7519/abc.$/gmx,newline=any
7520    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7 abc9
7521 0: abc1
7522 0: abc2
7523 0: abc3
7524 0: abc4
7525 0: abc5
7526 0: abc6
7527 0: abc9
7528
7529/^a\Rb/bsr=unicode
7530    a\nb
7531 0: a\x0ab
7532    a\rb
7533 0: a\x0db
7534    a\r\nb
7535 0: a\x0d\x0ab
7536    a\x0bb
7537 0: a\x0bb
7538    a\x0cb
7539 0: a\x0cb
7540    a\x85b
7541 0: a\x85b
7542\= Expect no match
7543    a\n\rb
7544No match
7545
7546/^a\R*b/bsr=unicode
7547    ab
7548 0: ab
7549    a\nb
7550 0: a\x0ab
7551    a\rb
7552 0: a\x0db
7553    a\r\nb
7554 0: a\x0d\x0ab
7555    a\x0bb
7556 0: a\x0bb
7557    a\x0cb
7558 0: a\x0cb
7559    a\x85b
7560 0: a\x85b
7561    a\n\rb
7562 0: a\x0a\x0db
7563    a\n\r\x85\x0cb
7564 0: a\x0a\x0d\x85\x0cb
7565
7566/^a\R+b/bsr=unicode
7567    a\nb
7568 0: a\x0ab
7569    a\rb
7570 0: a\x0db
7571    a\r\nb
7572 0: a\x0d\x0ab
7573    a\x0bb
7574 0: a\x0bb
7575    a\x0cb
7576 0: a\x0cb
7577    a\x85b
7578 0: a\x85b
7579    a\n\rb
7580 0: a\x0a\x0db
7581    a\n\r\x85\x0cb
7582 0: a\x0a\x0d\x85\x0cb
7583\= Expect no match
7584    ab
7585No match
7586
7587/^a\R{1,3}b/bsr=unicode
7588    a\nb
7589 0: a\x0ab
7590    a\n\rb
7591 0: a\x0a\x0db
7592    a\n\r\x85b
7593 0: a\x0a\x0d\x85b
7594    a\r\n\r\nb
7595 0: a\x0d\x0a\x0d\x0ab
7596    a\r\n\r\n\r\nb
7597 0: a\x0d\x0a\x0d\x0a\x0d\x0ab
7598    a\n\r\n\rb
7599 0: a\x0a\x0d\x0a\x0db
7600    a\n\n\r\nb
7601 0: a\x0a\x0a\x0d\x0ab
7602\= Expect no match
7603    a\n\n\n\rb
7604No match
7605    a\r
7606No match
7607
7608/(?&abc)X(?<abc>P)/I
7609Capture group count = 1
7610Named capture groups:
7611  abc   1
7612Last code unit = 'P'
7613Subject length lower bound = 3
7614    abcPXP123
7615 0: PXP
7616 1: P
7617
7618/(?1)X(?<abc>P)/I
7619Capture group count = 1
7620Named capture groups:
7621  abc   1
7622Last code unit = 'P'
7623Subject length lower bound = 3
7624    abcPXP123
7625 0: PXP
7626 1: P
7627
7628/(?:a(?&abc)b)*(?<abc>x)/
7629    123axbaxbaxbx456
7630 0: axbaxbaxbx
7631 1: x
7632    123axbaxbaxb456
7633 0: x
7634 1: x
7635
7636/(?:a(?&abc)b){1,5}(?<abc>x)/
7637    123axbaxbaxbx456
7638 0: axbaxbaxbx
7639 1: x
7640
7641/(?:a(?&abc)b){2,5}(?<abc>x)/
7642    123axbaxbaxbx456
7643 0: axbaxbaxbx
7644 1: x
7645
7646/(?:a(?&abc)b){2,}(?<abc>x)/
7647    123axbaxbaxbx456
7648 0: axbaxbaxbx
7649 1: x
7650
7651/(abc)(?i:(?1))/
7652    defabcabcxyz
7653 0: abcabc
7654 1: abc
7655\= Expect no match
7656    DEFabcABCXYZ
7657No match
7658
7659/(abc)(?:(?i)(?1))/
7660    defabcabcxyz
7661 0: abcabc
7662 1: abc
7663\= Expect no match
7664    DEFabcABCXYZ
7665No match
7666
7667/^(a)\g-2/
7668Failed: error 115 at offset 8: reference to non-existent subpattern
7669
7670/^(a)\g/
7671Failed: error 157 at offset 6: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
7672
7673/^(a)\g{0}/
7674Failed: error 115 at offset 9: reference to non-existent subpattern
7675
7676/^(a)\g{3/
7677Failed: error 157 at offset 6: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
7678
7679/^(a)\g{aa}/
7680Failed: error 115 at offset 7: reference to non-existent subpattern
7681
7682/^a.b/newline=lf
7683    a\rb
7684 0: a\x0db
7685\= Expect no match
7686    a\nb
7687No match
7688
7689/.+foo/
7690    afoo
7691 0: afoo
7692\= Expect no match
7693    \r\nfoo
7694No match
7695    \nfoo
7696No match
7697
7698/.+foo/newline=crlf
7699    afoo
7700 0: afoo
7701    \nfoo
7702 0: \x0afoo
7703\= Expect no match
7704    \r\nfoo
7705No match
7706
7707/.+foo/newline=any
7708    afoo
7709 0: afoo
7710\= Expect no match
7711    \nfoo
7712No match
7713    \r\nfoo
7714No match
7715
7716/.+foo/s
7717    afoo
7718 0: afoo
7719    \r\nfoo
7720 0: \x0d\x0afoo
7721    \nfoo
7722 0: \x0afoo
7723
7724/^$/gm,newline=any
7725    abc\r\rxyz
7726 0:
7727    abc\n\rxyz
7728 0:
7729\= Expect no match
7730    abc\r\nxyz
7731No match
7732
7733/(?m)^$/g,newline=any,aftertext
7734    abc\r\n\r\n
7735 0:
7736 0+ \x0d\x0a
7737
7738/(?m)^$|^\r\n/g,newline=any,aftertext
7739    abc\r\n\r\n
7740 0:
7741 0+ \x0d\x0a
7742 0: \x0d\x0a
7743 0+
7744
7745/(?m)$/g,newline=any,aftertext
7746    abc\r\n\r\n
7747 0:
7748 0+ \x0d\x0a\x0d\x0a
7749 0:
7750 0+ \x0d\x0a
7751 0:
7752 0+
7753
7754/abc.$/gmx,newline=anycrlf
7755    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
7756 0: abc1
7757 0: abc4
7758 0: abc5
7759 0: abc9
7760
7761/^X/m
7762    XABC
7763 0: X
7764\= Expect no match
7765    XABC\=notbol
7766No match
7767
7768/(ab|c)(?-1)/B
7769------------------------------------------------------------------
7770        Bra
7771        CBra 1
7772        ab
7773        Alt
7774        c
7775        Ket
7776        Recurse
7777        Ket
7778        End
7779------------------------------------------------------------------
7780    abc
7781 0: abc
7782 1: ab
7783
7784/xy(?+1)(abc)/B
7785------------------------------------------------------------------
7786        Bra
7787        xy
7788        Recurse
7789        CBra 1
7790        abc
7791        Ket
7792        Ket
7793        End
7794------------------------------------------------------------------
7795    xyabcabc
7796 0: xyabcabc
7797 1: abc
7798\= Expect no match
7799    xyabc
7800No match
7801
7802/x(?-0)y/
7803Failed: error 126 at offset 5: a relative value of zero is not allowed
7804
7805/x(?-1)y/
7806Failed: error 115 at offset 5: reference to non-existent subpattern
7807
7808/x(?+0)y/
7809Failed: error 126 at offset 5: a relative value of zero is not allowed
7810
7811/x(?+1)y/
7812Failed: error 115 at offset 5: reference to non-existent subpattern
7813
7814/^(abc)?(?(-1)X|Y)/B
7815------------------------------------------------------------------
7816        Bra
7817        ^
7818        Brazero
7819        CBra 1
7820        abc
7821        Ket
7822        Cond
7823      1 Cond ref
7824        X
7825        Alt
7826        Y
7827        Ket
7828        Ket
7829        End
7830------------------------------------------------------------------
7831    abcX
7832 0: abcX
7833 1: abc
7834    Y
7835 0: Y
7836\= Expect no match
7837    abcY
7838No match
7839
7840/^((?(+1)X|Y)(abc))+/B
7841------------------------------------------------------------------
7842        Bra
7843        ^
7844        CBra 1
7845        Cond
7846      2 Cond ref
7847        X
7848        Alt
7849        Y
7850        Ket
7851        CBra 2
7852        abc
7853        Ket
7854        KetRmax
7855        Ket
7856        End
7857------------------------------------------------------------------
7858    YabcXabc
7859 0: YabcXabc
7860 1: Xabc
7861 2: abc
7862    YabcXabcXabc
7863 0: YabcXabcXabc
7864 1: Xabc
7865 2: abc
7866\= Expect no match
7867    XabcXabc
7868No match
7869
7870/(?(-1)a)/B
7871Failed: error 115 at offset 5: reference to non-existent subpattern
7872
7873/((?(-1)a))/B
7874------------------------------------------------------------------
7875        Bra
7876        CBra 1
7877        Cond
7878      1 Cond ref
7879        a
7880        Ket
7881        Ket
7882        Ket
7883        End
7884------------------------------------------------------------------
7885
7886/((?(-2)a))/B
7887Failed: error 115 at offset 6: reference to non-existent subpattern
7888
7889/^(?(+1)X|Y)(.)/B
7890------------------------------------------------------------------
7891        Bra
7892        ^
7893        Cond
7894      1 Cond ref
7895        X
7896        Alt
7897        Y
7898        Ket
7899        CBra 1
7900        Any
7901        Ket
7902        Ket
7903        End
7904------------------------------------------------------------------
7905    Y!
7906 0: Y!
7907 1: !
7908
7909/(?<A>tom|bon)-\k{A}/
7910    tom-tom
7911 0: tom-tom
7912 1: tom
7913    bon-bon
7914 0: bon-bon
7915 1: bon
7916\= Expect no match
7917    tom-bon
7918No match
7919
7920/\g{A/
7921Failed: error 142 at offset 4: syntax error in subpattern name (missing terminator?)
7922
7923/(?|(abc)|(xyz))/B
7924------------------------------------------------------------------
7925        Bra
7926        Bra
7927        CBra 1
7928        abc
7929        Ket
7930        Alt
7931        CBra 1
7932        xyz
7933        Ket
7934        Ket
7935        Ket
7936        End
7937------------------------------------------------------------------
7938   >abc<
7939 0: abc
7940 1: abc
7941   >xyz<
7942 0: xyz
7943 1: xyz
7944
7945/(x)(?|(abc)|(xyz))(x)/B
7946------------------------------------------------------------------
7947        Bra
7948        CBra 1
7949        x
7950        Ket
7951        Bra
7952        CBra 2
7953        abc
7954        Ket
7955        Alt
7956        CBra 2
7957        xyz
7958        Ket
7959        Ket
7960        CBra 3
7961        x
7962        Ket
7963        Ket
7964        End
7965------------------------------------------------------------------
7966    xabcx
7967 0: xabcx
7968 1: x
7969 2: abc
7970 3: x
7971    xxyzx
7972 0: xxyzx
7973 1: x
7974 2: xyz
7975 3: x
7976
7977/(x)(?|(abc)(pqr)|(xyz))(x)/B
7978------------------------------------------------------------------
7979        Bra
7980        CBra 1
7981        x
7982        Ket
7983        Bra
7984        CBra 2
7985        abc
7986        Ket
7987        CBra 3
7988        pqr
7989        Ket
7990        Alt
7991        CBra 2
7992        xyz
7993        Ket
7994        Ket
7995        CBra 4
7996        x
7997        Ket
7998        Ket
7999        End
8000------------------------------------------------------------------
8001    xabcpqrx
8002 0: xabcpqrx
8003 1: x
8004 2: abc
8005 3: pqr
8006 4: x
8007    xxyzx
8008 0: xxyzx
8009 1: x
8010 2: xyz
8011 3: <unset>
8012 4: x
8013
8014/\H++X/B
8015------------------------------------------------------------------
8016        Bra
8017        \H++
8018        X
8019        Ket
8020        End
8021------------------------------------------------------------------
8022\= Expect no match
8023    XXXX
8024No match
8025
8026/\H+\hY/B
8027------------------------------------------------------------------
8028        Bra
8029        \H++
8030        \h
8031        Y
8032        Ket
8033        End
8034------------------------------------------------------------------
8035    XXXX Y
8036 0: XXXX Y
8037
8038/\H+ Y/B
8039------------------------------------------------------------------
8040        Bra
8041        \H++
8042         Y
8043        Ket
8044        End
8045------------------------------------------------------------------
8046
8047/\h+A/B
8048------------------------------------------------------------------
8049        Bra
8050        \h++
8051        A
8052        Ket
8053        End
8054------------------------------------------------------------------
8055
8056/\v*B/B
8057------------------------------------------------------------------
8058        Bra
8059        \v*+
8060        B
8061        Ket
8062        End
8063------------------------------------------------------------------
8064
8065/\V+\x0a/B
8066------------------------------------------------------------------
8067        Bra
8068        \V++
8069        \x0a
8070        Ket
8071        End
8072------------------------------------------------------------------
8073
8074/A+\h/B
8075------------------------------------------------------------------
8076        Bra
8077        A++
8078        \h
8079        Ket
8080        End
8081------------------------------------------------------------------
8082
8083/ *\H/B
8084------------------------------------------------------------------
8085        Bra
8086         *+
8087        \H
8088        Ket
8089        End
8090------------------------------------------------------------------
8091
8092/A*\v/B
8093------------------------------------------------------------------
8094        Bra
8095        A*+
8096        \v
8097        Ket
8098        End
8099------------------------------------------------------------------
8100
8101/\x0b*\V/B
8102------------------------------------------------------------------
8103        Bra
8104        \x0b*+
8105        \V
8106        Ket
8107        End
8108------------------------------------------------------------------
8109
8110/\d+\h/B
8111------------------------------------------------------------------
8112        Bra
8113        \d++
8114        \h
8115        Ket
8116        End
8117------------------------------------------------------------------
8118
8119/\d*\v/B
8120------------------------------------------------------------------
8121        Bra
8122        \d*+
8123        \v
8124        Ket
8125        End
8126------------------------------------------------------------------
8127
8128/S+\h\S+\v/B
8129------------------------------------------------------------------
8130        Bra
8131        S++
8132        \h
8133        \S++
8134        \v
8135        Ket
8136        End
8137------------------------------------------------------------------
8138
8139/\w{3,}\h\w+\v/B
8140------------------------------------------------------------------
8141        Bra
8142        \w{3}
8143        \w*+
8144        \h
8145        \w++
8146        \v
8147        Ket
8148        End
8149------------------------------------------------------------------
8150
8151/\h+\d\h+\w\h+\S\h+\H/B
8152------------------------------------------------------------------
8153        Bra
8154        \h++
8155        \d
8156        \h++
8157        \w
8158        \h++
8159        \S
8160        \h++
8161        \H
8162        Ket
8163        End
8164------------------------------------------------------------------
8165
8166/\v+\d\v+\w\v+\S\v+\V/B
8167------------------------------------------------------------------
8168        Bra
8169        \v++
8170        \d
8171        \v++
8172        \w
8173        \v++
8174        \S
8175        \v++
8176        \V
8177        Ket
8178        End
8179------------------------------------------------------------------
8180
8181/\H+\h\H+\d/B
8182------------------------------------------------------------------
8183        Bra
8184        \H++
8185        \h
8186        \H+
8187        \d
8188        Ket
8189        End
8190------------------------------------------------------------------
8191
8192/\V+\v\V+\w/B
8193------------------------------------------------------------------
8194        Bra
8195        \V++
8196        \v
8197        \V+
8198        \w
8199        Ket
8200        End
8201------------------------------------------------------------------
8202
8203/\( (?: [^()]* | (?R) )* \)/x
8204(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(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
8205 0: (0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(0(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)
8206
8207/[\E]AAA/
8208Failed: error 106 at offset 7: missing terminating ] for character class
8209
8210/[\Q\E]AAA/
8211Failed: error 106 at offset 9: missing terminating ] for character class
8212
8213/[^\E]AAA/
8214Failed: error 106 at offset 8: missing terminating ] for character class
8215
8216/[^\Q\E]AAA/
8217Failed: error 106 at offset 10: missing terminating ] for character class
8218
8219/[\E^]AAA/
8220Failed: error 106 at offset 8: missing terminating ] for character class
8221
8222/[\Q\E^]AAA/
8223Failed: error 106 at offset 10: missing terminating ] for character class
8224
8225/A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/B
8226------------------------------------------------------------------
8227        Bra
8228        A
8229        *PRUNE
8230        B
8231        *SKIP
8232        C
8233        *THEN
8234        D
8235        *COMMIT
8236        E
8237        *FAIL
8238        F
8239        *FAIL
8240        G
8241        *FAIL
8242        H
8243        *ACCEPT
8244        I
8245        Ket
8246        End
8247------------------------------------------------------------------
8248
8249/^a+(*FAIL)/auto_callout
8250\= Expect no match
8251    aaaaaa
8252--->aaaaaa
8253 +0 ^          ^
8254 +1 ^          a+
8255 +3 ^     ^    (*FAIL)
8256 +3 ^    ^     (*FAIL)
8257 +3 ^   ^      (*FAIL)
8258 +3 ^  ^       (*FAIL)
8259 +3 ^ ^        (*FAIL)
8260 +3 ^^         (*FAIL)
8261No match
8262
8263/a+b?c+(*FAIL)/auto_callout
8264\= Expect no match
8265    aaabccc
8266--->aaabccc
8267 +0 ^           a+
8268 +2 ^  ^        b?
8269 +4 ^   ^       c+
8270 +6 ^      ^    (*FAIL)
8271 +6 ^     ^     (*FAIL)
8272 +6 ^    ^      (*FAIL)
8273 +0  ^          a+
8274 +2  ^ ^        b?
8275 +4  ^  ^       c+
8276 +6  ^     ^    (*FAIL)
8277 +6  ^    ^     (*FAIL)
8278 +6  ^   ^      (*FAIL)
8279 +0   ^         a+
8280 +2   ^^        b?
8281 +4   ^ ^       c+
8282 +6   ^    ^    (*FAIL)
8283 +6   ^   ^     (*FAIL)
8284 +6   ^  ^      (*FAIL)
8285No match
8286
8287/a+b?(*PRUNE)c+(*FAIL)/auto_callout
8288\= Expect no match
8289    aaabccc
8290--->aaabccc
8291 +0 ^           a+
8292 +2 ^  ^        b?
8293 +4 ^   ^       (*PRUNE)
8294+12 ^   ^       c+
8295+14 ^      ^    (*FAIL)
8296+14 ^     ^     (*FAIL)
8297+14 ^    ^      (*FAIL)
8298 +0  ^          a+
8299 +2  ^ ^        b?
8300 +4  ^  ^       (*PRUNE)
8301+12  ^  ^       c+
8302+14  ^     ^    (*FAIL)
8303+14  ^    ^     (*FAIL)
8304+14  ^   ^      (*FAIL)
8305 +0   ^         a+
8306 +2   ^^        b?
8307 +4   ^ ^       (*PRUNE)
8308+12   ^ ^       c+
8309+14   ^    ^    (*FAIL)
8310+14   ^   ^     (*FAIL)
8311+14   ^  ^      (*FAIL)
8312No match
8313
8314/a+b?(*COMMIT)c+(*FAIL)/auto_callout
8315\= Expect no match
8316    aaabccc
8317--->aaabccc
8318 +0 ^           a+
8319 +2 ^  ^        b?
8320 +4 ^   ^       (*COMMIT)
8321+13 ^   ^       c+
8322+15 ^      ^    (*FAIL)
8323+15 ^     ^     (*FAIL)
8324+15 ^    ^      (*FAIL)
8325No match
8326
8327/a+b?(*SKIP)c+(*FAIL)/auto_callout
8328\= Expect no match
8329    aaabcccaaabccc
8330--->aaabcccaaabccc
8331 +0 ^                  a+
8332 +2 ^  ^               b?
8333 +4 ^   ^              (*SKIP)
8334+11 ^   ^              c+
8335+13 ^      ^           (*FAIL)
8336+13 ^     ^            (*FAIL)
8337+13 ^    ^             (*FAIL)
8338 +0        ^           a+
8339 +2        ^  ^        b?
8340 +4        ^   ^       (*SKIP)
8341+11        ^   ^       c+
8342+13        ^      ^    (*FAIL)
8343+13        ^     ^     (*FAIL)
8344+13        ^    ^      (*FAIL)
8345No match
8346
8347/a+b?(*THEN)c+(*FAIL)/auto_callout
8348\= Expect no match
8349    aaabccc
8350--->aaabccc
8351 +0 ^           a+
8352 +2 ^  ^        b?
8353 +4 ^   ^       (*THEN)
8354+11 ^   ^       c+
8355+13 ^      ^    (*FAIL)
8356+13 ^     ^     (*FAIL)
8357+13 ^    ^      (*FAIL)
8358 +0  ^          a+
8359 +2  ^ ^        b?
8360 +4  ^  ^       (*THEN)
8361+11  ^  ^       c+
8362+13  ^     ^    (*FAIL)
8363+13  ^    ^     (*FAIL)
8364+13  ^   ^      (*FAIL)
8365 +0   ^         a+
8366 +2   ^^        b?
8367 +4   ^ ^       (*THEN)
8368+11   ^ ^       c+
8369+13   ^    ^    (*FAIL)
8370+13   ^   ^     (*FAIL)
8371+13   ^  ^      (*FAIL)
8372No match
8373
8374/a(*MARK)b/
8375Failed: error 166 at offset 7: (*MARK) must have an argument
8376
8377/(?i:A{1,}\6666666666)/
8378Failed: error 161 at offset 19: subpattern number is too big
8379
8380/\g6666666666/
8381Failed: error 161 at offset 7: subpattern number is too big
8382
8383/[\g6666666666]/B
8384------------------------------------------------------------------
8385        Bra
8386        [6g]
8387        Ket
8388        End
8389------------------------------------------------------------------
8390
8391/(?1)\c[/
8392Failed: error 115 at offset 3: reference to non-existent subpattern
8393
8394/.+A/newline=crlf
8395\= Expect no match
8396    \r\nA
8397No match
8398
8399/\nA/newline=crlf
8400    \r\nA
8401 0: \x0aA
8402
8403/[\r\n]A/newline=crlf
8404    \r\nA
8405 0: \x0aA
8406
8407/(\r|\n)A/newline=crlf
8408    \r\nA
8409 0: \x0aA
8410 1: \x0a
8411
8412/a(*CR)b/
8413Failed: error 160 at offset 5: (*VERB) not recognized or malformed
8414
8415/(*CR)a.b/
8416    a\nb
8417 0: a\x0ab
8418\= Expect no match
8419    a\rb
8420No match
8421
8422/(*CR)a.b/newline=lf
8423    a\nb
8424 0: a\x0ab
8425\= Expect no match
8426    a\rb
8427No match
8428
8429/(*LF)a.b/newline=CRLF
8430    a\rb
8431 0: a\x0db
8432\= Expect no match
8433    a\nb
8434No match
8435
8436/(*CRLF)a.b/
8437    a\rb
8438 0: a\x0db
8439    a\nb
8440 0: a\x0ab
8441\= Expect no match
8442    a\r\nb
8443No match
8444
8445/(*ANYCRLF)a.b/newline=CR
8446\= Expect no match
8447    a\rb
8448No match
8449    a\nb
8450No match
8451    a\r\nb
8452No match
8453
8454/(*ANY)a.b/newline=cr
8455\= Expect no match
8456    a\rb
8457No match
8458    a\nb
8459No match
8460    a\r\nb
8461No match
8462    a\x85b
8463No match
8464
8465/(*ANY).*/g
8466    abc\r\ndef
8467 0: abc
8468 0:
8469 0: def
8470 0:
8471
8472/(*ANYCRLF).*/g
8473    abc\r\ndef
8474 0: abc
8475 0:
8476 0: def
8477 0:
8478
8479/(*CRLF).*/g
8480    abc\r\ndef
8481 0: abc
8482 0:
8483 0: def
8484 0:
8485
8486/(*NUL)^.*/
8487    a\nb\x00ccc
8488 0: a\x0ab
8489
8490/(*NUL)^.*/s
8491    a\nb\x00ccc
8492 0: a\x0ab\x00ccc
8493
8494/^x/m,newline=NUL
8495    ab\x00xy
8496 0: x
8497
8498/'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex
8499    x\nyz
8500 0: x\x0ay
8501
8502/(*NUL)^X\NY/
8503    X\nY
8504 0: X\x0aY
8505    X\rY
8506 0: X\x0dY
8507\= Expect no match
8508    X\x00Y
8509No match
8510
8511/a\Rb/I,bsr=anycrlf
8512Capture group count = 0
8513\R matches CR, LF, or CRLF
8514First code unit = 'a'
8515Last code unit = 'b'
8516Subject length lower bound = 3
8517    a\rb
8518 0: a\x0db
8519    a\nb
8520 0: a\x0ab
8521    a\r\nb
8522 0: a\x0d\x0ab
8523\= Expect no match
8524    a\x85b
8525No match
8526    a\x0bb
8527No match
8528
8529/a\Rb/I,bsr=unicode
8530Capture group count = 0
8531\R matches any Unicode newline
8532First code unit = 'a'
8533Last code unit = 'b'
8534Subject length lower bound = 3
8535    a\rb
8536 0: a\x0db
8537    a\nb
8538 0: a\x0ab
8539    a\r\nb
8540 0: a\x0d\x0ab
8541    a\x85b
8542 0: a\x85b
8543    a\x0bb
8544 0: a\x0bb
8545
8546/a\R?b/I,bsr=anycrlf
8547Capture group count = 0
8548\R matches CR, LF, or CRLF
8549First code unit = 'a'
8550Last code unit = 'b'
8551Subject length lower bound = 2
8552    a\rb
8553 0: a\x0db
8554    a\nb
8555 0: a\x0ab
8556    a\r\nb
8557 0: a\x0d\x0ab
8558\= Expect no match
8559    a\x85b
8560No match
8561    a\x0bb
8562No match
8563
8564/a\R?b/I,bsr=unicode
8565Capture group count = 0
8566\R matches any Unicode newline
8567First code unit = 'a'
8568Last code unit = 'b'
8569Subject length lower bound = 2
8570    a\rb
8571 0: a\x0db
8572    a\nb
8573 0: a\x0ab
8574    a\r\nb
8575 0: a\x0d\x0ab
8576    a\x85b
8577 0: a\x85b
8578    a\x0bb
8579 0: a\x0bb
8580
8581/a\R{2,4}b/I,bsr=anycrlf
8582Capture group count = 0
8583\R matches CR, LF, or CRLF
8584First code unit = 'a'
8585Last code unit = 'b'
8586Subject length lower bound = 4
8587    a\r\n\nb
8588 0: a\x0d\x0a\x0ab
8589    a\n\r\rb
8590 0: a\x0a\x0d\x0db
8591    a\r\n\r\n\r\n\r\nb
8592 0: a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0ab
8593\= Expect no match
8594    a\x85\x85b
8595No match
8596    a\x0b\x0bb
8597No match
8598
8599/a\R{2,4}b/I,bsr=unicode
8600Capture group count = 0
8601\R matches any Unicode newline
8602First code unit = 'a'
8603Last code unit = 'b'
8604Subject length lower bound = 4
8605    a\r\rb
8606 0: a\x0d\x0db
8607    a\n\n\nb
8608 0: a\x0a\x0a\x0ab
8609    a\r\n\n\r\rb
8610 0: a\x0d\x0a\x0a\x0d\x0db
8611    a\x85\x85b
8612 0: a\x85\x85b
8613    a\x0b\x0bb
8614 0: a\x0b\x0bb
8615\= Expect no match
8616    a\r\r\r\r\rb
8617No match
8618
8619/(*BSR_ANYCRLF)a\Rb/I
8620Capture group count = 0
8621\R matches CR, LF, or CRLF
8622First code unit = 'a'
8623Last code unit = 'b'
8624Subject length lower bound = 3
8625    a\nb
8626 0: a\x0ab
8627    a\rb
8628 0: a\x0db
8629
8630/(*BSR_UNICODE)a\Rb/I
8631Capture group count = 0
8632\R matches any Unicode newline
8633First code unit = 'a'
8634Last code unit = 'b'
8635Subject length lower bound = 3
8636    a\x85b
8637 0: a\x85b
8638
8639/(*BSR_ANYCRLF)(*CRLF)a\Rb/I
8640Capture group count = 0
8641\R matches CR, LF, or CRLF
8642Forced newline is CRLF
8643First code unit = 'a'
8644Last code unit = 'b'
8645Subject length lower bound = 3
8646    a\nb
8647 0: a\x0ab
8648    a\rb
8649 0: a\x0db
8650
8651/(*CRLF)(*BSR_UNICODE)a\Rb/I
8652Capture group count = 0
8653\R matches any Unicode newline
8654Forced newline is CRLF
8655First code unit = 'a'
8656Last code unit = 'b'
8657Subject length lower bound = 3
8658    a\x85b
8659 0: a\x85b
8660
8661/(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
8662Capture group count = 0
8663\R matches CR, LF, or CRLF
8664Forced newline is CR
8665First code unit = 'a'
8666Last code unit = 'b'
8667Subject length lower bound = 2
8668
8669/(?<a>)(?&)/
8670Failed: error 162 at offset 9: subpattern name expected
8671
8672/(?<abc>)(?&a)/
8673Failed: error 115 at offset 11: reference to non-existent subpattern
8674
8675/(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
8676Failed: error 115 at offset 9: reference to non-existent subpattern
8677
8678/(?+-a)/
8679Failed: error 129 at offset 2: digit expected after (?+ or (?-
8680
8681/(?-+a)/
8682Failed: error 111 at offset 3: unrecognized character after (? or (?-
8683
8684/(?(-1))/
8685Failed: error 115 at offset 5: reference to non-existent subpattern
8686
8687/(?(+10))/
8688Failed: error 115 at offset 4: reference to non-existent subpattern
8689
8690/(?(10))/
8691Failed: error 115 at offset 3: reference to non-existent subpattern
8692
8693/(?(+2))()()/
8694
8695/(?(2))()()/
8696
8697/\k''/
8698Failed: error 162 at offset 3: subpattern name expected
8699
8700/\k<>/
8701Failed: error 162 at offset 3: subpattern name expected
8702
8703/\k{}/
8704Failed: error 162 at offset 3: subpattern name expected
8705
8706/\k/
8707Failed: error 169 at offset 2: \k is not followed by a braced, angle-bracketed, or quoted name
8708
8709/\kabc/
8710Failed: error 169 at offset 2: \k is not followed by a braced, angle-bracketed, or quoted name
8711
8712/(?P=)/
8713Failed: error 162 at offset 4: subpattern name expected
8714
8715/(?P>)/
8716Failed: error 162 at offset 4: subpattern name expected
8717
8718/[[:foo:]]/
8719Failed: error 130 at offset 3: unknown POSIX class name
8720
8721/[[:1234:]]/
8722Failed: error 130 at offset 3: unknown POSIX class name
8723
8724/[[:f\oo:]]/
8725Failed: error 130 at offset 3: unknown POSIX class name
8726
8727/[[: :]]/
8728Failed: error 130 at offset 3: unknown POSIX class name
8729
8730/[[:...:]]/
8731Failed: error 130 at offset 3: unknown POSIX class name
8732
8733/[[:l\ower:]]/
8734Failed: error 130 at offset 3: unknown POSIX class name
8735
8736/[[:abc\:]]/
8737Failed: error 130 at offset 3: unknown POSIX class name
8738
8739/[abc[:x\]pqr:]]/
8740Failed: error 130 at offset 6: unknown POSIX class name
8741
8742/[[:a\dz:]]/
8743Failed: error 130 at offset 3: unknown POSIX class name
8744
8745/(^(a|b\g<-1'c))/
8746Failed: error 157 at offset 8: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
8747
8748/^(?+1)(?<a>x|y){0}z/
8749    xzxx
8750 0: xz
8751    yzyy
8752 0: yz
8753\= Expect no match
8754    xxz
8755No match
8756
8757/(\3)(\1)(a)/
8758\= Expect no match
8759    cat
8760No match
8761
8762/(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
8763    cat
8764 0: a
8765 1:
8766 2:
8767 3: a
8768
8769/TA]/
8770    The ACTA] comes
8771 0: TA]
8772
8773/TA]/allow_empty_class,match_unset_backref,dupnames
8774    The ACTA] comes
8775 0: TA]
8776
8777/(?2)[]a()b](abc)/
8778Failed: error 115 at offset 3: reference to non-existent subpattern
8779    abcbabc
8780
8781/(?2)[^]a()b](abc)/
8782Failed: error 115 at offset 3: reference to non-existent subpattern
8783    abcbabc
8784
8785/(?1)[]a()b](abc)/
8786    abcbabc
8787 0: abcbabc
8788 1: abc
8789\= Expect no match
8790    abcXabc
8791No match
8792
8793/(?1)[^]a()b](abc)/
8794    abcXabc
8795 0: abcXabc
8796 1: abc
8797\= Expect no match
8798    abcbabc
8799No match
8800
8801/(?2)[]a()b](abc)(xyz)/
8802    xyzbabcxyz
8803 0: xyzbabcxyz
8804 1: abc
8805 2: xyz
8806
8807/(?&N)[]a(?<N>)](?<M>abc)/
8808Failed: error 115 at offset 3: reference to non-existent subpattern
8809   abc<abc
8810
8811/(?&N)[]a(?<N>)](abc)/
8812Failed: error 115 at offset 3: reference to non-existent subpattern
8813   abc<abc
8814
8815/a[]b/
8816Failed: error 106 at offset 4: missing terminating ] for character class
8817
8818/a[^]b/
8819Failed: error 106 at offset 5: missing terminating ] for character class
8820
8821/a[]b/allow_empty_class,match_unset_backref,dupnames
8822\= Expect no match
8823    ab
8824No match
8825
8826/a[]+b/allow_empty_class,match_unset_backref,dupnames
8827\= Expect no match
8828    ab
8829No match
8830
8831/a[]*+b/allow_empty_class,match_unset_backref,dupnames
8832\= Expect no match
8833    ab
8834No match
8835
8836/a[^]b/allow_empty_class,match_unset_backref,dupnames
8837    aXb
8838 0: aXb
8839    a\nb
8840 0: a\x0ab
8841\= Expect no match
8842    ab
8843No match
8844
8845/a[^]+b/allow_empty_class,match_unset_backref,dupnames
8846    aXb
8847 0: aXb
8848    a\nX\nXb
8849 0: a\x0aX\x0aXb
8850\= Expect no match
8851    ab
8852No match
8853
8854/a(?!)b/B
8855------------------------------------------------------------------
8856        Bra
8857        a
8858        *FAIL
8859        b
8860        Ket
8861        End
8862------------------------------------------------------------------
8863
8864/(?!)?a/B
8865------------------------------------------------------------------
8866        Bra
8867        Brazero
8868        Assert not
8869        Ket
8870        a
8871        Ket
8872        End
8873------------------------------------------------------------------
8874    ab
8875 0: a
8876
8877/a(*FAIL)+b/
8878Failed: error 109 at offset 8: quantifier does not follow a repeatable item
8879
8880/(abc|pqr|123){0}[xyz]/I
8881Capture group count = 1
8882Starting code units: x y z
8883Subject length lower bound = 1
8884
8885/(?(?=.*b)b|^)/I,auto_callout
8886Capture group count = 0
8887May match empty string
8888Options: auto_callout
8889Subject length lower bound = 0
8890   adc
8891--->adc
8892 +0 ^       (?
8893 +2 ^       (?=
8894 +5 ^       .*
8895 +7 ^  ^    b
8896 +7 ^ ^     b
8897 +7 ^^      b
8898 +7 ^       b
8899+11 ^       ^
8900+12 ^       )
8901+13 ^       End of pattern
8902 0:
8903   abc
8904--->abc
8905 +0 ^       (?
8906 +2 ^       (?=
8907 +5 ^       .*
8908 +7 ^  ^    b
8909 +7 ^ ^     b
8910 +7 ^^      b
8911 +8 ^ ^     )
8912 +9 ^       b
8913 +0  ^      (?
8914 +2  ^      (?=
8915 +5  ^      .*
8916 +7  ^ ^    b
8917 +7  ^^     b
8918 +7  ^      b
8919 +8  ^^     )
8920 +9  ^      b
8921+10  ^^     |
8922+13  ^^     End of pattern
8923 0: b
8924
8925/(?(?=b).*b|^d)/I
8926Capture group count = 0
8927Subject length lower bound = 1
8928
8929/(?(?=.*b).*b|^d)/I
8930Capture group count = 0
8931Subject length lower bound = 1
8932
8933/xyz/auto_callout
8934  xyz
8935--->xyz
8936 +0 ^       x
8937 +1 ^^      y
8938 +2 ^ ^     z
8939 +3 ^  ^    End of pattern
8940 0: xyz
8941  abcxyz
8942--->abcxyz
8943 +0    ^       x
8944 +1    ^^      y
8945 +2    ^ ^     z
8946 +3    ^  ^    End of pattern
8947 0: xyz
8948\= Expect no match
8949  abc
8950No match
8951  abcxypqr
8952No match
8953
8954/xyz/auto_callout,no_start_optimize
8955  abcxyz
8956--->abcxyz
8957 +0 ^          x
8958 +0  ^         x
8959 +0   ^        x
8960 +0    ^       x
8961 +1    ^^      y
8962 +2    ^ ^     z
8963 +3    ^  ^    End of pattern
8964 0: xyz
8965\= Expect no match
8966  abc
8967--->abc
8968 +0 ^       x
8969 +0  ^      x
8970 +0   ^     x
8971 +0    ^    x
8972No match
8973  abcxypqr
8974--->abcxypqr
8975 +0 ^            x
8976 +0  ^           x
8977 +0   ^          x
8978 +0    ^         x
8979 +1    ^^        y
8980 +2    ^ ^       z
8981 +0     ^        x
8982 +0      ^       x
8983 +0       ^      x
8984 +0        ^     x
8985 +0         ^    x
8986No match
8987
8988/(*NO_START_OPT)xyz/auto_callout
8989  abcxyz
8990--->abcxyz
8991+15 ^          x
8992+15  ^         x
8993+15   ^        x
8994+15    ^       x
8995+16    ^^      y
8996+17    ^ ^     z
8997+18    ^  ^    End of pattern
8998 0: xyz
8999
9000/(*NO_AUTO_POSSESS)a+b/B
9001------------------------------------------------------------------
9002        Bra
9003        a+
9004        b
9005        Ket
9006        End
9007------------------------------------------------------------------
9008
9009/xyz/auto_callout,no_start_optimize
9010  abcxyz
9011--->abcxyz
9012 +0 ^          x
9013 +0  ^         x
9014 +0   ^        x
9015 +0    ^       x
9016 +1    ^^      y
9017 +2    ^ ^     z
9018 +3    ^  ^    End of pattern
9019 0: xyz
9020
9021/^"((?(?=[a])[^"])|b)*"$/auto_callout
9022    "ab"
9023--->"ab"
9024 +0 ^        ^
9025 +1 ^        "
9026 +2 ^^       (
9027 +3 ^^       (?
9028 +5 ^^       (?=
9029 +8 ^^       [a]
9030+11 ^ ^      )
9031+12 ^^       [^"]
9032+16 ^ ^      )
9033+17 ^ ^      |
9034 +3 ^ ^      (?
9035 +5 ^ ^      (?=
9036 +8 ^ ^      [a]
9037+17 ^ ^      |
9038+21 ^ ^      "
9039+18 ^ ^      b
9040+19 ^  ^     )*
9041 +3 ^  ^     (?
9042 +5 ^  ^     (?=
9043 +8 ^  ^     [a]
9044+17 ^  ^     |
9045+21 ^  ^     "
9046+22 ^   ^    $
9047+23 ^   ^    End of pattern
9048 0: "ab"
9049 1:
9050
9051/^"((?(?=[a])[^"])|b)*"$/
9052    "ab"
9053 0: "ab"
9054 1:
9055
9056/^X(?5)(a)(?|(b)|(q))(c)(d)Y/
9057Failed: error 115 at offset 5: reference to non-existent subpattern
9058    XYabcdY
9059
9060/^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)/
9061    XYabcdY
9062 0: XYabcdY
9063 1: a
9064 2: b
9065 3: c
9066 4: d
9067 5: Y
9068
9069/Xa{2,4}b/
9070    X\=ps
9071Partial match: X
9072    Xa\=ps
9073Partial match: Xa
9074    Xaa\=ps
9075Partial match: Xaa
9076    Xaaa\=ps
9077Partial match: Xaaa
9078    Xaaaa\=ps
9079Partial match: Xaaaa
9080
9081/Xa{2,4}?b/
9082    X\=ps
9083Partial match: X
9084    Xa\=ps
9085Partial match: Xa
9086    Xaa\=ps
9087Partial match: Xaa
9088    Xaaa\=ps
9089Partial match: Xaaa
9090    Xaaaa\=ps
9091Partial match: Xaaaa
9092
9093/Xa{2,4}+b/
9094    X\=ps
9095Partial match: X
9096    Xa\=ps
9097Partial match: Xa
9098    Xaa\=ps
9099Partial match: Xaa
9100    Xaaa\=ps
9101Partial match: Xaaa
9102    Xaaaa\=ps
9103Partial match: Xaaaa
9104
9105/X\d{2,4}b/
9106    X\=ps
9107Partial match: X
9108    X3\=ps
9109Partial match: X3
9110    X33\=ps
9111Partial match: X33
9112    X333\=ps
9113Partial match: X333
9114    X3333\=ps
9115Partial match: X3333
9116
9117/X\d{2,4}?b/
9118    X\=ps
9119Partial match: X
9120    X3\=ps
9121Partial match: X3
9122    X33\=ps
9123Partial match: X33
9124    X333\=ps
9125Partial match: X333
9126    X3333\=ps
9127Partial match: X3333
9128
9129/X\d{2,4}+b/
9130    X\=ps
9131Partial match: X
9132    X3\=ps
9133Partial match: X3
9134    X33\=ps
9135Partial match: X33
9136    X333\=ps
9137Partial match: X333
9138    X3333\=ps
9139Partial match: X3333
9140
9141/X\D{2,4}b/
9142    X\=ps
9143Partial match: X
9144    Xa\=ps
9145Partial match: Xa
9146    Xaa\=ps
9147Partial match: Xaa
9148    Xaaa\=ps
9149Partial match: Xaaa
9150    Xaaaa\=ps
9151Partial match: Xaaaa
9152
9153/X\D{2,4}?b/
9154    X\=ps
9155Partial match: X
9156    Xa\=ps
9157Partial match: Xa
9158    Xaa\=ps
9159Partial match: Xaa
9160    Xaaa\=ps
9161Partial match: Xaaa
9162    Xaaaa\=ps
9163Partial match: Xaaaa
9164
9165/X\D{2,4}+b/
9166    X\=ps
9167Partial match: X
9168    Xa\=ps
9169Partial match: Xa
9170    Xaa\=ps
9171Partial match: Xaa
9172    Xaaa\=ps
9173Partial match: Xaaa
9174    Xaaaa\=ps
9175Partial match: Xaaaa
9176
9177/X[abc]{2,4}b/
9178    X\=ps
9179Partial match: X
9180    Xa\=ps
9181Partial match: Xa
9182    Xaa\=ps
9183Partial match: Xaa
9184    Xaaa\=ps
9185Partial match: Xaaa
9186    Xaaaa\=ps
9187Partial match: Xaaaa
9188
9189/X[abc]{2,4}?b/
9190    X\=ps
9191Partial match: X
9192    Xa\=ps
9193Partial match: Xa
9194    Xaa\=ps
9195Partial match: Xaa
9196    Xaaa\=ps
9197Partial match: Xaaa
9198    Xaaaa\=ps
9199Partial match: Xaaaa
9200
9201/X[abc]{2,4}+b/
9202    X\=ps
9203Partial match: X
9204    Xa\=ps
9205Partial match: Xa
9206    Xaa\=ps
9207Partial match: Xaa
9208    Xaaa\=ps
9209Partial match: Xaaa
9210    Xaaaa\=ps
9211Partial match: Xaaaa
9212
9213/X[^a]{2,4}b/
9214    X\=ps
9215Partial match: X
9216    Xz\=ps
9217Partial match: Xz
9218    Xzz\=ps
9219Partial match: Xzz
9220    Xzzz\=ps
9221Partial match: Xzzz
9222    Xzzzz\=ps
9223Partial match: Xzzzz
9224
9225/X[^a]{2,4}?b/
9226    X\=ps
9227Partial match: X
9228    Xz\=ps
9229Partial match: Xz
9230    Xzz\=ps
9231Partial match: Xzz
9232    Xzzz\=ps
9233Partial match: Xzzz
9234    Xzzzz\=ps
9235Partial match: Xzzzz
9236
9237/X[^a]{2,4}+b/
9238    X\=ps
9239Partial match: X
9240    Xz\=ps
9241Partial match: Xz
9242    Xzz\=ps
9243Partial match: Xzz
9244    Xzzz\=ps
9245Partial match: Xzzz
9246    Xzzzz\=ps
9247Partial match: Xzzzz
9248
9249/(Y)X\1{2,4}b/
9250    YX\=ps
9251Partial match: YX
9252    YXY\=ps
9253Partial match: YXY
9254    YXYY\=ps
9255Partial match: YXYY
9256    YXYYY\=ps
9257Partial match: YXYYY
9258    YXYYYY\=ps
9259Partial match: YXYYYY
9260
9261/(Y)X\1{2,4}?b/
9262    YX\=ps
9263Partial match: YX
9264    YXY\=ps
9265Partial match: YXY
9266    YXYY\=ps
9267Partial match: YXYY
9268    YXYYY\=ps
9269Partial match: YXYYY
9270    YXYYYY\=ps
9271Partial match: YXYYYY
9272
9273/(Y)X\1{2,4}+b/
9274    YX\=ps
9275Partial match: YX
9276    YXY\=ps
9277Partial match: YXY
9278    YXYY\=ps
9279Partial match: YXYY
9280    YXYYY\=ps
9281Partial match: YXYYY
9282    YXYYYY\=ps
9283Partial match: YXYYYY
9284
9285/\++\KZ|\d+X|9+Y/startchar
9286    ++++123999\=ps
9287Partial match: 123999
9288    ++++123999Y\=ps
9289 0: 999Y
9290    ++++Z1234\=ps
9291 0: ++++Z
9292    ^^^^
9293
9294/Z(*F)/
9295\= Expect no match
9296    Z\=ps
9297No match
9298    ZA\=ps
9299No match
9300
9301/Z(?!)/
9302\= Expect no match
9303    Z\=ps
9304No match
9305    ZA\=ps
9306No match
9307
9308/dog(sbody)?/
9309    dogs\=ps
9310 0: dog
9311    dogs\=ph
9312Partial match: dogs
9313
9314/dog(sbody)??/
9315    dogs\=ps
9316 0: dog
9317    dogs\=ph
9318 0: dog
9319
9320/dog|dogsbody/
9321    dogs\=ps
9322 0: dog
9323    dogs\=ph
9324 0: dog
9325
9326/dogsbody|dog/
9327    dogs\=ps
9328 0: dog
9329    dogs\=ph
9330Partial match: dogs
9331
9332/\bthe cat\b/
9333    the cat\=ps
9334 0: the cat
9335    the cat\=ph
9336Partial match: the cat
9337
9338/abc/
9339   abc\=ps
9340 0: abc
9341   abc\=ph
9342 0: abc
9343
9344/abc\K123/startchar
9345    xyzabc123pqr
9346 0: abc123
9347    ^^^
9348    xyzabc12\=ps
9349Partial match: abc12
9350    xyzabc12\=ph
9351Partial match: abc12
9352
9353/(?<=abc)123/
9354    xyzabc123pqr
9355 0: 123
9356    xyzabc12\=ps
9357Partial match: 12
9358    xyzabc12\=ph
9359Partial match: 12
9360
9361/\babc\b/
9362    +++abc+++
9363 0: abc
9364    +++ab\=ps
9365Partial match: ab
9366    +++ab\=ph
9367Partial match: ab
9368
9369/(?&word)(?&element)(?(DEFINE)(?<element><[^m][^>]>[^<])(?<word>\w*+))/B
9370------------------------------------------------------------------
9371        Bra
9372        Recurse
9373        Recurse
9374        Cond
9375        Cond false
9376        CBra 1
9377        <
9378        [^m]
9379        [^>]
9380        >
9381        [^<]
9382        Ket
9383        CBra 2
9384        \w*+
9385        Ket
9386        Ket
9387        Ket
9388        End
9389------------------------------------------------------------------
9390
9391/(?&word)(?&element)(?(DEFINE)(?<element><[^\d][^>]>[^<])(?<word>\w*+))/B
9392------------------------------------------------------------------
9393        Bra
9394        Recurse
9395        Recurse
9396        Cond
9397        Cond false
9398        CBra 1
9399        <
9400        [\x00-/:-\xff] (neg)
9401        [^>]
9402        >
9403        [^<]
9404        Ket
9405        CBra 2
9406        \w*+
9407        Ket
9408        Ket
9409        Ket
9410        End
9411------------------------------------------------------------------
9412
9413/(ab)(x(y)z(cd(*ACCEPT)))pq/B
9414------------------------------------------------------------------
9415        Bra
9416        CBra 1
9417        ab
9418        Ket
9419        CBra 2
9420        x
9421        CBra 3
9422        y
9423        Ket
9424        z
9425        CBra 4
9426        cd
9427        Close 4
9428        Close 2
9429        *ACCEPT
9430        Ket
9431        Ket
9432        pq
9433        Ket
9434        End
9435------------------------------------------------------------------
9436
9437/abc\K/aftertext,startchar
9438    abcdef
9439 0: abc
9440    ^^^
9441 0+ def
9442    abcdef\=notempty_atstart
9443 0: abc
9444    ^^^
9445 0+ def
9446    xyzabcdef\=notempty_atstart
9447 0: abc
9448    ^^^
9449 0+ def
9450\= Expect no match
9451    abcdef\=notempty
9452No match
9453    xyzabcdef\=notempty
9454No match
9455
9456/^(?:(?=abc)|abc\K)/aftertext,startchar
9457    abcdef
9458 0:
9459 0+ abcdef
9460    abcdef\=notempty_atstart
9461 0: abc
9462    ^^^
9463 0+ def
9464\= Expect no match
9465    abcdef\=notempty
9466No match
9467
9468/a?b?/aftertext
9469    xyz
9470 0:
9471 0+ xyz
9472    xyzabc
9473 0:
9474 0+ xyzabc
9475    xyzabc\=notempty
9476 0: ab
9477 0+ c
9478    xyzabc\=notempty_atstart
9479 0:
9480 0+ yzabc
9481    xyz\=notempty_atstart
9482 0:
9483 0+ yz
9484\= Expect no match
9485    xyz\=notempty
9486No match
9487
9488/^a?b?/aftertext
9489    xyz
9490 0:
9491 0+ xyz
9492    xyzabc
9493 0:
9494 0+ xyzabc
9495\= Expect no match
9496    xyzabc\=notempty
9497No match
9498    xyzabc\=notempty_atstart
9499No match
9500    xyz\=notempty_atstart
9501No match
9502    xyz\=notempty
9503No match
9504
9505/^(?<name>a|b\g<name>c)/
9506    aaaa
9507 0: a
9508 1: a
9509    bacxxx
9510 0: bac
9511 1: bac
9512    bbaccxxx
9513 0: bbacc
9514 1: bbacc
9515    bbbacccxx
9516 0: bbbaccc
9517 1: bbbaccc
9518
9519/^(?<name>a|b\g'name'c)/
9520    aaaa
9521 0: a
9522 1: a
9523    bacxxx
9524 0: bac
9525 1: bac
9526    bbaccxxx
9527 0: bbacc
9528 1: bbacc
9529    bbbacccxx
9530 0: bbbaccc
9531 1: bbbaccc
9532
9533/^(a|b\g<1>c)/
9534    aaaa
9535 0: a
9536 1: a
9537    bacxxx
9538 0: bac
9539 1: bac
9540    bbaccxxx
9541 0: bbacc
9542 1: bbacc
9543    bbbacccxx
9544 0: bbbaccc
9545 1: bbbaccc
9546
9547/^(a|b\g'1'c)/
9548    aaaa
9549 0: a
9550 1: a
9551    bacxxx
9552 0: bac
9553 1: bac
9554    bbaccxxx
9555 0: bbacc
9556 1: bbacc
9557    bbbacccxx
9558 0: bbbaccc
9559 1: bbbaccc
9560
9561/^(a|b\g'-1'c)/
9562    aaaa
9563 0: a
9564 1: a
9565    bacxxx
9566 0: bac
9567 1: bac
9568    bbaccxxx
9569 0: bbacc
9570 1: bbacc
9571    bbbacccxx
9572 0: bbbaccc
9573 1: bbbaccc
9574
9575/(^(a|b\g<-1>c))/
9576    aaaa
9577 0: a
9578 1: a
9579 2: a
9580    bacxxx
9581 0: bac
9582 1: bac
9583 2: bac
9584    bbaccxxx
9585 0: bbacc
9586 1: bbacc
9587 2: bbacc
9588    bbbacccxx
9589 0: bbbaccc
9590 1: bbbaccc
9591 2: bbbaccc
9592
9593/(?-i:\g<name>)(?i:(?<name>a))/
9594    XaaX
9595 0: aa
9596 1: a
9597    XAAX
9598 0: AA
9599 1: A
9600
9601/(?i:\g<name>)(?-i:(?<name>a))/
9602    XaaX
9603 0: aa
9604 1: a
9605\= Expect no match
9606    XAAX
9607No match
9608
9609/(?-i:\g<+1>)(?i:(a))/
9610    XaaX
9611 0: aa
9612 1: a
9613    XAAX
9614 0: AA
9615 1: A
9616
9617/(?=(?<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>\})\}))\{/
9618
9619/(?<n>a|b|c)\g<n>*/
9620   abc
9621 0: abc
9622 1: a
9623   accccbbb
9624 0: accccbbb
9625 1: a
9626
9627/^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)/
9628    XYabcdY
9629 0: XYabcdY
9630 1: a
9631 2: b
9632 3: <unset>
9633 4: <unset>
9634 5: c
9635 6: d
9636 7: Y
9637
9638/(?<=b(?1)|zzz)(a)/
9639    xbaax
9640 0: a
9641 1: a
9642    xzzzax
9643 0: a
9644 1: a
9645
9646/(a)(?<=b\1)/
9647
9648/(a)(?<=b+(?1))/
9649Failed: error 125 at offset 3: lookbehind assertion is not fixed length
9650
9651/(a+)(?<=b(?1))/
9652Failed: error 125 at offset 4: lookbehind assertion is not fixed length
9653
9654/(a(?<=b(?1)))/
9655Failed: error 125 at offset 2: lookbehind assertion is not fixed length
9656
9657/(?<=b(?1))xyz/
9658Failed: error 115 at offset 8: reference to non-existent subpattern
9659
9660/(?<=b(?1))xyz(b+)pqrstuvew/
9661Failed: error 125 at offset 0: lookbehind assertion is not fixed length
9662
9663/(a|bc)\1/I
9664Capture group count = 1
9665Max back reference = 1
9666Starting code units: a b
9667Subject length lower bound = 2
9668
9669/(a|bc)\1{2,3}/I
9670Capture group count = 1
9671Max back reference = 1
9672Starting code units: a b
9673Subject length lower bound = 3
9674
9675/(a|bc)(?1)/I
9676Capture group count = 1
9677Starting code units: a b
9678Subject length lower bound = 2
9679
9680/(a|b\1)(a|b\1)/I
9681Capture group count = 2
9682Max back reference = 1
9683Starting code units: a b
9684Subject length lower bound = 2
9685
9686/(a|b\1){2}/I
9687Capture group count = 1
9688Max back reference = 1
9689Starting code units: a b
9690Subject length lower bound = 2
9691
9692/(a|bbbb\1)(a|bbbb\1)/I
9693Capture group count = 2
9694Max back reference = 1
9695Starting code units: a b
9696Subject length lower bound = 2
9697
9698/(a|bbbb\1){2}/I
9699Capture group count = 1
9700Max back reference = 1
9701Starting code units: a b
9702Subject length lower bound = 2
9703
9704/^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
9705Capture group count = 1
9706Compile options: <none>
9707Overall options: anchored
9708First code unit = 'F'
9709Last code unit = ':'
9710Subject length lower bound = 22
9711
9712/<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
9713Capture group count = 11
9714Options: caseless dotall
9715First code unit = '<'
9716Last code unit = '>'
9717Subject length lower bound = 47
9718
9719"(?>.*/)foo"I
9720Capture group count = 0
9721Last code unit = 'o'
9722Subject length lower bound = 4
9723
9724/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /Ix
9725Capture group count = 0
9726Options: extended
9727Last code unit = '-'
9728Subject length lower bound = 8
9729
9730/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/Ii
9731Capture group count = 1
9732Options: caseless
9733Starting code units: A B C a b c
9734Subject length lower bound = 1
9735
9736/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/I
9737Capture group count = 0
9738Starting code units: c d
9739Last code unit = 'b'
9740Subject length lower bound = 41
9741
9742/<a[\s]+href[\s]*=[\s]*          # find <a href=
9743 ([\"\'])?                       # find single or double quote
9744 (?(1) (.*?)\1 | ([^\s]+))       # if quote found, match up to next matching
9745                                 # quote, otherwise match up to next space
9746/Iisx
9747Capture group count = 3
9748Max back reference = 1
9749Options: caseless dotall extended
9750First code unit = '<'
9751Last code unit = '='
9752Subject length lower bound = 9
9753
9754/^(?!:)                       # colon disallowed at start
9755  (?:                         # start of item
9756    (?: [0-9a-f]{1,4} |       # 1-4 hex digits or
9757    (?(1)0 | () ) )           # if null previously matched, fail; else null
9758    :                         # followed by colon
9759  ){1,7}                      # end item; 1-7 of them required
9760  [0-9a-f]{1,4} $             # final hex number at end of string
9761  (?(1)|.)                    # check that there was an empty component
9762  /Iix
9763Capture group count = 1
9764Max back reference = 1
9765Compile options: caseless extended
9766Overall options: anchored caseless extended
9767Last code unit = ':'
9768Subject length lower bound = 2
9769
9770/(?|(?<a>A)|(?<a>B))/I
9771Capture group count = 1
9772Named capture groups:
9773  a   1
9774Starting code units: A B
9775Subject length lower bound = 1
9776    AB\=copy=a
9777 0: A
9778 1: A
9779  C A (1) a (group 1)
9780    BA\=copy=a
9781 0: B
9782 1: B
9783  C B (1) a (group 1)
9784
9785/(?|(?<a>A)|(?<b>B))/
9786Failed: error 165 at offset 16: different names for subpatterns of the same number are not allowed
9787
9788/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |
9789    b(?<quote> (?<apostrophe>')|(?<realquote>")) )
9790    (?('quote')[a-z]+|[0-9]+)/Ix,dupnames
9791Capture group count = 6
9792Max back reference = 4
9793Named capture groups:
9794  apostrophe   2
9795  apostrophe   5
9796  quote        1
9797  quote        4
9798  realquote    3
9799  realquote    6
9800Options: dupnames extended
9801Starting code units: a b
9802Subject length lower bound = 3
9803    a"aaaaa
9804 0: a"aaaaa
9805 1: "
9806 2: <unset>
9807 3: "
9808    b"aaaaa
9809 0: b"aaaaa
9810 1: <unset>
9811 2: <unset>
9812 3: <unset>
9813 4: "
9814 5: <unset>
9815 6: "
9816\= Expect no match
9817    b"11111
9818No match
9819    a"11111
9820No match
9821
9822/^(?|(a)(b)(c)(?<D>d)|(?<D>e)) (?('D')X|Y)/IBx,dupnames
9823------------------------------------------------------------------
9824        Bra
9825        ^
9826        Bra
9827        CBra 1
9828        a
9829        Ket
9830        CBra 2
9831        b
9832        Ket
9833        CBra 3
9834        c
9835        Ket
9836        CBra 4
9837        d
9838        Ket
9839        Alt
9840        CBra 1
9841        e
9842        Ket
9843        Ket
9844        Cond
9845        Cond ref <D>2
9846        X
9847        Alt
9848        Y
9849        Ket
9850        Ket
9851        End
9852------------------------------------------------------------------
9853Capture group count = 4
9854Max back reference = 4
9855Named capture groups:
9856  D   4
9857  D   1
9858Compile options: dupnames extended
9859Overall options: anchored dupnames extended
9860Starting code units: a e
9861Subject length lower bound = 2
9862    abcdX
9863 0: abcdX
9864 1: a
9865 2: b
9866 3: c
9867 4: d
9868    eX
9869 0: eX
9870 1: e
9871\= Expect no match
9872    abcdY
9873No match
9874    ey
9875No match
9876
9877/(?<A>a) (b)(c)  (?<A>d  (?(R&A)$ | (?4)) )/IBx,dupnames
9878------------------------------------------------------------------
9879        Bra
9880        CBra 1
9881        a
9882        Ket
9883        CBra 2
9884        b
9885        Ket
9886        CBra 3
9887        c
9888        Ket
9889        CBra 4
9890        d
9891        Cond
9892        Cond recurse <A>2
9893        $
9894        Alt
9895        Recurse
9896        Ket
9897        Ket
9898        Ket
9899        End
9900------------------------------------------------------------------
9901Capture group count = 4
9902Max back reference = 4
9903Named capture groups:
9904  A   1
9905  A   4
9906Options: dupnames extended
9907First code unit = 'a'
9908Last code unit = 'd'
9909Subject length lower bound = 4
9910    abcdd
9911 0: abcdd
9912 1: a
9913 2: b
9914 3: c
9915 4: dd
9916\= Expect no match
9917    abcdde
9918No match
9919
9920/abcd*/
9921    xxxxabcd\=ps
9922 0: abcd
9923    xxxxabcd\=ph
9924Partial match: abcd
9925
9926/abcd*/i
9927    xxxxabcd\=ps
9928 0: abcd
9929    xxxxabcd\=ph
9930Partial match: abcd
9931    XXXXABCD\=ps
9932 0: ABCD
9933    XXXXABCD\=ph
9934Partial match: ABCD
9935
9936/abc\d*/
9937    xxxxabc1\=ps
9938 0: abc1
9939    xxxxabc1\=ph
9940Partial match: abc1
9941
9942/(a)bc\1*/
9943    xxxxabca\=ps
9944 0: abca
9945 1: a
9946    xxxxabca\=ph
9947Partial match: abca
9948
9949/abc[de]*/
9950    xxxxabcde\=ps
9951 0: abcde
9952    xxxxabcde\=ph
9953Partial match: abcde
9954
9955/(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
9956    cat
9957 0: a
9958 1:
9959 2:
9960 3: a
9961
9962/(\3)(\1)(a)/I,allow_empty_class,match_unset_backref,dupnames
9963Capture group count = 3
9964Max back reference = 3
9965Options: allow_empty_class dupnames match_unset_backref
9966Last code unit = 'a'
9967Subject length lower bound = 1
9968    cat
9969 0: a
9970 1:
9971 2:
9972 3: a
9973
9974/(\3)(\1)(a)/I
9975Capture group count = 3
9976Max back reference = 3
9977Last code unit = 'a'
9978Subject length lower bound = 3
9979\= Expect no match
9980    cat
9981No match
9982
9983/i(?(DEFINE)(?<s>a))/I
9984Capture group count = 1
9985Named capture groups:
9986  s   1
9987First code unit = 'i'
9988Subject length lower bound = 1
9989    i
9990 0: i
9991
9992/()i(?(1)a)/I
9993Capture group count = 1
9994Max back reference = 1
9995First code unit = 'i'
9996Subject length lower bound = 1
9997    ia
9998 0: ia
9999 1:
10000
10001/(?i)a(?-i)b|c/B
10002------------------------------------------------------------------
10003        Bra
10004     /i a
10005        b
10006        Alt
10007        c
10008        Ket
10009        End
10010------------------------------------------------------------------
10011    XabX
10012 0: ab
10013    XAbX
10014 0: Ab
10015    CcC
10016 0: c
10017\= Expect no match
10018    XABX
10019No match
10020
10021/(?i)a(?s)b|c/B
10022------------------------------------------------------------------
10023        Bra
10024     /i ab
10025        Alt
10026     /i c
10027        Ket
10028        End
10029------------------------------------------------------------------
10030
10031/(?i)a(?s-i)b|c/B
10032------------------------------------------------------------------
10033        Bra
10034     /i a
10035        b
10036        Alt
10037        c
10038        Ket
10039        End
10040------------------------------------------------------------------
10041
10042/^(ab(c\1)d|x){2}$/B
10043------------------------------------------------------------------
10044        Bra
10045        ^
10046        CBra 1
10047        ab
10048        CBra 2
10049        c
10050        \1
10051        Ket
10052        d
10053        Alt
10054        x
10055        Ket
10056        CBra 1
10057        ab
10058        CBra 2
10059        c
10060        \1
10061        Ket
10062        d
10063        Alt
10064        x
10065        Ket
10066        $
10067        Ket
10068        End
10069------------------------------------------------------------------
10070    xabcxd
10071 0: xabcxd
10072 1: abcxd
10073 2: cx
10074
10075/^(?&t)*+(?(DEFINE)(?<t>.))$/B
10076------------------------------------------------------------------
10077        Bra
10078        ^
10079        Braposzero
10080        SBraPos
10081        Recurse
10082        KetRpos
10083        Cond
10084        Cond false
10085        CBra 1
10086        Any
10087        Ket
10088        Ket
10089        $
10090        Ket
10091        End
10092------------------------------------------------------------------
10093
10094/^(?&t)*(?(DEFINE)(?<t>.))$/B
10095------------------------------------------------------------------
10096        Bra
10097        ^
10098        Brazero
10099        SBra
10100        Recurse
10101        KetRmax
10102        Cond
10103        Cond false
10104        CBra 1
10105        Any
10106        Ket
10107        Ket
10108        $
10109        Ket
10110        End
10111------------------------------------------------------------------
10112
10113# This one is here because Perl gives the match as "b" rather than "ab". I
10114# believe this to be a Perl bug.
10115
10116/(?>a\Kb)z|(ab)/
10117    ab\=startchar
10118 0: ab
10119 1: ab
10120
10121/(?P<L1>(?P<L2>0|)|(?P>L2)(?P>L1))/
10122    abcd
10123 0:
10124 1:
10125 2:
10126    0abc
10127 0: 0
10128 1: 0
10129 2: 0
10130
10131/abc(*MARK:)pqr/
10132Failed: error 166 at offset 10: (*MARK) must have an argument
10133
10134/abc(*:)pqr/
10135Failed: error 166 at offset 6: (*MARK) must have an argument
10136
10137/(*COMMIT:X)/B
10138------------------------------------------------------------------
10139        Bra
10140        *COMMIT X
10141        Ket
10142        End
10143------------------------------------------------------------------
10144
10145# This should, and does, fail. In Perl, it does not, which I think is a
10146# bug because replacing the B in the pattern by (B|D) does make it fail.
10147# Turning off Perl's optimization by inserting (??{""}) also makes it fail.
10148
10149/A(*COMMIT)B/aftertext,mark
10150\= Expect no match
10151    ACABX
10152No match
10153
10154# These should be different, but in Perl they are not, which I think
10155# is a bug in Perl.
10156
10157/A(*THEN)B|A(*THEN)C/mark
10158    AC
10159 0: AC
10160
10161/A(*PRUNE)B|A(*PRUNE)C/mark
10162\= Expect no match
10163    AC
10164No match
10165
10166# Mark names can be duplicated. Perl doesn't give a mark for this one,
10167# though PCRE2 does.
10168
10169/^A(*:A)B|^X(*:A)Y/mark
10170\= Expect no match
10171    XAQQ
10172No match, mark = A
10173
10174# COMMIT at the start of a pattern should be the same as an anchor. Perl
10175# optimizations defeat this. So does the PCRE2 optimization unless we disable
10176# it.
10177
10178/(*COMMIT)ABC/
10179    ABCDEFG
10180 0: ABC
10181
10182/(*COMMIT)ABC/no_start_optimize
10183\= Expect no match
10184    DEFGABC
10185No match
10186
10187/^(ab (c+(*THEN)cd) | xyz)/x
10188\= Expect no match
10189    abcccd
10190No match
10191
10192/^(ab (c+(*PRUNE)cd) | xyz)/x
10193\= Expect no match
10194    abcccd
10195No match
10196
10197/^(ab (c+(*FAIL)cd) | xyz)/x
10198\= Expect no match
10199    abcccd
10200No match
10201
10202# Perl gets some of these wrong
10203
10204/(?>.(*ACCEPT))*?5/
10205    abcde
10206 0: a
10207
10208/(.(*ACCEPT))*?5/
10209    abcde
10210 0: a
10211 1: a
10212
10213/(.(*ACCEPT))5/
10214    abcde
10215 0: a
10216 1: a
10217
10218/(.(*ACCEPT))*5/
10219    abcde
10220 0: a
10221 1: a
10222
10223/A\NB./B
10224------------------------------------------------------------------
10225        Bra
10226        A
10227        Any
10228        B
10229        Any
10230        Ket
10231        End
10232------------------------------------------------------------------
10233    ACBD
10234 0: ACBD
10235\= Expect no match
10236    A\nB
10237No match
10238    ACB\n
10239No match
10240
10241/A\NB./Bs
10242------------------------------------------------------------------
10243        Bra
10244        A
10245        Any
10246        B
10247        AllAny
10248        Ket
10249        End
10250------------------------------------------------------------------
10251    ACBD
10252 0: ACBD
10253    ACB\n
10254 0: ACB\x0a
10255\= Expect no match
10256    A\nB
10257No match
10258
10259/A\NB/newline=crlf
10260    A\nB
10261 0: A\x0aB
10262    A\rB
10263 0: A\x0dB
10264\= Expect no match
10265    A\r\nB
10266No match
10267
10268/\R+b/B
10269------------------------------------------------------------------
10270        Bra
10271        \R++
10272        b
10273        Ket
10274        End
10275------------------------------------------------------------------
10276
10277/\R+\n/B
10278------------------------------------------------------------------
10279        Bra
10280        \R+
10281        \x0a
10282        Ket
10283        End
10284------------------------------------------------------------------
10285
10286/\R+\d/B
10287------------------------------------------------------------------
10288        Bra
10289        \R++
10290        \d
10291        Ket
10292        End
10293------------------------------------------------------------------
10294
10295/\d*\R/B
10296------------------------------------------------------------------
10297        Bra
10298        \d*+
10299        \R
10300        Ket
10301        End
10302------------------------------------------------------------------
10303
10304/\s*\R/B
10305------------------------------------------------------------------
10306        Bra
10307        \s*
10308        \R
10309        Ket
10310        End
10311------------------------------------------------------------------
10312    \x20\x0a
10313 0:  \x0a
10314    \x20\x0d
10315 0:  \x0d
10316    \x20\x0d\x0a
10317 0:  \x0d\x0a
10318
10319/\S*\R/B
10320------------------------------------------------------------------
10321        Bra
10322        \S*+
10323        \R
10324        Ket
10325        End
10326------------------------------------------------------------------
10327    a\x0a
10328 0: a\x0a
10329
10330/X\h*\R/B
10331------------------------------------------------------------------
10332        Bra
10333        X
10334        \h*+
10335        \R
10336        Ket
10337        End
10338------------------------------------------------------------------
10339    X\x20\x0a
10340 0: X \x0a
10341
10342/X\H*\R/B
10343------------------------------------------------------------------
10344        Bra
10345        X
10346        \H*
10347        \R
10348        Ket
10349        End
10350------------------------------------------------------------------
10351    X\x0d\x0a
10352 0: X\x0d\x0a
10353
10354/X\H+\R/B
10355------------------------------------------------------------------
10356        Bra
10357        X
10358        \H+
10359        \R
10360        Ket
10361        End
10362------------------------------------------------------------------
10363    X\x0d\x0a
10364 0: X\x0d\x0a
10365
10366/X\H++\R/B
10367------------------------------------------------------------------
10368        Bra
10369        X
10370        \H++
10371        \R
10372        Ket
10373        End
10374------------------------------------------------------------------
10375\= Expect no match
10376    X\x0d\x0a
10377No match
10378
10379/(?<=abc)def/
10380    abc\=ph
10381Partial match:
10382
10383/abc$/
10384    abc
10385 0: abc
10386    abc\=ps
10387 0: abc
10388    abc\=ph
10389Partial match: abc
10390
10391/abc$/m
10392    abc
10393 0: abc
10394    abc\n
10395 0: abc
10396    abc\=ph
10397Partial match: abc
10398    abc\n\=ph
10399 0: abc
10400    abc\=ps
10401 0: abc
10402    abc\n\=ps
10403 0: abc
10404
10405/abc\z/
10406    abc
10407 0: abc
10408    abc\=ps
10409 0: abc
10410    abc\=ph
10411Partial match: abc
10412
10413/abc\Z/
10414    abc
10415 0: abc
10416    abc\=ps
10417 0: abc
10418    abc\=ph
10419Partial match: abc
10420
10421/abc\b/
10422    abc
10423 0: abc
10424    abc\=ps
10425 0: abc
10426    abc\=ph
10427Partial match: abc
10428
10429/abc\B/
10430    abc\=ps
10431Partial match: abc
10432    abc\=ph
10433Partial match: abc
10434\= Expect no match
10435    abc
10436No match
10437
10438/.+/
10439\= Bad offsets
10440    abc\=offset=4
10441Failed: error -33: bad offset value
10442    abc\=offset=-4
10443** Invalid value in 'offset=-4'
10444\= Valid data
10445    abc\=offset=0
10446 0: abc
10447    abc\=offset=1
10448 0: bc
10449    abc\=offset=2
10450 0: c
10451\= Expect no match
10452    abc\=offset=3
10453No match
10454
10455/^\cģ/
10456Failed: error 168 at offset 3: \c must be followed by a printable ASCII character
10457
10458/(?P<abn>(?P=abn)xxx)/B
10459------------------------------------------------------------------
10460        Bra
10461        CBra 1
10462        \1
10463        xxx
10464        Ket
10465        Ket
10466        End
10467------------------------------------------------------------------
10468
10469/(a\1z)/B
10470------------------------------------------------------------------
10471        Bra
10472        CBra 1
10473        a
10474        \1
10475        z
10476        Ket
10477        Ket
10478        End
10479------------------------------------------------------------------
10480
10481/(?P<abn>(?P=abn)(?<badstufxxx)/B
10482Failed: error 142 at offset 29: syntax error in subpattern name (missing terminator?)
10483
10484/(?P<abn>(?P=axn)xxx)/B
10485Failed: error 115 at offset 12: reference to non-existent subpattern
10486
10487/(?P<abn>(?P=axn)xxx)(?<axn>yy)/B
10488------------------------------------------------------------------
10489        Bra
10490        CBra 1
10491        \2
10492        xxx
10493        Ket
10494        CBra 2
10495        yy
10496        Ket
10497        Ket
10498        End
10499------------------------------------------------------------------
10500
10501# These tests are here because Perl gets the first one wrong.
10502
10503/(\R*)(.)/s
10504    \r\n
10505 0: \x0d
10506 1:
10507 2: \x0d
10508    \r\r\n\n\r
10509 0: \x0d\x0d\x0a\x0a\x0d
10510 1: \x0d\x0d\x0a\x0a
10511 2: \x0d
10512    \r\r\n\n\r\n
10513 0: \x0d\x0d\x0a\x0a\x0d
10514 1: \x0d\x0d\x0a\x0a
10515 2: \x0d
10516
10517/(\R)*(.)/s
10518    \r\n
10519 0: \x0d
10520 1: <unset>
10521 2: \x0d
10522    \r\r\n\n\r
10523 0: \x0d\x0d\x0a\x0a\x0d
10524 1: \x0a
10525 2: \x0d
10526    \r\r\n\n\r\n
10527 0: \x0d\x0d\x0a\x0a\x0d
10528 1: \x0a
10529 2: \x0d
10530
10531/((?>\r\n|\n|\x0b|\f|\r|\x85)*)(.)/s
10532    \r\n
10533 0: \x0d
10534 1:
10535 2: \x0d
10536    \r\r\n\n\r
10537 0: \x0d\x0d\x0a\x0a\x0d
10538 1: \x0d\x0d\x0a\x0a
10539 2: \x0d
10540    \r\r\n\n\r\n
10541 0: \x0d\x0d\x0a\x0a\x0d
10542 1: \x0d\x0d\x0a\x0a
10543 2: \x0d
10544
10545# -------------
10546
10547/^abc$/B
10548------------------------------------------------------------------
10549        Bra
10550        ^
10551        abc
10552        $
10553        Ket
10554        End
10555------------------------------------------------------------------
10556
10557/^abc$/Bm
10558------------------------------------------------------------------
10559        Bra
10560     /m ^
10561        abc
10562     /m $
10563        Ket
10564        End
10565------------------------------------------------------------------
10566
10567/^(a)*+(\w)/
10568    aaaaX
10569 0: aaaaX
10570 1: a
10571 2: X
10572\= Expect no match
10573    aaaa
10574No match
10575
10576/^(?:a)*+(\w)/
10577    aaaaX
10578 0: aaaaX
10579 1: X
10580\= Expect no match
10581    aaaa
10582No match
10583
10584/(a)++1234/IB
10585------------------------------------------------------------------
10586        Bra
10587        CBraPos 1
10588        a
10589        KetRpos
10590        1234
10591        Ket
10592        End
10593------------------------------------------------------------------
10594Capture group count = 1
10595First code unit = 'a'
10596Last code unit = '4'
10597Subject length lower bound = 5
10598
10599/([abc])++1234/I
10600Capture group count = 1
10601Starting code units: a b c
10602Last code unit = '4'
10603Subject length lower bound = 5
10604
10605/(?<=(abc)+)X/
10606Failed: error 125 at offset 0: lookbehind assertion is not fixed length
10607
10608/(^ab)/I
10609Capture group count = 1
10610Compile options: <none>
10611Overall options: anchored
10612First code unit = 'a'
10613Subject length lower bound = 2
10614
10615/(^ab)++/I
10616Capture group count = 1
10617Compile options: <none>
10618Overall options: anchored
10619First code unit = 'a'
10620Subject length lower bound = 2
10621
10622/(^ab|^)+/I
10623Capture group count = 1
10624May match empty string
10625Compile options: <none>
10626Overall options: anchored
10627Subject length lower bound = 0
10628
10629/(^ab|^)++/I
10630Capture group count = 1
10631May match empty string
10632Compile options: <none>
10633Overall options: anchored
10634Subject length lower bound = 0
10635
10636/(?:^ab)/I
10637Capture group count = 0
10638Compile options: <none>
10639Overall options: anchored
10640First code unit = 'a'
10641Subject length lower bound = 2
10642
10643/(?:^ab)++/I
10644Capture group count = 0
10645Compile options: <none>
10646Overall options: anchored
10647First code unit = 'a'
10648Subject length lower bound = 2
10649
10650/(?:^ab|^)+/I
10651Capture group count = 0
10652May match empty string
10653Compile options: <none>
10654Overall options: anchored
10655Subject length lower bound = 0
10656
10657/(?:^ab|^)++/I
10658Capture group count = 0
10659May match empty string
10660Compile options: <none>
10661Overall options: anchored
10662Subject length lower bound = 0
10663
10664/(.*ab)/I
10665Capture group count = 1
10666First code unit at start or follows newline
10667Last code unit = 'b'
10668Subject length lower bound = 2
10669
10670/(.*ab)++/I
10671Capture group count = 1
10672First code unit at start or follows newline
10673Last code unit = 'b'
10674Subject length lower bound = 2
10675
10676/(.*ab|.*)+/I
10677Capture group count = 1
10678May match empty string
10679First code unit at start or follows newline
10680Subject length lower bound = 0
10681
10682/(.*ab|.*)++/I
10683Capture group count = 1
10684May match empty string
10685First code unit at start or follows newline
10686Subject length lower bound = 0
10687
10688/(?:.*ab)/I
10689Capture group count = 0
10690First code unit at start or follows newline
10691Last code unit = 'b'
10692Subject length lower bound = 2
10693
10694/(?:.*ab)++/I
10695Capture group count = 0
10696First code unit at start or follows newline
10697Last code unit = 'b'
10698Subject length lower bound = 2
10699
10700/(?:.*ab|.*)+/I
10701Capture group count = 0
10702May match empty string
10703First code unit at start or follows newline
10704Subject length lower bound = 0
10705
10706/(?:.*ab|.*)++/I
10707Capture group count = 0
10708May match empty string
10709First code unit at start or follows newline
10710Subject length lower bound = 0
10711
10712/(?=a)[bcd]/I
10713Capture group count = 0
10714First code unit = 'a'
10715Subject length lower bound = 1
10716
10717/((?=a))[bcd]/I
10718Capture group count = 1
10719First code unit = 'a'
10720Subject length lower bound = 1
10721
10722/((?=a))+[bcd]/I
10723Capture group count = 1
10724First code unit = 'a'
10725Subject length lower bound = 1
10726
10727/((?=a))++[bcd]/I
10728Capture group count = 1
10729First code unit = 'a'
10730Subject length lower bound = 1
10731
10732/(?=a+)[bcd]/Ii
10733Capture group count = 0
10734Options: caseless
10735First code unit = 'a' (caseless)
10736Subject length lower bound = 1
10737
10738/(?=a+?)[bcd]/Ii
10739Capture group count = 0
10740Options: caseless
10741First code unit = 'a' (caseless)
10742Subject length lower bound = 1
10743
10744/(?=a++)[bcd]/Ii
10745Capture group count = 0
10746Options: caseless
10747First code unit = 'a' (caseless)
10748Subject length lower bound = 1
10749
10750/(?=a{3})[bcd]/Ii
10751Capture group count = 0
10752Options: caseless
10753First code unit = 'a' (caseless)
10754Last code unit = 'a' (caseless)
10755Subject length lower bound = 2
10756
10757/(abc)\1+/
10758
10759# Perl doesn't get these right IMO (the 3rd is PCRE2-specific)
10760
10761/(?1)(?:(b(*ACCEPT))){0}/
10762    b
10763 0: b
10764
10765/(?1)(?:(b(*ACCEPT))){0}c/
10766    bc
10767 0: bc
10768\= Expect no match
10769    b
10770No match
10771
10772/(?1)(?:((*ACCEPT))){0}c/
10773    c
10774 0: c
10775    c\=notempty
10776 0: c
10777
10778/^.*?(?(?=a)a|b(*THEN)c)/
10779\= Expect no match
10780    ba
10781No match
10782
10783/^.*?(?(?=a)a|bc)/
10784    ba
10785 0: ba
10786
10787/^.*?(?(?=a)a(*THEN)b|c)/
10788\= Expect no match
10789    ac
10790No match
10791
10792/^.*?(?(?=a)a(*THEN)b)c/
10793\= Expect no match
10794    ac
10795No match
10796
10797/^.*?(a(*THEN)b)c/
10798\= Expect no match
10799    aabc
10800No match
10801
10802/^.*? (?1) c (?(DEFINE)(a(*THEN)b))/x
10803    aabc
10804 0: aabc
10805
10806/^.*?(a(*THEN)b|z)c/
10807    aabc
10808 0: aabc
10809 1: ab
10810
10811/^.*?(z|a(*THEN)b)c/
10812    aabc
10813 0: aabc
10814 1: ab
10815
10816# These are here because they are not Perl-compatible; the studying means the
10817# mark is not seen.
10818
10819/(*MARK:A)(*SKIP:B)(C|X)/mark
10820    C
10821 0: C
10822 1: C
10823MK: A
10824\= Expect no match
10825    D
10826No match, mark = A
10827
10828/(*:A)A+(*SKIP:A)(B|Z)/mark
10829\= Expect no match
10830    AAAC
10831No match, mark = A
10832
10833# ----------------------------
10834
10835"(?=a*(*ACCEPT)b)c"
10836    c
10837 0: c
10838    c\=notempty
10839 0: c
10840
10841/(?1)c(?(DEFINE)((*ACCEPT)b))/
10842    c
10843 0: c
10844    c\=notempty
10845 0: c
10846
10847/(?>(*ACCEPT)b)c/
10848    c
10849 0:
10850\= Expect no match
10851    c\=notempty
10852No match
10853
10854/(?:(?>(a)))+a%/allaftertext
10855    %aa%
10856 0: aa%
10857 0+
10858 1: a
10859 1+ a%
10860
10861/(a)b|ac/allaftertext
10862    ac\=ovector=1
10863 0: ac
10864 0+
10865
10866/(a)(b)x|abc/allaftertext
10867     abc\=ovector=2
10868 0: abc
10869 0+
10870
10871/(a)bc|(a)(b)\2/
10872    abc\=ovector=1
10873Matched, but too many substrings
10874 0: abc
10875    abc\=ovector=2
10876 0: abc
10877 1: a
10878    aba\=ovector=1
10879Matched, but too many substrings
10880 0: aba
10881    aba\=ovector=2
10882Matched, but too many substrings
10883 0: aba
10884 1: <unset>
10885    aba\=ovector=3
10886Matched, but too many substrings
10887 0: aba
10888 1: <unset>
10889 2: a
10890    aba\=ovector=4
10891 0: aba
10892 1: <unset>
10893 2: a
10894 3: b
10895
10896/(?(DEFINE)(a(?2)|b)(b(?1)|a))(?:(?1)|(?2))/I
10897Capture group count = 2
10898May match empty string
10899Subject length lower bound = 0
10900
10901/(a(?2)|b)(b(?1)|a)(?:(?1)|(?2))/I
10902Capture group count = 2
10903Starting code units: a b
10904Subject length lower bound = 3
10905
10906/(a(?2)|b)(b(?1)|a)(?1)(?2)/I
10907Capture group count = 2
10908Starting code units: a b
10909Subject length lower bound = 4
10910
10911/(abc)(?1)/I
10912Capture group count = 1
10913First code unit = 'a'
10914Last code unit = 'c'
10915Subject length lower bound = 6
10916
10917/(?:(foo)|(bar)|(baz))X/allcaptures
10918    bazfooX
10919 0: fooX
10920 1: foo
10921 2: <unset>
10922 3: <unset>
10923    foobazbarX
10924 0: barX
10925 1: <unset>
10926 2: bar
10927 3: <unset>
10928    barfooX
10929 0: fooX
10930 1: foo
10931 2: <unset>
10932 3: <unset>
10933    bazX
10934 0: bazX
10935 1: <unset>
10936 2: <unset>
10937 3: baz
10938    foobarbazX
10939 0: bazX
10940 1: <unset>
10941 2: <unset>
10942 3: baz
10943    bazfooX\=ovector=0
10944 0: fooX
10945 1: foo
10946 2: <unset>
10947 3: <unset>
10948    bazfooX\=ovector=1
10949Matched, but too many substrings
10950 0: fooX
10951    bazfooX\=ovector=2
10952 0: fooX
10953 1: foo
10954    bazfooX\=ovector=3
10955 0: fooX
10956 1: foo
10957 2: <unset>
10958
10959/(?=abc){3}abc/B
10960------------------------------------------------------------------
10961        Bra
10962        Assert
10963        abc
10964        Ket
10965        Assert
10966        abc
10967        Ket
10968        Assert
10969        abc
10970        Ket
10971        abc
10972        Ket
10973        End
10974------------------------------------------------------------------
10975
10976/(?=abc)+abc/B
10977------------------------------------------------------------------
10978        Bra
10979        Assert
10980        abc
10981        Ket
10982        Brazero
10983        Assert
10984        abc
10985        Ket
10986        abc
10987        Ket
10988        End
10989------------------------------------------------------------------
10990
10991/(?=abc)++abc/B
10992------------------------------------------------------------------
10993        Bra
10994        Once
10995        Assert
10996        abc
10997        Ket
10998        Brazero
10999        Assert
11000        abc
11001        Ket
11002        Ket
11003        abc
11004        Ket
11005        End
11006------------------------------------------------------------------
11007
11008/(?=abc){0}xyz/B
11009------------------------------------------------------------------
11010        Bra
11011        Skip zero
11012        Assert
11013        abc
11014        Ket
11015        xyz
11016        Ket
11017        End
11018------------------------------------------------------------------
11019
11020/(?=(a))?./B
11021------------------------------------------------------------------
11022        Bra
11023        Brazero
11024        Assert
11025        CBra 1
11026        a
11027        Ket
11028        Ket
11029        Any
11030        Ket
11031        End
11032------------------------------------------------------------------
11033
11034/(?=(a))??./B
11035------------------------------------------------------------------
11036        Bra
11037        Braminzero
11038        Assert
11039        CBra 1
11040        a
11041        Ket
11042        Ket
11043        Any
11044        Ket
11045        End
11046------------------------------------------------------------------
11047
11048/^(?=(a)){0}b(?1)/B
11049------------------------------------------------------------------
11050        Bra
11051        ^
11052        Skip zero
11053        Assert
11054        CBra 1
11055        a
11056        Ket
11057        Ket
11058        b
11059        Recurse
11060        Ket
11061        End
11062------------------------------------------------------------------
11063
11064/(?(DEFINE)(a))?b(?1)/B
11065------------------------------------------------------------------
11066        Bra
11067        Cond
11068        Cond false
11069        CBra 1
11070        a
11071        Ket
11072        Ket
11073        b
11074        Recurse
11075        Ket
11076        End
11077------------------------------------------------------------------
11078
11079/^(?=(?1))?[az]([abc])d/B
11080------------------------------------------------------------------
11081        Bra
11082        ^
11083        Brazero
11084        Assert
11085        Recurse
11086        Ket
11087        [az]
11088        CBra 1
11089        [a-c]
11090        Ket
11091        d
11092        Ket
11093        End
11094------------------------------------------------------------------
11095
11096/^(?!a){0}\w+/B
11097------------------------------------------------------------------
11098        Bra
11099        ^
11100        Skip zero
11101        Assert not
11102        a
11103        Ket
11104        \w++
11105        Ket
11106        End
11107------------------------------------------------------------------
11108
11109/(?<=(abc))?xyz/B
11110------------------------------------------------------------------
11111        Bra
11112        Brazero
11113        Assert back
11114        Reverse
11115        CBra 1
11116        abc
11117        Ket
11118        Ket
11119        xyz
11120        Ket
11121        End
11122------------------------------------------------------------------
11123
11124/[:a[:abc]b:]/B
11125------------------------------------------------------------------
11126        Bra
11127        [:[a-c]
11128        b:]
11129        Ket
11130        End
11131------------------------------------------------------------------
11132
11133/^(a(*:A)(d|e(*:B))z|aeq)/auto_callout
11134    adz
11135--->adz
11136 +0 ^       ^
11137 +1 ^       (
11138 +2 ^       a
11139 +3 ^^      (*:A)
11140 +8 ^^      (
11141Latest Mark: A
11142 +9 ^^      d
11143+10 ^ ^     |
11144+18 ^ ^     z
11145+19 ^  ^    |
11146+24 ^  ^    End of pattern
11147 0: adz
11148 1: adz
11149 2: d
11150    aez
11151--->aez
11152 +0 ^       ^
11153 +1 ^       (
11154 +2 ^       a
11155 +3 ^^      (*:A)
11156 +8 ^^      (
11157Latest Mark: A
11158 +9 ^^      d
11159+11 ^^      e
11160+12 ^ ^     (*:B)
11161+17 ^ ^     )
11162Latest Mark: B
11163+18 ^ ^     z
11164+19 ^  ^    |
11165+24 ^  ^    End of pattern
11166 0: aez
11167 1: aez
11168 2: e
11169    aeqwerty
11170--->aeqwerty
11171 +0 ^            ^
11172 +1 ^            (
11173 +2 ^            a
11174 +3 ^^           (*:A)
11175 +8 ^^           (
11176Latest Mark: A
11177 +9 ^^           d
11178+11 ^^           e
11179+12 ^ ^          (*:B)
11180+17 ^ ^          )
11181Latest Mark: B
11182+18 ^ ^          z
11183+20 ^            a
11184+21 ^^           e
11185+22 ^ ^          q
11186+23 ^  ^         )
11187+24 ^  ^         End of pattern
11188 0: aeq
11189 1: aeq
11190
11191/.(*F)/
11192\= Expect no match
11193    abc\=ph
11194No match
11195
11196/\btype\b\W*?\btext\b\W*?\bjavascript\b/I
11197Capture group count = 0
11198Max lookbehind = 1
11199First code unit = 't'
11200Last code unit = 't'
11201Subject length lower bound = 18
11202
11203/\btype\b\W*?\btext\b\W*?\bjavascript\b|\burl\b\W*?\bshell:|<input\b.*?\btype\b\W*?\bimage\b|\bonkeyup\b\W*?\=/I
11204Capture group count = 0
11205Max lookbehind = 1
11206Starting code units: < o t u
11207Subject length lower bound = 8
11208
11209/a(*SKIP)c|b(*ACCEPT)|/I,aftertext
11210Capture group count = 0
11211May match empty string
11212Subject length lower bound = 0
11213    a
11214 0:
11215 0+
11216
11217/a(*SKIP)c|b(*ACCEPT)cd(*ACCEPT)|x/I
11218Capture group count = 0
11219Starting code units: a b x
11220Subject length lower bound = 1
11221    ax
11222 0: x
11223
11224'a*(*ACCEPT)b'aftertext
11225    abc\=notempty_atstart
11226 0: a
11227 0+ bc
11228    bbb\=notempty_atstart
11229 0:
11230 0+ bb
11231\= Expect no match
11232    \=notempty_atstart
11233No match
11234
11235/(*ACCEPT)a/I,aftertext
11236Capture group count = 0
11237May match empty string
11238Subject length lower bound = 0
11239    bax
11240 0:
11241 0+ bax
11242
11243/z(*ACCEPT)a/I,aftertext
11244Capture group count = 0
11245First code unit = 'z'
11246Subject length lower bound = 1
11247    baxzbx
11248 0: z
11249 0+ bx
11250
11251/^(?>a+)(?>(z+))\w/B
11252------------------------------------------------------------------
11253        Bra
11254        ^
11255        Once
11256        a++
11257        Ket
11258        Once
11259        CBra 1
11260        z++
11261        Ket
11262        Ket
11263        \w
11264        Ket
11265        End
11266------------------------------------------------------------------
11267    aaaazzzzb
11268 0: aaaazzzzb
11269 1: zzzz
11270\= Expect no match
11271    aazz
11272No match
11273
11274/(.)(\1|a(?2))/
11275    bab
11276 0: bab
11277 1: b
11278 2: ab
11279
11280/\1|(.)(?R)\1/
11281    cbbbc
11282 0: cbbbc
11283 1: c
11284
11285/(.)((?(1)c|a)|a(?2))/
11286\= Expect no match
11287    baa
11288No match
11289
11290/(?P<abn>(?P=abn)xxx)/B
11291------------------------------------------------------------------
11292        Bra
11293        CBra 1
11294        \1
11295        xxx
11296        Ket
11297        Ket
11298        End
11299------------------------------------------------------------------
11300
11301/(a\1z)/B
11302------------------------------------------------------------------
11303        Bra
11304        CBra 1
11305        a
11306        \1
11307        z
11308        Ket
11309        Ket
11310        End
11311------------------------------------------------------------------
11312
11313/^a\x41z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11314    aAz
11315 0: aAz
11316\= Expect no match
11317    ax41z
11318No match
11319
11320/^a[m\x41]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11321    aAz
11322 0: aAz
11323
11324/^a\x1z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11325    ax1z
11326 0: ax1z
11327
11328/^a\u0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11329    aAz
11330 0: aAz
11331\= Expect no match
11332    au0041z
11333No match
11334
11335/^a[m\u0041]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11336    aAz
11337 0: aAz
11338
11339/^a\u041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11340    au041z
11341 0: au041z
11342\= Expect no match
11343    aAz
11344No match
11345
11346/^a\U0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11347    aU0041z
11348 0: aU0041z
11349\= Expect no match
11350    aAz
11351No match
11352
11353/^\u{7a}/alt_bsux
11354    u{7a}
11355 0: u{7a}
11356\= Expect no match
11357    zoo
11358No match
11359
11360/^\u{7a}/extra_alt_bsux
11361    zoo
11362 0: z
11363
11364/(?(?=c)c|d)++Y/B
11365------------------------------------------------------------------
11366        Bra
11367        BraPos
11368        Cond
11369        Assert
11370        c
11371        Ket
11372        c
11373        Alt
11374        d
11375        Ket
11376        KetRpos
11377        Y
11378        Ket
11379        End
11380------------------------------------------------------------------
11381
11382/(?(?=c)c|d)*+Y/B
11383------------------------------------------------------------------
11384        Bra
11385        Braposzero
11386        BraPos
11387        Cond
11388        Assert
11389        c
11390        Ket
11391        c
11392        Alt
11393        d
11394        Ket
11395        KetRpos
11396        Y
11397        Ket
11398        End
11399------------------------------------------------------------------
11400
11401/a[\NB]c/
11402Failed: error 171 at offset 4: \N is not supported in a class
11403    aNc
11404
11405/a[B-\Nc]/
11406Failed: error 150 at offset 6: invalid range in character class
11407
11408/a[B\Nc]/
11409Failed: error 171 at offset 5: \N is not supported in a class
11410
11411/(a)(?2){0,1999}?(b)/
11412
11413/(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/
11414
11415# This test, with something more complicated than individual letters, causes
11416# different behaviour in Perl. Perhaps it disables some optimization; no tag is
11417# passed back for the failures, whereas in PCRE2 there is a tag.
11418
11419/(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/x,mark
11420    AABC
11421 0: AB
11422 1: A
11423 2: B
11424MK: A
11425    XXYZ
11426 0: XXY
11427 1: <unset>
11428 2: <unset>
11429 3: X
11430 4: X
11431 5: Y
11432MK: B
11433\= Expect no match
11434    XAQQ
11435No match, mark = A
11436    XAQQXZZ
11437No match, mark = A
11438    AXQQQ
11439No match, mark = A
11440    AXXQQQ
11441No match, mark = B
11442
11443# Perl doesn't give marks for these, though it does if the alternatives are
11444# replaced by single letters.
11445
11446/(b|q)(*:m)f|a(*:n)w/mark
11447    aw
11448 0: aw
11449MK: n
11450\= Expect no match
11451    abc
11452No match, mark = m
11453
11454/(q|b)(*:m)f|a(*:n)w/mark
11455    aw
11456 0: aw
11457MK: n
11458\= Expect no match
11459    abc
11460No match, mark = m
11461
11462# After a partial match, the behaviour is as for a failure.
11463
11464/^a(*:X)bcde/mark
11465   abc\=ps
11466Partial match, mark=X: abc
11467
11468# These are here because Perl doesn't return a mark, except for the first.
11469
11470/(?=(*:x))(q|)/aftertext,mark
11471    abc
11472 0:
11473 0+ abc
11474 1:
11475MK: x
11476
11477/(?=(*:x))((*:y)q|)/aftertext,mark
11478    abc
11479 0:
11480 0+ abc
11481 1:
11482MK: x
11483
11484/(?=(*:x))(?:(*:y)q|)/aftertext,mark
11485    abc
11486 0:
11487 0+ abc
11488MK: x
11489
11490/(?=(*:x))(?>(*:y)q|)/aftertext,mark
11491    abc
11492 0:
11493 0+ abc
11494MK: x
11495
11496/(?=a(*:x))(?!a(*:y)c)/aftertext,mark
11497    ab
11498 0:
11499 0+ ab
11500MK: x
11501
11502/(?=a(*:x))(?=a(*:y)c|)/aftertext,mark
11503    ab
11504 0:
11505 0+ ab
11506MK: x
11507
11508/(..)\1/
11509    ab\=ps
11510Partial match: ab
11511    aba\=ps
11512Partial match: aba
11513    abab\=ps
11514 0: abab
11515 1: ab
11516
11517/(..)\1/i
11518    ab\=ps
11519Partial match: ab
11520    abA\=ps
11521Partial match: abA
11522    aBAb\=ps
11523 0: aBAb
11524 1: aB
11525
11526/(..)\1{2,}/
11527    ab\=ps
11528Partial match: ab
11529    aba\=ps
11530Partial match: aba
11531    abab\=ps
11532Partial match: abab
11533    ababa\=ps
11534Partial match: ababa
11535    ababab\=ps
11536 0: ababab
11537 1: ab
11538    ababab\=ph
11539Partial match: ababab
11540    abababa\=ps
11541 0: ababab
11542 1: ab
11543    abababa\=ph
11544Partial match: abababa
11545
11546/(..)\1{2,}/i
11547    ab\=ps
11548Partial match: ab
11549    aBa\=ps
11550Partial match: aBa
11551    aBAb\=ps
11552Partial match: aBAb
11553    AbaBA\=ps
11554Partial match: AbaBA
11555    abABAb\=ps
11556 0: abABAb
11557 1: ab
11558    aBAbaB\=ph
11559Partial match: aBAbaB
11560    abABabA\=ps
11561 0: abABab
11562 1: ab
11563    abaBABa\=ph
11564Partial match: abaBABa
11565
11566/(..)\1{2,}?x/i
11567    ab\=ps
11568Partial match: ab
11569    abA\=ps
11570Partial match: abA
11571    aBAb\=ps
11572Partial match: aBAb
11573    abaBA\=ps
11574Partial match: abaBA
11575    abAbaB\=ps
11576Partial match: abAbaB
11577    abaBabA\=ps
11578Partial match: abaBabA
11579    abAbABaBx\=ps
11580 0: abAbABaBx
11581 1: ab
11582
11583/^(..)\1/
11584    aba\=ps
11585Partial match: aba
11586
11587/^(..)\1{2,3}x/
11588    aba\=ps
11589Partial match: aba
11590    ababa\=ps
11591Partial match: ababa
11592    ababa\=ph
11593Partial match: ababa
11594    abababx
11595 0: abababx
11596 1: ab
11597    ababababx
11598 0: ababababx
11599 1: ab
11600
11601/^(..)\1{2,3}?x/
11602    aba\=ps
11603Partial match: aba
11604    ababa\=ps
11605Partial match: ababa
11606    ababa\=ph
11607Partial match: ababa
11608    abababx
11609 0: abababx
11610 1: ab
11611    ababababx
11612 0: ababababx
11613 1: ab
11614
11615/^(..)(\1{2,3})ab/
11616    abababab
11617 0: abababab
11618 1: ab
11619 2: abab
11620
11621/^\R/
11622    \r\=ps
11623 0: \x0d
11624    \r\=ph
11625Partial match: \x0d
11626
11627/^\R{2,3}x/
11628    \r\=ps
11629Partial match: \x0d
11630    \r\=ph
11631Partial match: \x0d
11632    \r\r\=ps
11633Partial match: \x0d\x0d
11634    \r\r\=ph
11635Partial match: \x0d\x0d
11636    \r\r\r\=ps
11637Partial match: \x0d\x0d\x0d
11638    \r\r\r\=ph
11639Partial match: \x0d\x0d\x0d
11640    \r\rx
11641 0: \x0d\x0dx
11642    \r\r\rx
11643 0: \x0d\x0d\x0dx
11644
11645/^\R{2,3}?x/
11646    \r\=ps
11647Partial match: \x0d
11648    \r\=ph
11649Partial match: \x0d
11650    \r\r\=ps
11651Partial match: \x0d\x0d
11652    \r\r\=ph
11653Partial match: \x0d\x0d
11654    \r\r\r\=ps
11655Partial match: \x0d\x0d\x0d
11656    \r\r\r\=ph
11657Partial match: \x0d\x0d\x0d
11658    \r\rx
11659 0: \x0d\x0dx
11660    \r\r\rx
11661 0: \x0d\x0d\x0dx
11662
11663/^\R?x/
11664    \r\=ps
11665Partial match: \x0d
11666    \r\=ph
11667Partial match: \x0d
11668    x
11669 0: x
11670    \rx
11671 0: \x0dx
11672
11673/^\R+x/
11674    \r\=ps
11675Partial match: \x0d
11676    \r\=ph
11677Partial match: \x0d
11678    \r\n\=ps
11679Partial match: \x0d\x0a
11680    \r\n\=ph
11681Partial match: \x0d\x0a
11682    \rx
11683 0: \x0dx
11684
11685/^a$/newline=crlf
11686    a\r\=ps
11687Partial match: a\x0d
11688    a\r\=ph
11689Partial match: a\x0d
11690
11691/^a$/m,newline=crlf
11692    a\r\=ps
11693Partial match: a\x0d
11694    a\r\=ph
11695Partial match: a\x0d
11696
11697/^(a$|a\r)/newline=crlf
11698    a\r\=ps
11699 0: a\x0d
11700 1: a\x0d
11701    a\r\=ph
11702Partial match: a\x0d
11703
11704/^(a$|a\r)/m,newline=crlf
11705    a\r\=ps
11706 0: a\x0d
11707 1: a\x0d
11708    a\r\=ph
11709Partial match: a\x0d
11710
11711/./newline=crlf
11712    \r\=ps
11713 0: \x0d
11714    \r\=ph
11715Partial match: \x0d
11716
11717/.{2,3}/newline=crlf
11718    \r\=ps
11719Partial match: \x0d
11720    \r\=ph
11721Partial match: \x0d
11722    \r\r\=ps
11723 0: \x0d\x0d
11724    \r\r\=ph
11725Partial match: \x0d\x0d
11726    \r\r\r\=ps
11727 0: \x0d\x0d\x0d
11728    \r\r\r\=ph
11729Partial match: \x0d\x0d\x0d
11730
11731/.{2,3}?/newline=crlf
11732    \r\=ps
11733Partial match: \x0d
11734    \r\=ph
11735Partial match: \x0d
11736    \r\r\=ps
11737 0: \x0d\x0d
11738    \r\r\=ph
11739Partial match: \x0d\x0d
11740    \r\r\r\=ps
11741 0: \x0d\x0d
11742    \r\r\r\=ph
11743 0: \x0d\x0d
11744
11745"AB(C(D))(E(F))?(?(?=\2)(?=\4))"
11746    ABCDGHI\=ovector=01
11747Matched, but too many substrings
11748 0: ABCD
11749
11750# These are all run as real matches in test 1; here we are just checking the
11751# settings of the anchored and startline bits.
11752
11753/(?>.*?a)(?<=ba)/I
11754Capture group count = 0
11755Max lookbehind = 2
11756Last code unit = 'a'
11757Subject length lower bound = 1
11758
11759/(?:.*?a)(?<=ba)/I
11760Capture group count = 0
11761Max lookbehind = 2
11762First code unit at start or follows newline
11763Last code unit = 'a'
11764Subject length lower bound = 1
11765
11766/.*?a(*PRUNE)b/I
11767Capture group count = 0
11768Last code unit = 'b'
11769Subject length lower bound = 2
11770
11771/.*?a(*PRUNE)b/Is
11772Capture group count = 0
11773Options: dotall
11774Last code unit = 'b'
11775Subject length lower bound = 2
11776
11777/^a(*PRUNE)b/Is
11778Capture group count = 0
11779Compile options: dotall
11780Overall options: anchored dotall
11781First code unit = 'a'
11782Subject length lower bound = 2
11783
11784/.*?a(*SKIP)b/I
11785Capture group count = 0
11786Last code unit = 'b'
11787Subject length lower bound = 2
11788
11789/(?>.*?a)b/Is
11790Capture group count = 0
11791Options: dotall
11792Last code unit = 'b'
11793Subject length lower bound = 2
11794
11795/(?>.*?a)b/I
11796Capture group count = 0
11797Last code unit = 'b'
11798Subject length lower bound = 2
11799
11800/(?>^a)b/Is
11801Capture group count = 0
11802Compile options: dotall
11803Overall options: anchored dotall
11804First code unit = 'a'
11805Subject length lower bound = 2
11806
11807/(?>.*?)(?<=(abcd)|(wxyz))/I
11808Capture group count = 2
11809Max lookbehind = 4
11810May match empty string
11811Subject length lower bound = 0
11812
11813/(?>.*)(?<=(abcd)|(wxyz))/I
11814Capture group count = 2
11815Max lookbehind = 4
11816May match empty string
11817Subject length lower bound = 0
11818
11819"(?>.*)foo"I
11820Capture group count = 0
11821Last code unit = 'o'
11822Subject length lower bound = 3
11823
11824"(?>.*?)foo"I
11825Capture group count = 0
11826Last code unit = 'o'
11827Subject length lower bound = 3
11828
11829/(?>^abc)/Im
11830Capture group count = 0
11831Options: multiline
11832First code unit at start or follows newline
11833Last code unit = 'c'
11834Subject length lower bound = 3
11835
11836/(?>.*abc)/Im
11837Capture group count = 0
11838Options: multiline
11839Last code unit = 'c'
11840Subject length lower bound = 3
11841
11842/(?:.*abc)/Im
11843Capture group count = 0
11844Options: multiline
11845First code unit at start or follows newline
11846Last code unit = 'c'
11847Subject length lower bound = 3
11848
11849/(?:(a)+(?C1)bb|aa(?C2)b)/
11850    aab\=callout_capture
11851Callout 1: last capture = 1
11852 1: a
11853--->aab
11854    ^ ^     b
11855Callout 1: last capture = 1
11856 1: a
11857--->aab
11858    ^^      b
11859Callout 2: last capture = 0
11860--->aab
11861    ^ ^     b
11862 0: aab
11863
11864/(?:(a)++(?C1)bb|aa(?C2)b)/
11865    aab\=callout_capture
11866Callout 1: last capture = 1
11867 1: a
11868--->aab
11869    ^ ^     b
11870Callout 2: last capture = 0
11871--->aab
11872    ^ ^     b
11873 0: aab
11874
11875/(?:(?>(a))(?C1)bb|aa(?C2)b)/
11876    aab\=callout_capture
11877Callout 1: last capture = 1
11878 1: a
11879--->aab
11880    ^^      b
11881Callout 2: last capture = 0
11882--->aab
11883    ^ ^     b
11884 0: aab
11885
11886/(?:(?1)(?C1)x|ab(?C2))((a)){0}/
11887    aab\=callout_capture
11888Callout 1: last capture = 0
11889--->aab
11890    ^^      x
11891Callout 1: last capture = 0
11892--->aab
11893     ^^     x
11894Callout 2: last capture = 0
11895--->aab
11896     ^ ^    )
11897 0: ab
11898
11899/(?1)(?C1)((a)(?C2)){0}/
11900    aab\=callout_capture
11901Callout 2: last capture = 2
11902 1: <unset>
11903 2: a
11904--->aab
11905    ^^      ){0}
11906Callout 1: last capture = 0
11907--->aab
11908    ^^      (
11909 0: a
11910
11911/(?:(a)+(?C1)bb|aa(?C2)b)++/
11912    aab\=callout_capture
11913Callout 1: last capture = 1
11914 1: a
11915--->aab
11916    ^ ^     b
11917Callout 1: last capture = 1
11918 1: a
11919--->aab
11920    ^^      b
11921Callout 2: last capture = 0
11922--->aab
11923    ^ ^     b
11924 0: aab
11925    aab\=callout_capture,ovector=1
11926Callout 1: last capture = 1
11927 1: a
11928--->aab
11929    ^ ^     b
11930Callout 1: last capture = 1
11931 1: a
11932--->aab
11933    ^^      b
11934Callout 2: last capture = 0
11935--->aab
11936    ^ ^     b
11937 0: aab
11938
11939/(ab)x|ab/
11940    ab\=ovector=0
11941 0: ab
11942    ab\=ovector=1
11943 0: ab
11944
11945/(?<=123)(*MARK:xx)abc/mark
11946    xxxx123a\=ph
11947Partial match, mark=xx: a
11948    xxxx123a\=ps
11949Partial match, mark=xx: a
11950
11951/123\Kabc/startchar
11952    xxxx123a\=ph
11953Partial match: 123a
11954    xxxx123a\=ps
11955Partial match: 123a
11956
11957/^(?(?=a)aa|bb)/auto_callout
11958    bb
11959--->bb
11960 +0 ^      ^
11961 +1 ^      (?
11962 +3 ^      (?=
11963 +6 ^      a
11964+11 ^      b
11965+12 ^^     b
11966+13 ^ ^    )
11967+14 ^ ^    End of pattern
11968 0: bb
11969
11970/(?C1)^(?C2)(?(?C99)(?=(?C3)a(?C4))(?C5)a(?C6)a(?C7)|(?C8)b(?C9)b(?C10))(?C11)/
11971    bb
11972--->bb
11973  1 ^      ^
11974  2 ^      (?
11975 99 ^      (?=
11976  3 ^      a
11977  8 ^      b
11978  9 ^^     b
11979 10 ^ ^    )
11980 11 ^ ^    End of pattern
11981 0: bb
11982
11983# Perl seems to have a bug with this one.
11984
11985/aaaaa(*COMMIT)(*PRUNE)b|a+c/
11986    aaaaaac
11987 0: aaaac
11988
11989# Here are some that Perl treats differently because of the way it handles
11990# backtracking verbs.
11991
11992/(?!a(*COMMIT)b)ac|ad/
11993     ac
11994 0: ac
11995     ad
11996 0: ad
11997
11998/^(?!a(*THEN)b|ac)../
11999     ad
12000 0: ad
12001\= Expect no match
12002     ac
12003No match
12004
12005/^(?=a(*THEN)b|ac)/
12006    ac
12007 0:
12008
12009/\A.*?(?:a|b(*THEN)c)/
12010    ba
12011 0: ba
12012
12013/\A.*?(?:a|b(*THEN)c)++/
12014    ba
12015 0: ba
12016
12017/\A.*?(?:a|b(*THEN)c|d)/
12018    ba
12019 0: ba
12020
12021/(?:(a(*MARK:X)a+(*SKIP:X)b)){0}(?:(?1)|aac)/
12022    aac
12023 0: aac
12024
12025/\A.*?(a|b(*THEN)c)/
12026    ba
12027 0: ba
12028 1: a
12029
12030/^(A(*THEN)B|A(*THEN)D)/
12031    AD
12032 0: AD
12033 1: AD
12034
12035/(?!b(*THEN)a)bn|bnn/
12036    bnn
12037 0: bn
12038
12039/(?(?=b(*SKIP)a)bn|bnn)/
12040    bnn
12041 0: bnn
12042
12043/(?=b(*THEN)a|)bn|bnn/
12044    bnn
12045 0: bn
12046
12047# This test causes a segfault with Perl 5.18.0
12048
12049/^(?=(a)){0}b(?1)/
12050    backgammon
12051 0: ba
12052
12053/(?|(?<n>f)|(?<n>b))/I,dupnames
12054Capture group count = 1
12055Named capture groups:
12056  n   1
12057Options: dupnames
12058Starting code units: b f
12059Subject length lower bound = 1
12060
12061/(?<a>abc)(?<a>z)\k<a>()/IB,dupnames
12062------------------------------------------------------------------
12063        Bra
12064        CBra 1
12065        abc
12066        Ket
12067        CBra 2
12068        z
12069        Ket
12070        \k<a>2
12071        CBra 3
12072        Ket
12073        Ket
12074        End
12075------------------------------------------------------------------
12076Capture group count = 3
12077Max back reference = 2
12078Named capture groups:
12079  a   1
12080  a   2
12081Options: dupnames
12082First code unit = 'a'
12083Last code unit = 'z'
12084Subject length lower bound = 5
12085
12086/a*[bcd]/B
12087------------------------------------------------------------------
12088        Bra
12089        a*+
12090        [b-d]
12091        Ket
12092        End
12093------------------------------------------------------------------
12094
12095/[bcd]*a/B
12096------------------------------------------------------------------
12097        Bra
12098        [b-d]*+
12099        a
12100        Ket
12101        End
12102------------------------------------------------------------------
12103
12104# A complete set of tests for auto-possessification of character types, but
12105# omitting \C because it might be disabled (it has its own tests).
12106
12107/\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
12108------------------------------------------------------------------
12109        Bra
12110        \D+
12111        \D
12112        \D++
12113        \d
12114        \D+
12115        \S
12116        \D+
12117        \s
12118        \D+
12119        \W
12120        \D+
12121        \w
12122        \D+
12123        Any
12124        \D+
12125        \R
12126        \D+
12127        \H
12128        \D+
12129        \h
12130        \D+
12131        \V
12132        \D+
12133        \v
12134        \D+
12135        \Z
12136        \D++
12137        \z
12138        \D+
12139        $
12140        Ket
12141        End
12142------------------------------------------------------------------
12143
12144/\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
12145------------------------------------------------------------------
12146        Bra
12147        \d++
12148        \D
12149        \d+
12150        \d
12151        \d+
12152        \S
12153        \d++
12154        \s
12155        \d++
12156        \W
12157        \d+
12158        \w
12159        \d+
12160        Any
12161        \d++
12162        \R
12163        \d+
12164        \H
12165        \d++
12166        \h
12167        \d+
12168        \V
12169        \d++
12170        \v
12171        \d++
12172        \Z
12173        \d++
12174        \z
12175        \d++
12176        $
12177        Ket
12178        End
12179------------------------------------------------------------------
12180
12181/\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
12182------------------------------------------------------------------
12183        Bra
12184        \S+
12185        \D
12186        \S+
12187        \d
12188        \S+
12189        \S
12190        \S++
12191        \s
12192        \S+
12193        \W
12194        \S+
12195        \w
12196        \S+
12197        Any
12198        \S++
12199        \R
12200        \S+
12201        \H
12202        \S++
12203        \h
12204        \S+
12205        \V
12206        \S++
12207        \v
12208        \S++
12209        \Z
12210        \S++
12211        \z
12212        \S++
12213        $
12214        Ket
12215        End
12216------------------------------------------------------------------
12217
12218/\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
12219------------------------------------------------------------------
12220        Bra
12221        \s+
12222        \D
12223        \s++
12224        \d
12225        \s++
12226        \S
12227        \s+
12228        \s
12229        \s+
12230        \W
12231        \s++
12232        \w
12233        \s+
12234        Any
12235        \s+
12236        \R
12237        \s+
12238        \H
12239        \s+
12240        \h
12241        \s+
12242        \V
12243        \s+
12244        \v
12245        \s+
12246        \Z
12247        \s++
12248        \z
12249        \s+
12250        $
12251        Ket
12252        End
12253------------------------------------------------------------------
12254
12255/\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
12256------------------------------------------------------------------
12257        Bra
12258        \W+
12259        \D
12260        \W++
12261        \d
12262        \W+
12263        \S
12264        \W+
12265        \s
12266        \W+
12267        \W
12268        \W++
12269        \w
12270        \W+
12271        Any
12272        \W+
12273        \R
12274        \W+
12275        \H
12276        \W+
12277        \h
12278        \W+
12279        \V
12280        \W+
12281        \v
12282        \W+
12283        \Z
12284        \W++
12285        \z
12286        \W+
12287        $
12288        Ket
12289        End
12290------------------------------------------------------------------
12291
12292/\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
12293------------------------------------------------------------------
12294        Bra
12295        \w+
12296        \D
12297        \w+
12298        \d
12299        \w+
12300        \S
12301        \w++
12302        \s
12303        \w++
12304        \W
12305        \w+
12306        \w
12307        \w+
12308        Any
12309        \w++
12310        \R
12311        \w+
12312        \H
12313        \w++
12314        \h
12315        \w+
12316        \V
12317        \w++
12318        \v
12319        \w++
12320        \Z
12321        \w++
12322        \z
12323        \w++
12324        $
12325        Ket
12326        End
12327------------------------------------------------------------------
12328
12329/\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
12330------------------------------------------------------------------
12331        Bra
12332        \R+
12333        \D
12334        \R++
12335        \d
12336        \R+
12337        \S
12338        \R++
12339        \s
12340        \R+
12341        \W
12342        \R++
12343        \w
12344        \R++
12345        Any
12346        \R+
12347        \R
12348        \R+
12349        \H
12350        \R++
12351        \h
12352        \R+
12353        \V
12354        \R+
12355        \v
12356        \R+
12357        \Z
12358        \R++
12359        \z
12360        \R+
12361        $
12362        Ket
12363        End
12364------------------------------------------------------------------
12365
12366/\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
12367------------------------------------------------------------------
12368        Bra
12369        \H+
12370        \D
12371        \H+
12372        \d
12373        \H+
12374        \S
12375        \H+
12376        \s
12377        \H+
12378        \W
12379        \H+
12380        \w
12381        \H+
12382        Any
12383        \H+
12384        \R
12385        \H+
12386        \H
12387        \H++
12388        \h
12389        \H+
12390        \V
12391        \H+
12392        \v
12393        \H+
12394        \Z
12395        \H++
12396        \z
12397        \H+
12398        $
12399        Ket
12400        End
12401------------------------------------------------------------------
12402
12403/\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
12404------------------------------------------------------------------
12405        Bra
12406        \h+
12407        \D
12408        \h++
12409        \d
12410        \h++
12411        \S
12412        \h+
12413        \s
12414        \h+
12415        \W
12416        \h++
12417        \w
12418        \h+
12419        Any
12420        \h++
12421        \R
12422        \h++
12423        \H
12424        \h+
12425        \h
12426        \h+
12427        \V
12428        \h++
12429        \v
12430        \h+
12431        \Z
12432        \h++
12433        \z
12434        \h+
12435        $
12436        Ket
12437        End
12438------------------------------------------------------------------
12439
12440/\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
12441------------------------------------------------------------------
12442        Bra
12443        \V+
12444        \D
12445        \V+
12446        \d
12447        \V+
12448        \S
12449        \V+
12450        \s
12451        \V+
12452        \W
12453        \V+
12454        \w
12455        \V+
12456        Any
12457        \V++
12458        \R
12459        \V+
12460        \H
12461        \V+
12462        \h
12463        \V+
12464        \V
12465        \V++
12466        \v
12467        \V+
12468        \Z
12469        \V++
12470        \z
12471        \V+
12472        $
12473        Ket
12474        End
12475------------------------------------------------------------------
12476
12477/\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
12478------------------------------------------------------------------
12479        Bra
12480        \v+
12481        \D
12482        \v++
12483        \d
12484        \v++
12485        \S
12486        \v+
12487        \s
12488        \v+
12489        \W
12490        \v++
12491        \w
12492        \v+
12493        Any
12494        \v+
12495        \R
12496        \v+
12497        \H
12498        \v++
12499        \h
12500        \v++
12501        \V
12502        \v+
12503        \v
12504        \v+
12505        \Z
12506        \v++
12507        \z
12508        \v+
12509        $
12510        Ket
12511        End
12512------------------------------------------------------------------
12513
12514/ 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
12515------------------------------------------------------------------
12516        Bra
12517        a+
12518        \D
12519        a++
12520        \d
12521        a+
12522        \S
12523        a++
12524        \s
12525        a++
12526        \W
12527        a+
12528        \w
12529        a+
12530        Any
12531        a++
12532        \R
12533        a+
12534        \H
12535        a++
12536        \h
12537        a+
12538        \V
12539        a++
12540        \v
12541        a++
12542        \Z
12543        a++
12544        \z
12545        a++
12546        $
12547        Ket
12548        End
12549------------------------------------------------------------------
12550
12551/\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
12552------------------------------------------------------------------
12553        Bra
12554        \x0a+
12555        \D
12556        \x0a++
12557        \d
12558        \x0a++
12559        \S
12560        \x0a+
12561        \s
12562        \x0a+
12563        \W
12564        \x0a++
12565        \w
12566        \x0a+
12567        Any
12568        \x0a+
12569        \R
12570        \x0a+
12571        \H
12572        \x0a++
12573        \h
12574        \x0a++
12575        \V
12576        \x0a+
12577        \v
12578        \x0a+
12579        \Z
12580        \x0a++
12581        \z
12582        \x0a+
12583        $
12584        Ket
12585        End
12586------------------------------------------------------------------
12587
12588/ .+\D  .+\d  .+\S  .+\s  .+\W  .+\w  .+.  .+\R  .+\H  .+\h  .+\V  .+\v  .+\Z  .+\z  .+$/Bx
12589------------------------------------------------------------------
12590        Bra
12591        Any+
12592        \D
12593        Any+
12594        \d
12595        Any+
12596        \S
12597        Any+
12598        \s
12599        Any+
12600        \W
12601        Any+
12602        \w
12603        Any+
12604        Any
12605        Any++
12606        \R
12607        Any+
12608        \H
12609        Any+
12610        \h
12611        Any+
12612        \V
12613        Any+
12614        \v
12615        Any+
12616        \Z
12617        Any++
12618        \z
12619        Any+
12620        $
12621        Ket
12622        End
12623------------------------------------------------------------------
12624
12625/ .+\D  .+\d  .+\S  .+\s  .+\W  .+\w  .+.  .+\R  .+\H  .+\h  .+\V  .+\v  .+\Z  .+\z  .+$/Bsx
12626------------------------------------------------------------------
12627        Bra
12628        AllAny+
12629        \D
12630        AllAny+
12631        \d
12632        AllAny+
12633        \S
12634        AllAny+
12635        \s
12636        AllAny+
12637        \W
12638        AllAny+
12639        \w
12640        AllAny+
12641        AllAny
12642        AllAny+
12643        \R
12644        AllAny+
12645        \H
12646        AllAny+
12647        \h
12648        AllAny+
12649        \V
12650        AllAny+
12651        \v
12652        AllAny+
12653        \Z
12654        AllAny++
12655        \z
12656        AllAny+
12657        $
12658        Ket
12659        End
12660------------------------------------------------------------------
12661
12662/ \D+$  \d+$  \S+$  \s+$  \W+$  \w+$  \R+$  \H+$  \h+$  \V+$ \v+$  a+$   \n+$  .+$  .+$/Bmx
12663------------------------------------------------------------------
12664        Bra
12665        \D+
12666     /m $
12667        \d++
12668     /m $
12669        \S++
12670     /m $
12671        \s+
12672     /m $
12673        \W+
12674     /m $
12675        \w++
12676     /m $
12677        \R+
12678     /m $
12679        \H+
12680     /m $
12681        \h+
12682     /m $
12683        \V+
12684     /m $
12685        \v+
12686     /m $
12687        a+
12688     /m $
12689        \x0a+
12690     /m $
12691        Any+
12692     /m $
12693        Any+
12694     /m $
12695        Ket
12696        End
12697------------------------------------------------------------------
12698
12699/(?=a+)a(a+)++a/B
12700------------------------------------------------------------------
12701        Bra
12702        Assert
12703        a++
12704        Ket
12705        a
12706        CBraPos 1
12707        a+
12708        KetRpos
12709        a
12710        Ket
12711        End
12712------------------------------------------------------------------
12713
12714/a+(bb|cc)a+(?:bb|cc)a+(?>bb|cc)a+(?:bb|cc)+a+(aa)a+(?:bb|aa)/B
12715------------------------------------------------------------------
12716        Bra
12717        a++
12718        CBra 1
12719        bb
12720        Alt
12721        cc
12722        Ket
12723        a++
12724        Bra
12725        bb
12726        Alt
12727        cc
12728        Ket
12729        a++
12730        Once
12731        bb
12732        Alt
12733        cc
12734        Ket
12735        a++
12736        Bra
12737        bb
12738        Alt
12739        cc
12740        KetRmax
12741        a+
12742        CBra 2
12743        aa
12744        Ket
12745        a+
12746        Bra
12747        bb
12748        Alt
12749        aa
12750        Ket
12751        Ket
12752        End
12753------------------------------------------------------------------
12754
12755/a+(bb|cc)?#a+(?:bb|cc)??#a+(?:bb|cc)?+#a+(?:bb|cc)*#a+(bb|cc)?a#a+(?:aa)?/B
12756------------------------------------------------------------------
12757        Bra
12758        a++
12759        Brazero
12760        CBra 1
12761        bb
12762        Alt
12763        cc
12764        Ket
12765        #
12766        a++
12767        Braminzero
12768        Bra
12769        bb
12770        Alt
12771        cc
12772        Ket
12773        #
12774        a++
12775        Once
12776        Brazero
12777        Bra
12778        bb
12779        Alt
12780        cc
12781        Ket
12782        Ket
12783        #
12784        a++
12785        Brazero
12786        Bra
12787        bb
12788        Alt
12789        cc
12790        KetRmax
12791        #
12792        a+
12793        Brazero
12794        CBra 2
12795        bb
12796        Alt
12797        cc
12798        Ket
12799        a#
12800        a+
12801        Brazero
12802        Bra
12803        aa
12804        Ket
12805        Ket
12806        End
12807------------------------------------------------------------------
12808
12809/a+(?:bb)?a#a+(?:|||)#a+(?:|b)a#a+(?:|||)?a/B
12810------------------------------------------------------------------
12811        Bra
12812        a+
12813        Brazero
12814        Bra
12815        bb
12816        Ket
12817        a#
12818        a++
12819        Bra
12820        Alt
12821        Alt
12822        Alt
12823        Ket
12824        #
12825        a+
12826        Bra
12827        Alt
12828        b
12829        Ket
12830        a#
12831        a+
12832        Brazero
12833        Bra
12834        Alt
12835        Alt
12836        Alt
12837        Ket
12838        a
12839        Ket
12840        End
12841------------------------------------------------------------------
12842
12843/[ab]*/B
12844------------------------------------------------------------------
12845        Bra
12846        [ab]*+
12847        Ket
12848        End
12849------------------------------------------------------------------
12850    aaaa
12851 0: aaaa
12852
12853/[ab]*?/B
12854------------------------------------------------------------------
12855        Bra
12856        [ab]*?
12857        Ket
12858        End
12859------------------------------------------------------------------
12860    aaaa
12861 0:
12862
12863/[ab]?/B
12864------------------------------------------------------------------
12865        Bra
12866        [ab]?+
12867        Ket
12868        End
12869------------------------------------------------------------------
12870    aaaa
12871 0: a
12872
12873/[ab]??/B
12874------------------------------------------------------------------
12875        Bra
12876        [ab]??
12877        Ket
12878        End
12879------------------------------------------------------------------
12880    aaaa
12881 0:
12882
12883/[ab]+/B
12884------------------------------------------------------------------
12885        Bra
12886        [ab]++
12887        Ket
12888        End
12889------------------------------------------------------------------
12890    aaaa
12891 0: aaaa
12892
12893/[ab]+?/B
12894------------------------------------------------------------------
12895        Bra
12896        [ab]+?
12897        Ket
12898        End
12899------------------------------------------------------------------
12900    aaaa
12901 0: a
12902
12903/[ab]{2,3}/B
12904------------------------------------------------------------------
12905        Bra
12906        [ab]{2,3}+
12907        Ket
12908        End
12909------------------------------------------------------------------
12910    aaaa
12911 0: aaa
12912
12913/[ab]{2,3}?/B
12914------------------------------------------------------------------
12915        Bra
12916        [ab]{2,3}?
12917        Ket
12918        End
12919------------------------------------------------------------------
12920    aaaa
12921 0: aa
12922
12923/[ab]{2,}/B
12924------------------------------------------------------------------
12925        Bra
12926        [ab]{2,}+
12927        Ket
12928        End
12929------------------------------------------------------------------
12930    aaaa
12931 0: aaaa
12932
12933/[ab]{2,}?/B
12934------------------------------------------------------------------
12935        Bra
12936        [ab]{2,}?
12937        Ket
12938        End
12939------------------------------------------------------------------
12940    aaaa
12941 0: aa
12942
12943/\d+\s{0,5}=\s*\S?=\w{0,4}\W*/B
12944------------------------------------------------------------------
12945        Bra
12946        \d++
12947        \s{0,5}+
12948        =
12949        \s*+
12950        \S?
12951        =
12952        \w{0,4}+
12953        \W*+
12954        Ket
12955        End
12956------------------------------------------------------------------
12957
12958/[a-d]{5,12}[e-z0-9]*#[^a-z]+[b-y]*a[2-7]?[^0-9a-z]+/B
12959------------------------------------------------------------------
12960        Bra
12961        [a-d]{5,12}+
12962        [0-9e-z]*+
12963        #
12964        [\x00-`{-\xff] (neg)++
12965        [b-y]*+
12966        a
12967        [2-7]?+
12968        [\x00-/:-`{-\xff] (neg)++
12969        Ket
12970        End
12971------------------------------------------------------------------
12972
12973/[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
12974------------------------------------------------------------------
12975        Bra
12976        [a-z]*+
12977        \s
12978        #
12979        [\x09 ]?+
12980        \S
12981        #
12982        [a-c]*
12983        \S
12984        #
12985        [C-G]++
12986        \d
12987        #
12988        [4-8]*+
12989        \D
12990        #
12991        [,4-9]*
12992        \D
12993        #
12994        [!$]{0,5}+
12995        \w
12996        #
12997        [M-Xf-l]++
12998        \W
12999        #
13000        [,a-c]?
13001        \W
13002        Ket
13003        End
13004------------------------------------------------------------------
13005
13006/a+(aa|bb)*c#a*(bb|cc)*a#a?(bb|cc)*d#[a-f]*(g|hh)*f/B
13007------------------------------------------------------------------
13008        Bra
13009        a+
13010        Brazero
13011        CBra 1
13012        aa
13013        Alt
13014        bb
13015        KetRmax
13016        c#
13017        a*
13018        Brazero
13019        CBra 2
13020        bb
13021        Alt
13022        cc
13023        KetRmax
13024        a#
13025        a?+
13026        Brazero
13027        CBra 3
13028        bb
13029        Alt
13030        cc
13031        KetRmax
13032        d#
13033        [a-f]*
13034        Brazero
13035        CBra 4
13036        g
13037        Alt
13038        hh
13039        KetRmax
13040        f
13041        Ket
13042        End
13043------------------------------------------------------------------
13044
13045/[a-f]*(g|hh|i)*i#[a-x]{4,}(y{0,6})*y#[a-k]+(ll|mm)+n/B
13046------------------------------------------------------------------
13047        Bra
13048        [a-f]*+
13049        Brazero
13050        CBra 1
13051        g
13052        Alt
13053        hh
13054        Alt
13055        i
13056        KetRmax
13057        i#
13058        [a-x]{4,}
13059        Brazero
13060        SCBra 2
13061        y{0,6}
13062        KetRmax
13063        y#
13064        [a-k]++
13065        CBra 3
13066        ll
13067        Alt
13068        mm
13069        KetRmax
13070        n
13071        Ket
13072        End
13073------------------------------------------------------------------
13074
13075/[a-f]*(?>gg|hh)+#[a-f]*(?>gg|hh)?#[a-f]*(?>gg|hh)*a#[a-f]*(?>gg|hh)*h/B
13076------------------------------------------------------------------
13077        Bra
13078        [a-f]*+
13079        Once
13080        gg
13081        Alt
13082        hh
13083        KetRmax
13084        #
13085        [a-f]*+
13086        Brazero
13087        Once
13088        gg
13089        Alt
13090        hh
13091        Ket
13092        #
13093        [a-f]*
13094        Brazero
13095        Once
13096        gg
13097        Alt
13098        hh
13099        KetRmax
13100        a#
13101        [a-f]*+
13102        Brazero
13103        Once
13104        gg
13105        Alt
13106        hh
13107        KetRmax
13108        h
13109        Ket
13110        End
13111------------------------------------------------------------------
13112
13113/[a-c]*d/IB
13114------------------------------------------------------------------
13115        Bra
13116        [a-c]*+
13117        d
13118        Ket
13119        End
13120------------------------------------------------------------------
13121Capture group count = 0
13122Starting code units: a b c d
13123Last code unit = 'd'
13124Subject length lower bound = 1
13125
13126/[a-c]+d/IB
13127------------------------------------------------------------------
13128        Bra
13129        [a-c]++
13130        d
13131        Ket
13132        End
13133------------------------------------------------------------------
13134Capture group count = 0
13135Starting code units: a b c
13136Last code unit = 'd'
13137Subject length lower bound = 2
13138
13139/[a-c]?d/IB
13140------------------------------------------------------------------
13141        Bra
13142        [a-c]?+
13143        d
13144        Ket
13145        End
13146------------------------------------------------------------------
13147Capture group count = 0
13148Starting code units: a b c d
13149Last code unit = 'd'
13150Subject length lower bound = 1
13151
13152/[a-c]{4,6}d/IB
13153------------------------------------------------------------------
13154        Bra
13155        [a-c]{4,6}+
13156        d
13157        Ket
13158        End
13159------------------------------------------------------------------
13160Capture group count = 0
13161Starting code units: a b c
13162Last code unit = 'd'
13163Subject length lower bound = 5
13164
13165/[a-c]{0,6}d/IB
13166------------------------------------------------------------------
13167        Bra
13168        [a-c]{0,6}+
13169        d
13170        Ket
13171        End
13172------------------------------------------------------------------
13173Capture group count = 0
13174Starting code units: a b c d
13175Last code unit = 'd'
13176Subject length lower bound = 1
13177
13178# End of special auto-possessive tests
13179
13180/^A\o{1239}B/
13181Failed: error 164 at offset 8: non-octal character in \o{} (closing brace missing?)
13182    A\123B
13183
13184/^A\oB/
13185Failed: error 155 at offset 4: missing opening brace after \o
13186
13187/^A\x{zz}B/
13188Failed: error 167 at offset 5: non-hex character in \x{} (closing brace missing?)
13189
13190/^A\x{12Z/
13191Failed: error 167 at offset 7: non-hex character in \x{} (closing brace missing?)
13192
13193/^A\x{/
13194Failed: error 178 at offset 5: digits missing in \x{} or \o{} or \N{U+}
13195
13196/[ab]++/B,no_auto_possess
13197------------------------------------------------------------------
13198        Bra
13199        [ab]++
13200        Ket
13201        End
13202------------------------------------------------------------------
13203
13204/[^ab]*+/B,no_auto_possess
13205------------------------------------------------------------------
13206        Bra
13207        [\x00-`c-\xff] (neg)*+
13208        Ket
13209        End
13210------------------------------------------------------------------
13211
13212/a{4}+/B,no_auto_possess
13213------------------------------------------------------------------
13214        Bra
13215        a{4}
13216        Ket
13217        End
13218------------------------------------------------------------------
13219
13220/a{4}+/Bi,no_auto_possess
13221------------------------------------------------------------------
13222        Bra
13223     /i a{4}
13224        Ket
13225        End
13226------------------------------------------------------------------
13227
13228/[a-[:digit:]]+/
13229Failed: error 150 at offset 4: invalid range in character class
13230
13231/[A-[:digit:]]+/
13232Failed: error 150 at offset 4: invalid range in character class
13233
13234/[a-[.xxx.]]+/
13235Failed: error 150 at offset 4: invalid range in character class
13236
13237/[a-[=xxx=]]+/
13238Failed: error 150 at offset 4: invalid range in character class
13239
13240/[a-[!xxx!]]+/
13241Failed: error 108 at offset 3: range out of order in character class
13242
13243/[A-[!xxx!]]+/
13244    A]]]
13245 0: A]]]
13246
13247/[a-\d]+/
13248Failed: error 150 at offset 5: invalid range in character class
13249
13250/(?<0abc>xx)/
13251Failed: error 144 at offset 3: subpattern name must start with a non-digit
13252
13253/(?&1abc)xx(?<1abc>y)/
13254Failed: error 144 at offset 3: subpattern name must start with a non-digit
13255
13256/(?<ab-cd>xx)/
13257Failed: error 142 at offset 5: syntax error in subpattern name (missing terminator?)
13258
13259/(?'0abc'xx)/
13260Failed: error 144 at offset 3: subpattern name must start with a non-digit
13261
13262/(?P<0abc>xx)/
13263Failed: error 144 at offset 4: subpattern name must start with a non-digit
13264
13265/\k<5ghj>/
13266Failed: error 144 at offset 3: subpattern name must start with a non-digit
13267
13268/\k'5ghj'/
13269Failed: error 144 at offset 3: subpattern name must start with a non-digit
13270
13271/\k{2fgh}/
13272Failed: error 144 at offset 3: subpattern name must start with a non-digit
13273
13274/(?P=8yuki)/
13275Failed: error 144 at offset 4: subpattern name must start with a non-digit
13276
13277/\g{4df}/
13278Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
13279
13280/(?&1abc)xx(?<1abc>y)/
13281Failed: error 144 at offset 3: subpattern name must start with a non-digit
13282
13283/(?P>1abc)xx(?<1abc>y)/
13284Failed: error 144 at offset 4: subpattern name must start with a non-digit
13285
13286/\g'3gh'/
13287Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
13288
13289/\g<5fg>/
13290Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
13291
13292/(?(<4gh>)abc)/
13293Failed: error 144 at offset 4: subpattern name must start with a non-digit
13294
13295/(?('4gh')abc)/
13296Failed: error 144 at offset 4: subpattern name must start with a non-digit
13297
13298/(?(4gh)abc)/
13299Failed: error 124 at offset 4: missing closing parenthesis for condition
13300
13301/(?(R&6yh)abc)/
13302Failed: error 144 at offset 5: subpattern name must start with a non-digit
13303
13304/(((a\2)|(a*)\g<-1>))*a?/B
13305------------------------------------------------------------------
13306        Bra
13307        Brazero
13308        SCBra 1
13309        CBra 2
13310        CBra 3
13311        a
13312        \2
13313        Ket
13314        Alt
13315        CBra 4
13316        a*
13317        Ket
13318        Recurse
13319        Ket
13320        KetRmax
13321        a?+
13322        Ket
13323        End
13324------------------------------------------------------------------
13325
13326# Test the ugly "start or end of word" compatibility syntax.
13327
13328/[[:<:]]red[[:>:]]/B
13329------------------------------------------------------------------
13330        Bra
13331        \b
13332        Assert
13333        \w
13334        Ket
13335        red
13336        \b
13337        Assert back
13338        Reverse
13339        \w
13340        Ket
13341        Ket
13342        End
13343------------------------------------------------------------------
13344    little red riding hood
13345 0: red
13346    a /red/ thing
13347 0: red
13348    red is a colour
13349 0: red
13350    put it all on red
13351 0: red
13352\= Expect no match
13353    no reduction
13354No match
13355    Alfred Winifred
13356No match
13357
13358/[a[:<:]] should give error/
13359Failed: error 130 at offset 4: unknown POSIX class name
13360
13361/(?=ab\K)/aftertext
13362    abcd\=startchar
13363Start of matched string is beyond its end - displaying from end to start.
13364 0: ab
13365 0+ abcd
13366
13367/abcd/newline=lf,firstline
13368\= Expect no match
13369    xx\nxabcd
13370No match
13371
13372# Test stack guard external calls.
13373
13374/(((a)))/stackguard=1
13375Failed: error 133 at offset 7: parentheses are too deeply nested (stack check)
13376
13377/(((a)))/stackguard=2
13378Failed: error 133 at offset 7: parentheses are too deeply nested (stack check)
13379
13380/(((a)))/stackguard=3
13381
13382/(((((a)))))/
13383
13384# End stack guard tests
13385
13386/^\w+(?>\s*)(?<=\w)/B
13387------------------------------------------------------------------
13388        Bra
13389        ^
13390        \w+
13391        Once
13392        \s*+
13393        Ket
13394        Assert back
13395        Reverse
13396        \w
13397        Ket
13398        Ket
13399        End
13400------------------------------------------------------------------
13401
13402/\othing/
13403Failed: error 155 at offset 2: missing opening brace after \o
13404
13405/\o{}/
13406Failed: error 178 at offset 3: digits missing in \x{} or \o{} or \N{U+}
13407
13408/\o{whatever}/
13409Failed: error 164 at offset 3: non-octal character in \o{} (closing brace missing?)
13410
13411/\xthing/
13412
13413/\x{}/
13414Failed: error 178 at offset 3: digits missing in \x{} or \o{} or \N{U+}
13415
13416/\x{whatever}/
13417Failed: error 167 at offset 3: non-hex character in \x{} (closing brace missing?)
13418
13419/A\8B/
13420Failed: error 115 at offset 2: reference to non-existent subpattern
13421
13422/A\9B/
13423Failed: error 115 at offset 2: reference to non-existent subpattern
13424
13425# This one is here because Perl fails to match "12" for this pattern when the $
13426# is present.
13427
13428/^(?(?=abc)\w{3}:|\d\d)$/
13429    abc:
13430 0: abc:
13431    12
13432 0: 12
13433\= Expect no match
13434    123
13435No match
13436    xyz
13437No match
13438
13439# Perl gets this one wrong, giving "a" as the after text for ca and failing to
13440# match for cd.
13441
13442/(?(?=ab)ab)/aftertext
13443    abxxx
13444 0: ab
13445 0+ xxx
13446    ca
13447 0:
13448 0+ ca
13449    cd
13450 0:
13451 0+ cd
13452
13453# This should test both paths for processing OP_RECURSE.
13454
13455/(?(R)a+|(?R)b)/
13456    aaaabcde
13457 0: aaaab
13458    aaaabcde\=ovector=100
13459 0: aaaab
13460
13461/a*?b*?/
13462    ab
13463 0:
13464
13465/(*NOTEMPTY)a*?b*?/
13466    ab
13467 0: a
13468    ba
13469 0: b
13470    cb
13471 0: b
13472
13473/(*NOTEMPTY_ATSTART)a*?b*?/aftertext
13474    ab
13475 0: a
13476 0+ b
13477    cdab
13478 0:
13479 0+ dab
13480
13481/(?(VERSION>=10.0)yes|no)/I
13482Capture group count = 0
13483Subject length lower bound = 2
13484    yesno
13485 0: yes
13486
13487/(?(VERSION>=10.04)yes|no)/
13488    yesno
13489 0: yes
13490
13491/(?(VERSION=8)yes){3}/BI,aftertext
13492------------------------------------------------------------------
13493        Bra
13494        Cond
13495        Cond false
13496        yes
13497        Ket
13498        Ket
13499        End
13500------------------------------------------------------------------
13501Capture group count = 0
13502May match empty string
13503Subject length lower bound = 0
13504    yesno
13505 0:
13506 0+ yesno
13507
13508/(?(VERSION=8)yes|no){3}/I
13509Capture group count = 0
13510Subject length lower bound = 6
13511    yesnononoyes
13512 0: nonono
13513\= Expect no match
13514    yesno
13515No match
13516
13517/(?:(?<VERSION>abc)|xyz)(?(VERSION)yes|no)/I
13518Capture group count = 1
13519Max back reference = 1
13520Named capture groups:
13521  VERSION   1
13522Starting code units: a x
13523Subject length lower bound = 5
13524    abcyes
13525 0: abcyes
13526 1: abc
13527    xyzno
13528 0: xyzno
13529\= Expect no match
13530    abcno
13531No match
13532    xyzyes
13533No match
13534
13535/(?(VERSION<10)yes|no)/
13536Failed: error 179 at offset 10: syntax error or number too big in (?(VERSION condition
13537
13538/(?(VERSION>10)yes|no)/
13539Failed: error 179 at offset 11: syntax error or number too big in (?(VERSION condition
13540
13541/(?(VERSION>=10.0.0)yes|no)/
13542Failed: error 179 at offset 16: syntax error or number too big in (?(VERSION condition
13543
13544/(?(VERSION=10.101)yes|no)/
13545Failed: error 179 at offset 16: syntax error or number too big in (?(VERSION condition
13546
13547/abcd/I
13548Capture group count = 0
13549First code unit = 'a'
13550Last code unit = 'd'
13551Subject length lower bound = 4
13552
13553/abcd/I,no_start_optimize
13554Capture group count = 0
13555Options: no_start_optimize
13556
13557/(|ab)*?d/I
13558Capture group count = 1
13559Starting code units: a d
13560Last code unit = 'd'
13561Subject length lower bound = 1
13562   abd
13563 0: abd
13564 1: ab
13565   xyd
13566 0: d
13567
13568/(|ab)*?d/I,no_start_optimize
13569Capture group count = 1
13570Options: no_start_optimize
13571   abd
13572 0: abd
13573 1: ab
13574   xyd
13575 0: d
13576
13577/\k<A>*(?<A>aa)(?<A>bb)/match_unset_backref,dupnames
13578    aabb
13579 0: aabb
13580 1: aa
13581 2: bb
13582
13583/(((((a)))))/parens_nest_limit=2
13584Failed: error 119 at offset 3: parentheses are too deeply nested
13585
13586/abc/replace=XYZ
13587    123123
13588 0: 123123
13589    123abc123
13590 1: 123XYZ123
13591    123abc123abc123
13592 1: 123XYZ123abc123
13593    123123\=zero_terminate
13594 0: 123123
13595    123abc123\=zero_terminate
13596 1: 123XYZ123
13597    123abc123abc123\=zero_terminate
13598 1: 123XYZ123abc123
13599
13600/abc/g,replace=XYZ
13601    123abc123
13602 1: 123XYZ123
13603    123abc123abc123
13604 2: 123XYZ123XYZ123
13605
13606/abc/replace=X$$Z
13607    123abc123
13608 1: 123X$Z123
13609
13610/abc/g,replace=X$$Z
13611    123abc123abc123
13612 2: 123X$Z123X$Z123
13613
13614/a(b)c(d)e/replace=X$1Y${2}Z
13615    "abcde"
13616 1: "XbYdZ"
13617
13618/a(b)c(d)e/replace=X$1Y${2}Z,global
13619    "abcde-abcde"
13620 2: "XbYdZ-XbYdZ"
13621
13622/a(?<ONE>b)c(?<TWO>d)e/replace=X$ONE+${TWO}Z
13623    "abcde"
13624 1: "Xb+dZ"
13625
13626/a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z
13627    "abcde-abcde-"
13628 2: "Xb+dZ-Xb+dZ-"
13629
13630/abc/replace=a$++
13631    123abc
13632Failed: error -35 at offset 2 in replacement: invalid replacement string
13633
13634/abc/replace=a$bad
13635    123abc
13636Failed: error -49 at offset 5 in replacement: unknown substring
13637
13638/abc/replace=a${A234567890123456789_123456789012}z
13639    123abc
13640Failed: error -49 at offset 36 in replacement: unknown substring
13641
13642/abc/replace=a${A23456789012345678901234567890123}z
13643    123abc
13644Failed: error -35 at offset 35 in replacement: invalid replacement string
13645
13646/abc/replace=a${bcd
13647    123abc
13648Failed: error -58 at offset 6 in replacement: expected closing curly bracket in replacement string
13649
13650/abc/replace=a${b+d}z
13651    123abc
13652Failed: error -58 at offset 4 in replacement: expected closing curly bracket in replacement string
13653
13654/abc/replace=[10]XYZ
13655    123abc123
13656 1: 123XYZ123
13657
13658/abc/replace=[9]XYZ
13659    123abc123
13660Failed: error -48: no more memory
13661
13662/abc/replace=xyz
13663    1abc2\=partial_hard
13664Failed: error -34: bad option value
13665
13666/abc/replace=xyz
13667    123abc456
13668 1: 123xyz456
13669    123abc456\=replace=pqr
13670 1: 123pqr456
13671    123abc456abc789
13672 1: 123xyz456abc789
13673    123abc456abc789\=g
13674 2: 123xyz456xyz789
13675
13676/(?<=abc)(|def)/g,replace=<$0>
13677    123abcxyzabcdef789abcpqr
13678 4: 123abc<>xyzabc<><def>789abc<>pqr
13679
13680/./replace=$0
13681    a
13682 1: a
13683
13684/(.)(.)/replace=$2+$1
13685    abc
13686 1: b+ac
13687
13688/(?<A>.)(?<B>.)/replace=$B+$A
13689    abc
13690 1: b+ac
13691
13692/(.)(.)/g,replace=$2$1
13693    abcdefgh
13694 4: badcfehg
13695
13696/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=${*MARK}
13697    apple lemon blackberry
13698 3: pear orange strawberry
13699    apple strudel
13700 1: pear strudel
13701    fruitless
13702 0: fruitless
13703
13704/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} sauce,
13705    apple lemon blackberry
13706 1: pear sauce lemon blackberry
13707
13708/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK>
13709    apple lemon blackberry
13710 3: <pear> <orange> <strawberry>
13711    apple strudel
13712 1: <pear> strudel
13713    fruitless
13714 0: fruitless
13715
13716/(*:pear)apple/g,replace=${*MARKING}
13717    apple lemon blackberry
13718Failed: error -35 at offset 11 in replacement: invalid replacement string
13719
13720/(*:pear)apple/g,replace=${*MARK-time
13721    apple lemon blackberry
13722Failed: error -58 at offset 7 in replacement: expected closing curly bracket in replacement string
13723
13724/(*:pear)apple/g,replace=${*mark}
13725    apple lemon blackberry
13726Failed: error -35 at offset 8 in replacement: invalid replacement string
13727
13728/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARKET>
13729    apple lemon blackberry
13730Failed: error -35 at offset 9 in replacement: invalid replacement string
13731
13732/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[22]${*MARK}
13733    apple lemon blackberry
13734Failed: error -48: no more memory
13735    apple lemon blackberry\=substitute_overflow_length
13736Failed: error -48: no more memory: 23 code units are needed
13737
13738/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[23]${*MARK}
13739    apple lemon blackberry
13740 3: pear orange strawberry
13741
13742/abc/
13743    123abc123\=replace=[9]XYZ
13744Failed: error -48: no more memory
13745    123abc123\=substitute_overflow_length,replace=[9]XYZ
13746Failed: error -48: no more memory: 10 code units are needed
13747    123abc123\=substitute_overflow_length,replace=[6]XYZ
13748Failed: error -48: no more memory: 10 code units are needed
13749    123abc123\=substitute_overflow_length,replace=[1]XYZ
13750Failed: error -48: no more memory: 10 code units are needed
13751    123abc123\=substitute_overflow_length,replace=[0]XYZ
13752Failed: error -48: no more memory: 10 code units are needed
13753
13754/a(b)c/
13755    123abc123\=replace=[9]x$1z
13756Failed: error -48: no more memory
13757    123abc123\=substitute_overflow_length,replace=[9]x$1z
13758Failed: error -48: no more memory: 10 code units are needed
13759    123abc123\=substitute_overflow_length,replace=[6]x$1z
13760Failed: error -48: no more memory: 10 code units are needed
13761    123abc123\=substitute_overflow_length,replace=[1]x$1z
13762Failed: error -48: no more memory: 10 code units are needed
13763    123abc123\=substitute_overflow_length,replace=[0]x$1z
13764Failed: error -48: no more memory: 10 code units are needed
13765
13766"((?=(?(?=(?(?=(?(?=()))))))))"
13767    a
13768 0:
13769 1:
13770 2:
13771
13772"(?(?=)==)(((((((((?=)))))))))"
13773\= Expect no match
13774    a
13775No match
13776
13777/(a)(b)|(c)/
13778    XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
13779Matched, but too many substrings
13780 0: c
13781 1: <unset>
13782Get substring 1 failed (-55): requested value is not set
13783Get substring 2 failed (-54): requested value is not available
13784Get substring 3 failed (-54): requested value is not available
13785Get substring 4 failed (-49): unknown substring
13786 0L c
13787 1L
13788
13789/x(?=ab\K)/
13790    xab\=get=0
13791Start of matched string is beyond its end - displaying from end to start.
13792 0: ab
13793 0G  (0)
13794    xab\=copy=0
13795Start of matched string is beyond its end - displaying from end to start.
13796 0: ab
13797 0C  (0)
13798    xab\=getall
13799Start of matched string is beyond its end - displaying from end to start.
13800 0: ab
13801 0L
13802
13803/(?<A>a)|(?<A>b)/dupnames
13804    a\=ovector=1,copy=A,get=A,get=2
13805Matched, but too many substrings
13806 0: a
13807Copy substring 'A' failed (-54): requested value is not available
13808Get substring 2 failed (-54): requested value is not available
13809Get substring 'A' failed (-54): requested value is not available
13810    a\=ovector=2,copy=A,get=A,get=2
13811 0: a
13812 1: a
13813  C a (1) A (non-unique)
13814Get substring 2 failed (-54): requested value is not available
13815  G a (1) A (non-unique)
13816    b\=ovector=2,copy=A,get=A,get=2
13817Matched, but too many substrings
13818 0: b
13819 1: <unset>
13820Copy substring 'A' failed (-55): requested value is not set
13821Get substring 2 failed (-54): requested value is not available
13822Get substring 'A' failed (-55): requested value is not set
13823
13824/a(b)c(d)/
13825    abc\=ph,copy=0,copy=1,getall
13826Partial match: abc
13827 0C abc (3)
13828Copy substring 1 failed (-2): partial match
13829get substring list failed (-2): partial match
13830
13831/^abc/info
13832Capture group count = 0
13833Compile options: <none>
13834Overall options: anchored
13835First code unit = 'a'
13836Subject length lower bound = 3
13837
13838/^abc/info,no_dotstar_anchor
13839Capture group count = 0
13840Compile options: no_dotstar_anchor
13841Overall options: anchored no_dotstar_anchor
13842First code unit = 'a'
13843Subject length lower bound = 3
13844
13845/.*\d/info,auto_callout
13846Capture group count = 0
13847Options: auto_callout
13848First code unit at start or follows newline
13849Subject length lower bound = 1
13850\= Expect no match
13851    aaa
13852--->aaa
13853 +0 ^       .*
13854 +2 ^  ^    \d
13855 +2 ^ ^     \d
13856 +2 ^^      \d
13857 +2 ^       \d
13858No match
13859
13860/.*\d/info,no_dotstar_anchor,auto_callout
13861Capture group count = 0
13862Options: auto_callout no_dotstar_anchor
13863Subject length lower bound = 1
13864\= Expect no match
13865    aaa
13866--->aaa
13867 +0 ^       .*
13868 +2 ^  ^    \d
13869 +2 ^ ^     \d
13870 +2 ^^      \d
13871 +2 ^       \d
13872 +0  ^      .*
13873 +2  ^ ^    \d
13874 +2  ^^     \d
13875 +2  ^      \d
13876 +0   ^     .*
13877 +2   ^^    \d
13878 +2   ^     \d
13879No match
13880
13881/.*\d/dotall,info
13882Capture group count = 0
13883Compile options: dotall
13884Overall options: anchored dotall
13885Subject length lower bound = 1
13886
13887/.*\d/dotall,no_dotstar_anchor,info
13888Capture group count = 0
13889Options: dotall no_dotstar_anchor
13890Subject length lower bound = 1
13891
13892/(*NO_DOTSTAR_ANCHOR)(?s).*\d/info
13893Capture group count = 0
13894Compile options: <none>
13895Overall options: no_dotstar_anchor
13896Subject length lower bound = 1
13897
13898'^(?:(a)|b)(?(1)A|B)'
13899    aA123\=ovector=1
13900Matched, but too many substrings
13901 0: aA
13902    aA123\=ovector=2
13903 0: aA
13904 1: a
13905
13906'^(?:(?<AA>a)|b)(?(<AA>)A|B)'
13907    aA123\=ovector=1
13908Matched, but too many substrings
13909 0: aA
13910    aA123\=ovector=2
13911 0: aA
13912 1: a
13913
13914'^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'dupnames
13915    aA123\=ovector=1
13916Matched, but too many substrings
13917 0: aA
13918    aA123\=ovector=2
13919Matched, but too many substrings
13920 0: aA
13921 1:
13922    aA123\=ovector=3
13923 0: aA
13924 1:
13925 2: a
13926
13927'^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'dupnames
13928    aa123\=ovector=1
13929Matched, but too many substrings
13930 0: aa
13931    aa123\=ovector=2
13932Matched, but too many substrings
13933 0: aa
13934 1: <unset>
13935    aa123\=ovector=3
13936 0: aa
13937 1: <unset>
13938 2: a
13939
13940/(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
13941
13942/(?<N>(?J)(?<N>))(?-J)\k<N>/
13943
13944# Quantifiers are not allowed on condition assertions, but are otherwise
13945# OK in conditions.
13946
13947/(?(?=0)?)+/
13948Failed: error 109 at offset 7: quantifier does not follow a repeatable item
13949
13950/(?(?=0)(?=00)?00765)/
13951     00765
13952 0: 00765
13953
13954/(?(?=0)(?=00)?00765|(?!3).56)/
13955     00765
13956 0: 00765
13957     456
13958 0: 456
13959\= Expect no match
13960     356
13961No match
13962
13963'^(a)*+(\w)'
13964    g
13965 0: g
13966 1: <unset>
13967 2: g
13968    g\=ovector=1
13969Matched, but too many substrings
13970 0: g
13971
13972'^(?:a)*+(\w)'
13973    g
13974 0: g
13975 1: g
13976    g\=ovector=1
13977Matched, but too many substrings
13978 0: g
13979
13980# These two pattern showeds up compile-time bugs
13981
13982"((?2){0,1999}())?"
13983
13984/((?+1)(\1))/B
13985------------------------------------------------------------------
13986        Bra
13987        CBra 1
13988        Recurse
13989        CBra 2
13990        \1
13991        Ket
13992        Ket
13993        Ket
13994        End
13995------------------------------------------------------------------
13996
13997# Callouts with string arguments
13998
13999/a(?C"/
14000Failed: error 181 at offset 4: missing terminating delimiter for callout with string argument
14001
14002/a(?C"a/
14003Failed: error 181 at offset 4: missing terminating delimiter for callout with string argument
14004
14005/a(?C"a"/
14006Failed: error 139 at offset 7: closing parenthesis for (?C expected
14007
14008/a(?C"a"bcde(?C"b")xyz/
14009Failed: error 139 at offset 7: closing parenthesis for (?C expected
14010
14011/a(?C"a)b""c")/B
14012------------------------------------------------------------------
14013        Bra
14014        a
14015        CalloutStr "a)b"c" 5 13 0
14016        Ket
14017        End
14018------------------------------------------------------------------
14019
14020/ab(?C" any text with spaces ")cde/B
14021------------------------------------------------------------------
14022        Bra
14023        ab
14024        CalloutStr " any text with spaces " 6 30 1
14025        cde
14026        Ket
14027        End
14028------------------------------------------------------------------
14029    abcde
14030Callout (6): " any text with spaces "
14031--->abcde
14032    ^ ^       c
14033 0: abcde
14034    12abcde
14035Callout (6): " any text with spaces "
14036--->12abcde
14037      ^ ^       c
14038 0: abcde
14039
14040/^a(b)c(?C1)def/
14041      abcdef
14042--->abcdef
14043  1 ^  ^       d
14044 0: abcdef
14045 1: b
14046
14047/^a(b)c(?C"AB")def/
14048      abcdef
14049Callout (10): "AB"
14050--->abcdef
14051    ^  ^       d
14052 0: abcdef
14053 1: b
14054
14055/^a(b)c(?C1)def/
14056      abcdef\=callout_capture
14057Callout 1: last capture = 1
14058 1: b
14059--->abcdef
14060    ^  ^       d
14061 0: abcdef
14062 1: b
14063
14064/^a(b)c(?C{AB})def/B
14065------------------------------------------------------------------
14066        Bra
14067        ^
14068        a
14069        CBra 1
14070        b
14071        Ket
14072        c
14073        CalloutStr {AB} 10 14 1
14074        def
14075        Ket
14076        End
14077------------------------------------------------------------------
14078      abcdef\=callout_capture
14079Callout (10): {AB} last capture = 1
14080 1: b
14081--->abcdef
14082    ^  ^       d
14083 0: abcdef
14084 1: b
14085
14086/(?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
14087------------------------------------------------------------------
14088        Bra
14089        CalloutStr `a`b` 4 10 0
14090        CalloutStr 'a'b' 14 20 0
14091        CalloutStr "a"b" 24 30 0
14092        CalloutStr ^a^b^ 34 40 0
14093        CalloutStr %a%b% 44 50 0
14094        CalloutStr #a#b# 54 60 0
14095        CalloutStr $a$b$ 64 70 0
14096        CalloutStr {a}b} 74 80 0
14097        Ket
14098        End
14099------------------------------------------------------------------
14100Callout `a`b`  (
14101Callout 'a'b'  (
14102Callout "a"b"  (
14103Callout ^a^b^  (
14104Callout %a%b%  (
14105Callout #a#b#  (
14106Callout $a$b$  (
14107Callout {a}b}
14108
14109/(?:a(?C`code`)){3}/B
14110------------------------------------------------------------------
14111        Bra
14112        Bra
14113        a
14114        CalloutStr `code` 8 14 4
14115        Ket
14116        Bra
14117        a
14118        CalloutStr `code` 8 14 4
14119        Ket
14120        Bra
14121        a
14122        CalloutStr `code` 8 14 4
14123        Ket
14124        Ket
14125        End
14126------------------------------------------------------------------
14127
14128/^(?(?C25)(?=abc)abcd|xyz)/B,callout_info
14129------------------------------------------------------------------
14130        Bra
14131        ^
14132        Cond
14133        Callout 25 9 3
14134        Assert
14135        abc
14136        Ket
14137        abcd
14138        Alt
14139        xyz
14140        Ket
14141        Ket
14142        End
14143------------------------------------------------------------------
14144Callout 25  (?=
14145    abcdefg
14146--->abcdefg
14147 25 ^           (?=
14148 0: abcd
14149    xyz123
14150--->xyz123
14151 25 ^          (?=
14152 0: xyz
14153
14154/^(?(?C$abc$)(?=abc)abcd|xyz)/B
14155------------------------------------------------------------------
14156        Bra
14157        ^
14158        Cond
14159        CalloutStr $abc$ 7 12 3
14160        Assert
14161        abc
14162        Ket
14163        abcd
14164        Alt
14165        xyz
14166        Ket
14167        Ket
14168        End
14169------------------------------------------------------------------
14170    abcdefg
14171Callout (7): $abc$
14172--->abcdefg
14173    ^           (?=
14174 0: abcd
14175    xyz123
14176Callout (7): $abc$
14177--->xyz123
14178    ^          (?=
14179 0: xyz
14180
14181/^ab(?C'first')cd(?C"second")ef/
14182    abcdefg
14183Callout (7): 'first'
14184--->abcdefg
14185    ^ ^         c
14186Callout (20): "second"
14187--->abcdefg
14188    ^   ^       e
14189 0: abcdef
14190
14191/(?:a(?C`code`)){3}X/
14192    aaaXY
14193Callout (8): `code`
14194--->aaaXY
14195    ^^        ){3}
14196Callout (8): `code`
14197--->aaaXY
14198    ^ ^       ){3}
14199Callout (8): `code`
14200--->aaaXY
14201    ^  ^      ){3}
14202 0: aaaX
14203
14204# Binary zero in callout string
14205#  a  (  ?  C  '  x     z  '  )  b
14206/ 61 28 3f 43 27 78 00 7a 27 29 62/hex,callout_info
14207Callout 'x\x00z'  b
14208    abcdefgh
14209Callout (5): 'x\x00z'
14210--->abcdefgh
14211    ^^           b
14212 0: ab
14213
14214/(?(?!)^)/
14215
14216/(?(?!)a|b)/
14217    bbb
14218 0: b
14219\= Expect no match
14220    aaa
14221No match
14222
14223# JIT gives a different error message for the infinite recursion
14224
14225"(*NO_JIT)((?2)+)((?1)){"
14226    abcd{
14227Failed: error -52: nested recursion at the same subject position
14228
14229# Perl fails to diagnose the absence of an assertion
14230
14231"(?(?<E>.*!.*)?)"
14232Failed: error 128 at offset 2: assertion expected after (?( or (?(?C)
14233
14234"X((?2)()*+){2}+"B
14235------------------------------------------------------------------
14236        Bra
14237        X
14238        Once
14239        CBra 1
14240        Recurse
14241        Braposzero
14242        SCBraPos 2
14243        KetRpos
14244        Ket
14245        CBra 1
14246        Recurse
14247        Braposzero
14248        SCBraPos 2
14249        KetRpos
14250        Ket
14251        Ket
14252        Ket
14253        End
14254------------------------------------------------------------------
14255
14256"X((?2)()*+){2}"B
14257------------------------------------------------------------------
14258        Bra
14259        X
14260        CBra 1
14261        Recurse
14262        Braposzero
14263        SCBraPos 2
14264        KetRpos
14265        Ket
14266        CBra 1
14267        Recurse
14268        Braposzero
14269        SCBraPos 2
14270        KetRpos
14271        Ket
14272        Ket
14273        End
14274------------------------------------------------------------------
14275
14276/(?<=\bABQ(3(?-7)))/
14277Failed: error 115 at offset 15: reference to non-existent subpattern
14278
14279/(?<=\bABQ(3(?+7)))/
14280Failed: error 115 at offset 15: reference to non-existent subpattern
14281
14282";(?<=()((?3))((?2)))"
14283Failed: error 125 at offset 1: lookbehind assertion is not fixed length
14284
14285# Perl loops on this (PCRE2 used to!)
14286
14287/(?<=\Ka)/g,aftertext
14288    aaaaa
14289 0: a
14290 0+ aaaa
14291 0: a
14292 0+ aaa
14293 0: a
14294 0+ aa
14295 0: a
14296 0+ a
14297 0: a
14298 0+
14299
14300/(?<=\Ka)/altglobal,aftertext
14301    aaaaa
14302 0: a
14303 0+ aaaa
14304 0: a
14305 0+ aaa
14306 0: a
14307 0+ aa
14308 0: a
14309 0+ a
14310 0: a
14311 0+
14312
14313/((?2){73}(?2))((?1))/info
14314Capture group count = 2
14315May match empty string
14316Subject length lower bound = 0
14317
14318/abc/
14319\= Expect no match
14320    \[9x!xxx(]{9999}
14321No match
14322
14323/(abc)*/
14324    \[abc]{5}
14325 0: abcabcabcabcabc
14326 1: abc
14327
14328/^/gm
14329    \n\n\n
14330 0:
14331 0:
14332 0:
14333
14334/^/gm,alt_circumflex
14335    \n\n\n
14336 0:
14337 0:
14338 0:
14339 0:
14340
14341/((((((((x))))))))\81/
14342Failed: error 115 at offset 19: reference to non-existent subpattern
14343    xx1
14344
14345/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\80/
14346    xx
14347Matched, but too many substrings
14348 0: xx
14349 1: x
14350 2: x
14351 3: x
14352 4: x
14353 5: x
14354 6: x
14355 7: x
14356 8: x
14357 9: x
1435810: x
1435911: x
1436012: x
1436113: x
1436214: x
14363
14364/\80/
14365Failed: error 115 at offset 2: reference to non-existent subpattern
14366
14367/A\8B\9C/
14368Failed: error 115 at offset 2: reference to non-existent subpattern
14369    A8B9C
14370
14371/(?x:((?'a')) # comment (with parentheses) and | vertical
14372(?-x:#not a comment (?'b')) # this is a comment ()
14373(?'c')) # not a comment (?'d')/info
14374Capture group count = 5
14375Named capture groups:
14376  a   2
14377  b   3
14378  c   4
14379  d   5
14380First code unit = '#'
14381Last code unit = ' '
14382Subject length lower bound = 32
14383
14384/(?|(?'a')(2)(?'b')|(?'a')(?'a')(3))/I,dupnames
14385Capture group count = 3
14386Named capture groups:
14387  a   1
14388  a   2
14389  b   3
14390Options: dupnames
14391Starting code units: 2 3
14392Subject length lower bound = 1
14393    A23B
14394 0: 2
14395 1:
14396 2: 2
14397 3:
14398    B32A
14399 0: 3
14400 1:
14401 2:
14402 3: 3
14403
14404# These are some patterns that used to cause buffer overflows or other errors
14405# while compiling.
14406
14407/.((?2)(?R)|\1|$)()/B
14408------------------------------------------------------------------
14409        Bra
14410        Any
14411        CBra 1
14412        Recurse
14413        Recurse
14414        Alt
14415        \1
14416        Alt
14417        $
14418        Ket
14419        CBra 2
14420        Ket
14421        Ket
14422        End
14423------------------------------------------------------------------
14424
14425/.((?3)(?R)()(?2)|\1|$)()/B
14426------------------------------------------------------------------
14427        Bra
14428        Any
14429        CBra 1
14430        Recurse
14431        Recurse
14432        CBra 2
14433        Ket
14434        Recurse
14435        Alt
14436        \1
14437        Alt
14438        $
14439        Ket
14440        CBra 3
14441        Ket
14442        Ket
14443        End
14444------------------------------------------------------------------
14445
14446/(\9*+(?2);\3++()2|)++{/
14447Failed: error 115 at offset 2: reference to non-existent subpattern
14448
14449/\V\x85\9*+((?2)\3++()2)*:2/
14450Failed: error 115 at offset 7: reference to non-existent subpattern
14451
14452/(((?(R)){0,2}) (?'x'((?'R')((?'R')))))/dupnames
14453
14454/(((?(X)){0,2}) (?'x'((?'X')((?'X')))))/dupnames
14455
14456/(((?(R)){0,2}) (?'x'((?'X')((?'R')))))/
14457
14458"(?J)(?'d'(?'d'\g{d}))"
14459
14460"(?=!((?2)(?))({8(?<=(?1){29}8bbbb\x16\xd\xc6^($(\xa9H4){4}h}?1)B))\x15')"
14461Failed: error 125 at offset 16: lookbehind assertion is not fixed length
14462
14463/A(?'')Z/
14464Failed: error 162 at offset 4: subpattern name expected
14465
14466"(?J:(?|(?'R')(\k'R')|((?'R'))))"
14467
14468/(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
14469Failed: error 161 at offset 17: subpattern number is too big
14470
14471/^(?:(?(1)x|)+)+$()/B
14472------------------------------------------------------------------
14473        Bra
14474        ^
14475        SBra
14476        SCond
14477      1 Cond ref
14478        x
14479        Alt
14480        KetRmax
14481        KetRmax
14482        $
14483        CBra 1
14484        Ket
14485        Ket
14486        End
14487------------------------------------------------------------------
14488
14489/[[:>:]](?<)/
14490Failed: error 162 at offset 10: subpattern name expected
14491
14492/((?x)(*:0))#(?'/
14493Failed: error 162 at offset 15: subpattern name expected
14494
14495/(?C$[$)(?<]/
14496Failed: error 162 at offset 10: subpattern name expected
14497
14498/(?C$)$)(?<]/
14499Failed: error 162 at offset 10: subpattern name expected
14500
14501/(?(R))*+/B
14502------------------------------------------------------------------
14503        Bra
14504        Braposzero
14505        SBraPos
14506        SCond
14507        Cond recurse any
14508        Ket
14509        KetRpos
14510        Ket
14511        End
14512------------------------------------------------------------------
14513    abcd
14514 0:
14515
14516/((?x)(?#))#(?'/
14517Failed: error 162 at offset 14: subpattern name expected
14518
14519/((?x)(?#))#(?'abc')/I
14520Capture group count = 2
14521Named capture groups:
14522  abc   2
14523First code unit = '#'
14524Subject length lower bound = 1
14525
14526/[[:\\](?<[::]/
14527Failed: error 162 at offset 9: subpattern name expected
14528
14529/[[:\\](?'abc')[a:]/I
14530Capture group count = 1
14531Named capture groups:
14532  abc   1
14533Starting code units: : [ \
14534Subject length lower bound = 2
14535
14536"[[[.\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[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
14537Failed: error 106 at offset 353: missing terminating ] for character class
14538
14539/()(?(R)0)*+/B
14540------------------------------------------------------------------
14541        Bra
14542        CBra 1
14543        Ket
14544        Braposzero
14545        SBraPos
14546        SCond
14547        Cond recurse any
14548        0
14549        Ket
14550        KetRpos
14551        Ket
14552        End
14553------------------------------------------------------------------
14554
14555/(?R-:(?</
14556Failed: error 158 at offset 3: (?R (recursive pattern call) must be followed by a closing parenthesis
14557
14558/(?R-:(?<)/
14559Failed: error 158 at offset 3: (?R (recursive pattern call) must be followed by a closing parenthesis
14560
14561/(?(?C{\Q})(?!(?'/
14562Failed: error 162 at offset 16: subpattern name expected
14563
14564/(?(?C{\Q})(?!(?'abc')))/I
14565Capture group count = 1
14566Named capture groups:
14567  abc   1
14568May match empty string
14569Subject length lower bound = 0
14570
14571/(?1){3918}(((((0(\k'R'))))(?J)(?'R'(?'R'\3){99})))/I
14572Capture group count = 8
14573Max back reference = 8
14574Named capture groups:
14575  R   7
14576  R   8
14577Duplicate name status changes
14578Last code unit = '0'
14579Subject length lower bound = 65535
14580
14581/(?|(aaa)|(b))\g{1}/I
14582Capture group count = 1
14583Max back reference = 1
14584Starting code units: a b
14585Subject length lower bound = 1
14586
14587/(?|(aaa)|(b))(?1)/I
14588Capture group count = 1
14589Starting code units: a b
14590Subject length lower bound = 4
14591
14592/(?|(aaa)|(b))/I
14593Capture group count = 1
14594Starting code units: a b
14595Subject length lower bound = 1
14596
14597/(?|(?'a'aaa)|(?'a'b))\k'a'/I
14598Capture group count = 1
14599Max back reference = 1
14600Named capture groups:
14601  a   1
14602Starting code units: a b
14603Subject length lower bound = 1
14604
14605/(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/I,dupnames
14606Capture group count = 2
14607Max back reference = 2
14608Named capture groups:
14609  a   1
14610  a   2
14611Options: dupnames
14612Starting code units: a b
14613Last code unit = 'c'
14614Subject length lower bound = 5
14615
14616/ab{3cd/
14617    ab{3cd
14618 0: ab{3cd
14619
14620/ab{3,cd/
14621    ab{3,cd
14622 0: ab{3,cd
14623
14624/ab{3,4a}cd/
14625    ab{3,4a}cd
14626 0: ab{3,4a}cd
14627
14628/{4,5a}bc/
14629    {4,5a}bc
14630 0: {4,5a}bc
14631
14632/\x0{ab}/
14633    \0{ab}
14634 0: \x00{ab}
14635
14636/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
14637    ababababbbabZXXXX
14638 0: ababababbbabZ
14639 1: ab
14640 2: b
14641
14642/.*?a(*PRUNE)b/
14643    aab
14644 0: ab
14645
14646/.*?a(*PRUNE)b/s
14647    aab
14648 0: ab
14649
14650/^a(*PRUNE)b/s
14651\= Expect no match
14652    aab
14653No match
14654
14655/.*?a(*SKIP)b/
14656    aab
14657 0: ab
14658
14659/(?(8000000000/
14660Failed: error 161 at offset 8: subpattern number is too big
14661
14662/((?(R8000000000)))/
14663Failed: error 161 at offset 9: subpattern number is too big
14664
14665/0(?0)|(1)(*THEN)(*SKIP:0)(*FAIL)/
14666\= Expect no match
14667    01
14668No match
14669
14670/(?(1)()\983040\2)/
14671Failed: error 161 at offset 14: subpattern number is too big
14672
14673/(*LIMIT_MATCH=)abc/
14674Failed: error 160 at offset 14: (*VERB) not recognized or malformed
14675
14676/(*CRLF)(*LIMIT_MATCH=)abc/
14677Failed: error 160 at offset 21: (*VERB) not recognized or malformed
14678
14679/(?:ab)?(?:ab)(?:ab)/
14680    abab
14681 0: abab
14682    ababab
14683 0: ababab
14684\= Expect no match
14685    aba
14686No match
14687
14688/((*MARK:A))++a(*SKIP:B)b/
14689\= Expect no match
14690    aacb
14691No match
14692
14693/(*MARK:a\zb)z/alt_verbnames
14694Failed: error 140 at offset 10: invalid escape sequence in (*VERB) name
14695
14696/(*:ab\t(d\)c)xxx/
14697Failed: error 122 at offset 12: unmatched closing parenthesis
14698
14699/(*:ab\t(d\)c)xxx/alt_verbnames,mark
14700    cxxxz
14701 0: xxx
14702MK: ab\x09(d)c
14703
14704/(*:A\Qxx)x\EB)x/alt_verbnames,mark
14705    x
14706 0: x
14707MK: Axx)xB
14708
14709/(*:A\ExxxB)x/alt_verbnames,mark
14710    x
14711 0: x
14712MK: AxxxB
14713
14714/(*: A \ and #comment
14715     \ B)x/x,alt_verbnames,mark
14716    x
14717 0: x
14718MK: A and B
14719
14720/(*: A \ and #comment
14721     \ B)x/alt_verbnames,mark
14722    x
14723 0: x
14724MK:  A  and #comment\x0a      B
14725
14726/(*: A \ and #comment
14727     \ B)x/x,mark
14728    x
14729 0: x
14730MK:  A \ and #comment\x0a     \ B
14731
14732/(*: A \ and #comment
14733     \ B)x/mark
14734    x
14735 0: x
14736MK:  A \ and #comment\x0a     \ B
14737
14738/(*:A
14739B)x/alt_verbnames,mark
14740    x
14741 0: x
14742MK: A\x0aB
14743
14744/(*:abc\Qpqr)/alt_verbnames
14745Failed: error 160 at offset 12: (*VERB) not recognized or malformed
14746
14747/abc/use_offset_limit
14748    1234abcde\=offset_limit=100
14749 0: abc
14750    1234abcde\=offset_limit=9
14751 0: abc
14752    1234abcde\=offset_limit=4
14753 0: abc
14754    1234abcde\=offset_limit=4,offset=4
14755 0: abc
14756\= Expect no match
14757    1234abcde\=offset_limit=4,offset=5
14758No match
14759    1234abcde\=offset_limit=3
14760No match
14761
14762/(?<=abc)/use_offset_limit
14763    1234abc\=offset_limit=7
14764 0:
14765\= Expect no match
14766    1234abc\=offset_limit=6
14767No match
14768
14769/A/g,replace=-,use_offset_limit
14770    XAXAXAXAXA\=offset_limit=4
14771 2: X-X-XAXAXA
14772
14773/abc/
14774\= Expect error
14775    1234abcde\=offset_limit=4
14776Failed: error -56: offset limit set without PCRE2_USE_OFFSET_LIMIT
14777
14778/^\w/m,use_offset_limit
14779    \n..\naa\=offset_limit=3
14780No match
14781    \n..\naa\=offset_limit=4
14782 0: a
14783
14784/abcd/null_context
14785    abcd\=null_context
14786 0: abcd
14787\= Expect error - not allowed together
14788    abcd\=null_context,find_limits
14789** Not allowed together: find_limits null_context
14790    abcd\=allusedtext,startchar
14791** Not allowed together: allusedtext startchar
14792
14793/abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended
14794    abcd
14795 1: w\x0dx\x82y\xdbz(12\$34$$\x345$)
14796
14797/abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended,substitute_literal
14798    >>abcd<<
14799 1: >>w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$)<<
14800
14801/abcd/g,replace=\$1$2\,substitute_literal
14802    XabcdYabcdZ
14803 2: X\$1$2\Y\$1$2\Z
14804
14805/a(bc)(DE)/replace=a\u$1\U$1\E$1\l$2\L$2\Eab\Uab\LYZ\EDone,substitute_extended
14806    abcDE
14807 1: aBcBCbcdEdeabAByzDone
14808
14809/abcd/replace=xy\kz,substitute_extended
14810    abcd
14811Failed: error -57 at offset 4 in replacement: bad escape sequence in replacement string
14812
14813/a(?:(b)|(c))/substitute_extended,replace=X${1:+1:-1}X${2:+2:-2}
14814    ab
14815 1: X1X-2
14816    ac
14817 1: X-1X2
14818    ab\=replace=${1:+$1\:$1:$2}
14819 1: b:b
14820    ac\=replace=${1:+$1\:$1:$2}
14821 1: c
14822    >>ac<<\=replace=${1:+$1\:$1:$2},substitute_literal
14823 1: >>${1:+$1\:$1:$2}<<
14824
14825/a(?:(b)|(c))/substitute_extended,replace=X${1:-1:-1}X${2:-2:-2}
14826    ab
14827 1: XbX2:-2
14828    ac
14829 1: X1:-1Xc
14830
14831/(a)/substitute_extended,replace=>${1:+\Q$1:{}$$\E+\U$1}<
14832    a
14833 1: >$1:{}$$+A<
14834
14835/X(b)Y/substitute_extended
14836    XbY\=replace=x${1:+$1\U$1}y
14837 1: xbBY
14838    XbY\=replace=\Ux${1:+$1$1}y
14839 1: XBBY
14840
14841/a/substitute_extended,replace=${*MARK:+a:b}
14842    a
14843Failed: error -58 at offset 7 in replacement: expected closing curly bracket in replacement string
14844
14845/(abcd)/replace=${1:+xy\kz},substitute_extended
14846    abcd
14847Failed: error -57 at offset 8 in replacement: bad escape sequence in replacement string
14848
14849/(abcd)/
14850    abcd\=replace=${1:+xy\kz},substitute_extended
14851Failed: error -57 at offset 8 in replacement: bad escape sequence in replacement string
14852
14853/abcd/substitute_extended,replace=>$1<
14854    abcd
14855Failed: error -49 at offset 3 in replacement: unknown substring
14856
14857/abcd/substitute_extended,replace=>xxx${xyz}<<<
14858    abcd
14859Failed: error -49 at offset 10 in replacement: unknown substring
14860
14861/(?J)(?:(?<A>a)|(?<A>b))/replace=<$A>
14862    [a]
14863 1: [<a>]
14864    [b]
14865 1: [<b>]
14866\= Expect error
14867    (a)\=ovector=1
14868Failed: error -54 at offset 3 in replacement: requested value is not available
14869
14870/(a)|(b)/replace=<$1>
14871\= Expect error
14872    b
14873Failed: error -55 at offset 3 in replacement: requested value is not set
14874
14875/(aa)(BB)/substitute_extended,replace=\U$1\L$2\E$1..\U$1\l$2$1
14876    aaBB
14877 1: AAbbaa..AAbBaa
14878
14879/abcd/replace=wxyz,substitute_matched
14880    abcd
14881 1: wxyz
14882    pqrs
14883 0: pqrs
14884
14885/abcd/g
14886    >abcd1234abcd5678<\=replace=wxyz,substitute_matched
14887 2: >wxyz1234wxyz5678<
14888
14889/^(o(\1{72}{\"{\\{00000059079}\d*){74}}){19}/I
14890Capture group count = 2
14891Max back reference = 1
14892Compile options: <none>
14893Overall options: anchored
14894First code unit = 'o'
14895Last code unit = '}'
14896Subject length lower bound = 65535
14897
14898/((p(?'K/
14899Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator?)
14900
14901/((p(?'K/no_auto_capture
14902Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator?)
14903
14904/abc/replace=A$3123456789Z
14905    abc
14906Failed: error -49 at offset 3 in replacement: unknown substring
14907
14908/(?<!a{65535}a{5})x/I
14909Failed: error 187 at offset 0: lookbehind assertion is too long
14910
14911/(?<!a{65535})x/I
14912Capture group count = 0
14913Max lookbehind = 65535
14914First code unit = 'x'
14915Subject length lower bound = 1
14916
14917/(?=a\K)/replace=z
14918    BaCaD
14919Failed: error -60: match with end before start or start moved backwards is not supported
14920
14921/(?<=\K.)/g,replace=-
14922    ab
14923Failed: error -60: match with end before start or start moved backwards is not supported
14924
14925/(?'abcdefghijklmnopqrstuvwxyzABCDEFG'toolong)/
14926Failed: error 148 at offset 36: subpattern name is too long (maximum 32 code units)
14927
14928/(?'abcdefghijklmnopqrstuvwxyzABCDEF'justright)/
14929
14930# These two use zero-termination
14931/abcd/max_pattern_length=3
14932Failed: error 188 at offset 0: pattern string is longer than the limit set by the application
14933
14934/abc/max_pattern_length=3
14935
14936# These two, being hex, pass the length
14937/abcdefab/hex,max_pattern_length=3
14938Failed: error 188 at offset 0: pattern string is longer than the limit set by the application
14939
14940/abcdef/hex,max_pattern_length=3
14941
14942# These patterns used to take a long time to compile
14943
14944"(.*)
14945((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14946((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14947((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
14948Capture group count = 12
14949May match empty string
14950Options: extended
14951First code unit at start or follows newline
14952Subject length lower bound = 0
14953
14954"(?<=a()
14955((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14956((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14957((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14958a)"xI
14959Capture group count = 12
14960Max lookbehind = 2
14961May match empty string
14962Options: extended
14963Subject length lower bound = 0
14964
14965"(?|()|())(.*)
14966((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14967((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14968((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
14969Capture group count = 13
14970May match empty string
14971Options: extended
14972Subject length lower bound = 0
14973
14974"(?|()|())(?<=a()
14975((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14976((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14977((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14978a)"xI
14979Failed: error 135 at offset 9: lookbehind is too complicated
14980
14981# Test the use of malloc for caching group information when there are more
14982# groups than fit into the on-stack workspace.
14983
14984/\[()]{1024}/I,expand
14985Expanded: ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
14986Capture group count = 1024
14987May match empty string
14988Subject length lower bound = 0
14989
14990# Test minlength capped at 65535
14991
14992/(A{65000})\1{65000}/I
14993Capture group count = 1
14994Max back reference = 1
14995First code unit = 'A'
14996Last code unit = 'A'
14997Subject length lower bound = 65535
14998
14999# Test group scans when numbers are not unique
15000
15001/(?|()+|(a)+)/BI
15002------------------------------------------------------------------
15003        Bra
15004        Bra
15005        SCBra 1
15006        KetRmax
15007        Alt
15008        CBra 1
15009        a
15010        KetRmax
15011        Ket
15012        Ket
15013        End
15014------------------------------------------------------------------
15015Capture group count = 1
15016May match empty string
15017Subject length lower bound = 0
15018
15019/(?|(a)+|()+)/BI
15020------------------------------------------------------------------
15021        Bra
15022        Bra
15023        CBra 1
15024        a
15025        KetRmax
15026        Alt
15027        SCBra 1
15028        KetRmax
15029        Ket
15030        Ket
15031        End
15032------------------------------------------------------------------
15033Capture group count = 1
15034May match empty string
15035Subject length lower bound = 0
15036
15037/(?|()|(a))/BI
15038------------------------------------------------------------------
15039        Bra
15040        Bra
15041        CBra 1
15042        Ket
15043        Alt
15044        CBra 1
15045        a
15046        Ket
15047        Ket
15048        Ket
15049        End
15050------------------------------------------------------------------
15051Capture group count = 1
15052May match empty string
15053Subject length lower bound = 0
15054
15055/(?|(a)|())/BI
15056------------------------------------------------------------------
15057        Bra
15058        Bra
15059        CBra 1
15060        a
15061        Ket
15062        Alt
15063        CBra 1
15064        Ket
15065        Ket
15066        Ket
15067        End
15068------------------------------------------------------------------
15069Capture group count = 1
15070May match empty string
15071Subject length lower bound = 0
15072
15073# Test CRLF handling in empty string substitutions
15074
15075/^$/gm,newline=anycrlf,replace=-
15076    X\r\n\r\nY
15077 1: X\x0d\x0a-\x0d\x0aY
15078
15079/^$/gm,newline=crlf,replace=-
15080    X\r\n\r\nY
15081 1: X\x0d\x0a-\x0d\x0aY
15082
15083/^$/gm,newline=any,replace=-
15084    X\r\n\r\nY
15085 1: X\x0d\x0a-\x0d\x0aY
15086
15087"(*ANYCRLF)(?m)^(.*[^0-9\r\n].*|)$"g,replace=NaN
15088    15\r\nfoo\r\n20\r\nbar\r\nbaz\r\n\r\n20
15089 4: 15\x0d\x0aNaN\x0d\x0a20\x0d\x0aNaN\x0d\x0aNaN\x0d\x0aNaN\x0d\x0a20
15090
15091/a[[:punct:]b]/bincode
15092------------------------------------------------------------------
15093        Bra
15094        a
15095        [!-/:-@[-`b{-~]
15096        Ket
15097        End
15098------------------------------------------------------------------
15099
15100/a[b[:punct:]]/bincode
15101------------------------------------------------------------------
15102        Bra
15103        a
15104        [!-/:-@[-`b{-~]
15105        Ket
15106        End
15107------------------------------------------------------------------
15108
15109/L(?#(|++<!(2)?/B
15110------------------------------------------------------------------
15111        Bra
15112        L?+
15113        Ket
15114        End
15115------------------------------------------------------------------
15116
15117/L(?#(|++<!(2)?/B,no_auto_possess
15118------------------------------------------------------------------
15119        Bra
15120        L?
15121        Ket
15122        End
15123------------------------------------------------------------------
15124
15125/L(?#(|++<!(2)?/B,auto_callout
15126------------------------------------------------------------------
15127        Bra
15128        Callout 255 0 14
15129        L?+
15130        Callout 255 14 0
15131        Ket
15132        End
15133------------------------------------------------------------------
15134
15135/L(?#(|++<!(2)?/B,no_auto_possess,auto_callout
15136------------------------------------------------------------------
15137        Bra
15138        Callout 255 0 14
15139        L?
15140        Callout 255 14 0
15141        Ket
15142        End
15143------------------------------------------------------------------
15144
15145/(A*)\E+/B,auto_callout
15146------------------------------------------------------------------
15147        Bra
15148        Callout 255 0 1
15149        SCBra 1
15150        Callout 255 1 2
15151        A*
15152        Callout 255 3 4
15153        KetRmax
15154        Callout 255 7 0
15155        Ket
15156        End
15157------------------------------------------------------------------
15158
15159/()\Q\E*]/B,auto_callout
15160------------------------------------------------------------------
15161        Bra
15162        Callout 255 0 1
15163        Brazero
15164        SCBra 1
15165        Callout 255 1 6
15166        KetRmax
15167        Callout 255 7 1
15168        ]
15169        Callout 255 8 0
15170        Ket
15171        End
15172------------------------------------------------------------------
15173    a[bc]d
15174--->a[bc]d
15175 +0     ^      (
15176 +1     ^      )\Q\E*
15177 +7     ^      ]
15178 +8     ^^     End of pattern
15179 0: ]
15180 1:
15181
15182/\x8a+f|;T?(*:;.'?`(\xeap ){![^()!y*''C*(?';]{1;(\x08)/B,alt_verbnames,dupnames,extended
15183------------------------------------------------------------------
15184        Bra
15185        \x{8a}++
15186        f
15187        Alt
15188        ;
15189        T?
15190        *MARK ;.'?`(\x{ea}p
15191        {!
15192        [\x00- "-&+-:<->@-BD-xz-\xff] (neg)
15193        {1;
15194        CBra 1
15195        \x08
15196        Ket
15197        Ket
15198        End
15199------------------------------------------------------------------
15200
15201# Tests for NULL characters in comments and verb "names" and callouts
15202
15203# /A#B\x00C\x0aZ/
15204/41 23 42 00 43 0a 5a/Bx,hex
15205------------------------------------------------------------------
15206        Bra
15207        AZ
15208        Ket
15209        End
15210------------------------------------------------------------------
15211
15212# /A+#B\x00C\x0a+/
15213/41 2b 23 42 00 43 0a 2b/Bx,hex
15214------------------------------------------------------------------
15215        Bra
15216        A++
15217        Ket
15218        End
15219------------------------------------------------------------------
15220
15221# /A(*:B\x00W#X\00Y\x0aC)Z/
15222/41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex,alt_verbnames
15223------------------------------------------------------------------
15224        Bra
15225        A
15226        *MARK B\x{0}WC
15227        Z
15228        Ket
15229        End
15230------------------------------------------------------------------
15231
15232# /A(*:B\x00W#X\00Y\x0aC)Z/
15233/41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex
15234------------------------------------------------------------------
15235        Bra
15236        A
15237        *MARK B\x{0}W#X\x{0}Y\x{a}C
15238        Z
15239        Ket
15240        End
15241------------------------------------------------------------------
15242
15243# /A(?C{X\x00Y})B/
15244/41 28 3f 43 7b 58 00 59 7d 29 42/B,hex
15245------------------------------------------------------------------
15246        Bra
15247        A
15248        CalloutStr {X\x{0}Y} 5 10 1
15249        B
15250        Ket
15251        End
15252------------------------------------------------------------------
15253
15254# /A(?#X\x00Y)B/
15255/41 28 3f 23 7b 00 7d 29 42/B,hex
15256------------------------------------------------------------------
15257        Bra
15258        AB
15259        Ket
15260        End
15261------------------------------------------------------------------
15262
15263# Tests for leading comment in extended patterns
15264
15265/ (?-x):?/extended
15266
15267/(?-x):?/extended
15268
15269/0b 28 3f 2d 78 29 3a/hex,extended
15270
15271/#comment
15272(?-x):?/extended
15273
15274/(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
15275Failed: error 162 at offset 49: subpattern name expected
15276
15277/a|(b)c/replace=>$1<,substitute_unset_empty
15278    cat
15279 1: c><t
15280    xbcom
15281 1: x>b<om
15282
15283/a|(b)c/
15284    cat\=replace=>$1<
15285Failed: error -55 at offset 3 in replacement: requested value is not set
15286    cat\=replace=>$1<,substitute_unset_empty
15287 1: c><t
15288    xbcom\=replace=>$1<,substitute_unset_empty
15289 1: x>b<om
15290
15291/a|(b)c/substitute_extended
15292    cat\=replace=>${2:-xx}<
15293Failed: error -49 at offset 9 in replacement: unknown substring
15294    cat\=replace=>${2:-xx}<,substitute_unknown_unset
15295 1: c>xx<t
15296    cat\=replace=>${X:-xx}<,substitute_unknown_unset
15297 1: c>xx<t
15298
15299/a|(?'X'b)c/replace=>$X<,substitute_unset_empty
15300    cat
15301 1: c><t
15302    xbcom
15303 1: x>b<om
15304
15305/a|(?'X'b)c/replace=>$Y<,substitute_unset_empty
15306    cat
15307Failed: error -49 at offset 3 in replacement: unknown substring
15308    cat\=substitute_unknown_unset
15309 1: c><t
15310    cat\=substitute_unknown_unset,-substitute_unset_empty
15311Failed: error -55 at offset 3 in replacement: requested value is not set
15312
15313/a|(b)c/replace=>$2<,substitute_unset_empty
15314    cat
15315Failed: error -49 at offset 3 in replacement: unknown substring
15316    cat\=substitute_unknown_unset
15317 1: c><t
15318    cat\=substitute_unknown_unset,-substitute_unset_empty
15319Failed: error -55 at offset 3 in replacement: requested value is not set
15320
15321/()()()/use_offset_limit
15322    \=ovector=11000000000
15323** Invalid value in 'ovector=11000000000'
15324    \=callout_fail=11000000000
15325** Invalid value in 'callout_fail=11000000000'
15326    \=callout_fail=1:11000000000
15327** Invalid value in 'callout_fail=1:11000000000'
15328    \=callout_data=11000000000
15329** Invalid value in 'callout_data=11000000000'
15330    \=callout_data=-11000000000
15331** Invalid value in 'callout_data=-11000000000'
15332    \=offset_limit=1100000000000000000000
15333** Invalid value in 'offset_limit=1100000000000000000000'
15334    \=copy=11000000000
15335** Invalid value in 'copy=11000000000'
15336
15337/(*MARK:A\x00b)/mark
15338    abc
15339 0:
15340MK: A\x00b
15341
15342/(*MARK:A\x00b)/mark,alt_verbnames
15343    abc
15344 0:
15345MK: A\x00b
15346
15347/"(*MARK:A" 00 "b)"/mark,hex
15348    abc
15349 0:
15350MK: A\x00b
15351
15352/"(*MARK:A" 00 "b)"/mark,hex,alt_verbnames
15353    abc
15354 0:
15355MK: A\x00b
15356
15357/efg/hex
15358** Unexpected non-hex-digit 'g' at offset 2 in hex pattern: quote missing?
15359
15360/eff/hex
15361** Odd number of digits in hex pattern
15362
15363/effg/hex
15364** Unexpected non-hex-digit 'g' at offset 3 in hex pattern: quote missing?
15365
15366/(?J)(?'a'))(?'a')/
15367Failed: error 122 at offset 10: unmatched closing parenthesis
15368
15369/(?<=((?C)0))/
15370    9010
15371--->9010
15372  0  ^       0
15373  0   ^      0
15374 0:
15375 1: 0
15376\= Expect no match
15377    abc
15378--->abc
15379  0  ^      0
15380  0   ^     0
15381  0    ^    0
15382No match
15383
15384/aaa/
15385\[abc]{10000000000000000000000000000}
15386** Repeat count too large
15387\[a]{3}
15388 0: aaa
15389
15390/\[AB]{6000000000000000000000}/expand
15391** Pattern repeat count too large
15392
15393# Hex uses pattern length, not zero-terminated. This tests for overrunning
15394# the given length of a pattern.
15395
15396/'(*U'/hex
15397Failed: error 160 at offset 3: (*VERB) not recognized or malformed
15398
15399/'(*'/hex
15400Failed: error 109 at offset 1: quantifier does not follow a repeatable item
15401
15402/'('/hex
15403Failed: error 114 at offset 1: missing closing parenthesis
15404
15405//hex
15406
15407# These tests are here because Perl never allows a back reference in a
15408# lookbehind. PCRE2 supports some limited cases.
15409
15410/([ab])...(?<=\1)z/
15411    a11az
15412 0: a11az
15413 1: a
15414    b11bz
15415 0: b11bz
15416 1: b
15417\= Expect no match
15418    b11az
15419No match
15420
15421/(?|([ab]))...(?<=\1)z/
15422Failed: error 125 at offset 13: lookbehind assertion is not fixed length
15423
15424/([ab])(\1)...(?<=\2)z/
15425    aa11az
15426 0: aa11az
15427 1: a
15428 2: a
15429
15430/(a\2)(b\1)(?<=\2)/
15431Failed: error 125 at offset 10: lookbehind assertion is not fixed length
15432
15433/(?<A>[ab])...(?<=\k'A')z/
15434    a11az
15435 0: a11az
15436 1: a
15437    b11bz
15438 0: b11bz
15439 1: b
15440\= Expect no match
15441    b11az
15442No match
15443
15444/(?<A>[ab])...(?<=\k'A')(?<A>)z/dupnames
15445Failed: error 125 at offset 13: lookbehind assertion is not fixed length
15446
15447# Perl does not support \g+n
15448
15449/((\g+1X)?([ab]))+/
15450    aaXbbXa
15451 0: aaXbbXa
15452 1: bXa
15453 2: bX
15454 3: a
15455
15456/ab(?C1)c/auto_callout
15457    abc
15458--->abc
15459 +0 ^       a
15460 +1 ^^      b
15461  1 ^ ^     c
15462 +8 ^  ^    End of pattern
15463 0: abc
15464
15465/'ab(?C1)c'/hex,auto_callout
15466    abc
15467--->abc
15468 +0 ^       a
15469 +1 ^^      b
15470  1 ^ ^     c
15471 +8 ^  ^    End of pattern
15472 0: abc
15473
15474# Perl accepts these, but gives a warning. We can't warn, so give an error.
15475
15476/[a-[:digit:]]+/
15477Failed: error 150 at offset 4: invalid range in character class
15478    a-a9-a
15479
15480/[A-[:digit:]]+/
15481Failed: error 150 at offset 4: invalid range in character class
15482    A-A9-A
15483
15484/[a-\d]+/
15485Failed: error 150 at offset 5: invalid range in character class
15486    a-a9-a
15487
15488/(?<RA>abc)(?(R)xyz)/B
15489------------------------------------------------------------------
15490        Bra
15491        CBra 1
15492        abc
15493        Ket
15494        Cond
15495        Cond recurse any
15496        xyz
15497        Ket
15498        Ket
15499        End
15500------------------------------------------------------------------
15501
15502/(?<R>abc)(?(R)xyz)/B
15503------------------------------------------------------------------
15504        Bra
15505        CBra 1
15506        abc
15507        Ket
15508        Cond
15509      1 Cond ref
15510        xyz
15511        Ket
15512        Ket
15513        End
15514------------------------------------------------------------------
15515
15516/(?=.*[A-Z])/I
15517Capture group count = 0
15518May match empty string
15519Subject length lower bound = 0
15520
15521/()(?<=(?0))/
15522Failed: error 125 at offset 2: lookbehind assertion is not fixed length
15523
15524/(?<!|!(?<!))/
15525
15526/(?<!|!|!||||||(?<!)||(?<!)!|!||(?<!)!|!(?<!)!|!|!|!||||!!|<!)!|!||||!|/
15527
15528/{2,2{2,2/use_length
15529
15530/.>*?\g'0/use_length
15531Failed: error 157 at offset 6: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
15532
15533/.>*?\g'0/
15534Failed: error 157 at offset 6: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
15535
15536/{�̈́�̈́�{'{22{2{{2{'{22{{22{2{'{22{2{{2{{222{{2{'{22{2{22{2{'{22{2{{2{'{22{2{22{2{'{'{22{2{22{2{'{22{2{{2{'{22{2{22{2{'{222{2Ą̈́�̈́�{'{22{2{{2{'{22{{11{2{'{22{2{{2{{'{22{2{{2{'{22{{22{1{'{22{2{{2{{222{{2{'{22{2{22{2{'{/auto_callout
15537
15538//
15539\=get=i00000000000000000000000000000000
15540** Group name in 'get' is too long
15541\=get=i2345678901234567890123456789012,get=i1245678901234567890123456789012
15542** Too many characters in named 'get' modifiers
15543
15544"(?(?C))"
15545Failed: error 128 at offset 6: assertion expected after (?( or (?(?C)
15546
15547/(?(?(?(?(?(?))))))/
15548Failed: error 128 at offset 2: assertion expected after (?( or (?(?C)
15549
15550/(?<=(?1))((?s))/anchored
15551
15552/(*:ab)*/
15553Failed: error 109 at offset 6: quantifier does not follow a repeatable item
15554
15555%(*:(:(svvvvvvvvvv:]*[   Z!*;[]*[^[]*!^[+.+{{2,7}'      _\\\\\\\\\\\\\)?.:..    *w////\\\Q\\\\\\\\\\\\\\\T\\\\\+/?/////'+\\\EEE?/////'+/*+/[^K]?]//(w)%never_backslash_c,alt_verbnames,auto_callout
15556
15557/./newline=crlf
15558    \=ph
15559No match
15560
15561/(\x0e00\000000\xc)/replace=\P,substitute_extended
15562    \x0e00\000000\xc
15563Failed: error -57 at offset 2 in replacement: bad escape sequence in replacement string
15564
15565//replace=0
15566    \=offset=7
15567Failed: error -33: bad offset value
15568
15569/(?<=\G.)/g,replace=+
15570    abc
15571 3: a+b+c+
15572
15573".+\QX\E+"B,no_auto_possess
15574------------------------------------------------------------------
15575        Bra
15576        Any+
15577        X+
15578        Ket
15579        End
15580------------------------------------------------------------------
15581
15582".+\QX\E+"B,auto_callout,no_auto_possess
15583------------------------------------------------------------------
15584        Bra
15585        Callout 255 0 4
15586        Any+
15587        Callout 255 4 4
15588        X+
15589        Callout 255 8 0
15590        Ket
15591        End
15592------------------------------------------------------------------
15593
15594# This one is here because Perl gives an 'unmatched )' error which goes away
15595# if one of the \) sequences is removed - which is weird. PCRE finds it too
15596# complicated to find a minimum matching length.
15597
15598"()X|((((((((()))))))((((())))))\2())((((((\2\2)))\2)(\22((((\2\2)2))\2)))(2\ZZZ)+:)Z^|91ZiZZnter(ZZ |91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z+:)Z|91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z((Z*(\2(Z\':))\0)i|||||||||||||||loZ\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0nte!rnal errpr\2\\21r(2\ZZZ)+:)Z!|91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0(2\ZZZ)+:)Z^|91ZiZZnter(ZZ |91Z(ZZ ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \)\0(2\ZZZ)+:)Z^)))int \)\0(2\ZZZ)+:)Z^|91ZiZZnter(ZZernZal ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)2))\2Z)))int \))\ZZ(\r2Z( or#(\Z2(Z\Z(\2\2)2))\2Z)Z(\22Z((\Z2(Z\Z(\2\2)))\2))))((((((\2\2))))))"I
15599Capture group count = 108
15600Max back reference = 22
15601Contains explicit CR or LF match
15602Subject length lower bound = 1
15603
15604# This checks that new code for handling groups that may match an empty string
15605# works on a very large number of alternatives. This pattern used to provoke a
15606# complaint that it was too complicated.
15607
15608/(?:\[A|B|C|D|E|F|G|H|I|J|]{200}Z)/expand
15609
15610# This one used to compile rubbish instead of a compile error, and then
15611# behave unpredictably at match time.
15612
15613/.+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X/
15614Failed: error 128 at offset 63: assertion expected after (?( or (?(?C)
15615    .+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X
15616
15617/[:[:alnum:]-[[a:lnum:]+/
15618Failed: error 150 at offset 11: invalid range in character class
15619
15620/((?(?C'')\QX\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
15621Failed: error 128 at offset 11: assertion expected after (?( or (?(?C)
15622
15623/((?(?C'')\Q\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
15624
15625/abcd/auto_callout
15626    abcd\=callout_error=255:2
15627--->abcd
15628 +0 ^        a
15629 +1 ^^       b
15630Failed: error -37: callout error code
15631
15632/()(\g+65534)/
15633Failed: error 161 at offset 11: subpattern number is too big
15634
15635/()(\g+65533)/
15636Failed: error 115 at offset 10: reference to non-existent subpattern
15637
15638/�\x00\x00\x00�(\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\2*\x00k\d+\x00‎\x00\x00\x00\x00\x00\2*\x00\x00\1*.){36}int^\x00\x00��\x00�(\1{50779}?)J\w2/I
15639Capture group count = 2
15640Max back reference = 2
15641First code unit = \xc1
15642Last code unit = '2'
15643Subject length lower bound = 65535
15644
15645/(a)(b)\2\1\1\1\1/I
15646Capture group count = 2
15647Max back reference = 2
15648First code unit = 'a'
15649Last code unit = 'b'
15650Subject length lower bound = 7
15651
15652/(?<a>a)(?<b>b)\g{b}\g{a}\g{a}\g{a}\g{a}(?<a>xx)(?<b>zz)/I,dupnames
15653Capture group count = 4
15654Max back reference = 4
15655Named capture groups:
15656  a   1
15657  a   3
15658  b   2
15659  b   4
15660Options: dupnames
15661First code unit = 'a'
15662Last code unit = 'z'
15663Subject length lower bound = 11
15664
15665//
15666    \=ovector=7777777777
15667** Invalid value in 'ovector=7777777777'
15668
15669# This is here because Perl matches, even though a COMMIT is encountered
15670# outside of the recursion.
15671
15672/(?1)(A(*COMMIT)|B)D/
15673    BAXBAD
15674No match
15675
15676"(?1){2}(a)"B
15677------------------------------------------------------------------
15678        Bra
15679        Recurse
15680        Recurse
15681        CBra 1
15682        a
15683        Ket
15684        Ket
15685        End
15686------------------------------------------------------------------
15687
15688"(?1){2,4}(a)"B
15689------------------------------------------------------------------
15690        Bra
15691        Recurse
15692        Recurse
15693        Brazero
15694        Bra
15695        Bra
15696        Recurse
15697        Ket
15698        Brazero
15699        Bra
15700        Recurse
15701        Ket
15702        Ket
15703        CBra 1
15704        a
15705        Ket
15706        Ket
15707        End
15708------------------------------------------------------------------
15709
15710# This test differs from Perl for the first subject. Perl ends up with
15711# $1 set to 'B'; PCRE2 has it unset (which I think is right).
15712
15713/^(?:
15714(?:A| (?:B|B(*ACCEPT)) (?<=(.)) D)
15715(Z)
15716)+$/x
15717    AZB
15718 0: AZB
15719 1: <unset>
15720 2: Z
15721    AZBDZ
15722 0: AZBDZ
15723 1: B
15724 2: Z
15725
15726# The first of these, when run by Perl, gives the mark 'aa', which is wrong.
15727
15728'(?>a(*:aa))b|ac' mark
15729    ac
15730 0: ac
15731
15732'(?:a(*:aa))b|ac' mark
15733    ac
15734 0: ac
15735
15736/(R?){65}/
15737    (R?){65}
15738 0:
15739 1:
15740
15741/\[(a)]{60}/expand
15742    aaaa
15743No match
15744
15745/(?<!\1((?U)1((?U))))(*F)/never_backslash_c,alt_bsux,anchored,extended
15746
15747/\g{3/
15748Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
15749
15750/(a(?C1)(b)(c)d)+/
15751  abcdabcd\=callout_capture
15752Callout 1: last capture = 0
15753--->abcdabcd
15754    ^^           (
15755Callout 1: last capture = 1
15756 1: abcd
15757 2: b
15758 3: c
15759--->abcdabcd
15760    ^    ^       (
15761 0: abcdabcd
15762 1: abcd
15763 2: b
15764 3: c
15765
15766# Perl matches this one, but PCRE does not because (*ACCEPT) clears out any
15767# pending backtracks in the recursion.
15768
15769/^ (?(DEFINE) (..(*ACCEPT)|...) ) (?1)$/x
15770\= Expect no match
15771    abc
15772No match
15773
15774# Perl gives no match for this one
15775
15776/(a(*MARK:m)(*ACCEPT)){0}(?1)/mark
15777    abc
15778 0: a
15779MK: m
15780
15781/abc/endanchored
15782    xyzabc
15783 0: abc
15784\= Expect no match
15785    xyzabcdef
15786No match
15787\= Expect error
15788    xyzabc\=ph
15789Failed: error -34: bad option value
15790
15791/abc/
15792    xyzabc\=endanchored
15793 0: abc
15794\= Expect no match
15795    xyzabcdef\=endanchored
15796No match
15797\= Expect error
15798    xyzabc\=ps,endanchored
15799Failed: error -34: bad option value
15800
15801/abc(*ACCEPT)d/endanchored
15802    xyzabc
15803 0: abc
15804\= Expect no match
15805    xyzabcdef
15806No match
15807
15808/abc|bcd/endanchored
15809    xyzabcd
15810 0: bcd
15811\= Expect no match
15812    xyzabcdef
15813No match
15814
15815/a(*ACCEPT)x|aa/endanchored
15816    aaa
15817 0: a
15818
15819# Check auto-anchoring when there is a group that is never obeyed at
15820# the start of a branch.
15821
15822/(?(DEFINE)(a))^bc/I
15823Capture group count = 1
15824Compile options: <none>
15825Overall options: anchored
15826First code unit = 'b'
15827Subject length lower bound = 2
15828
15829/(a){0}.*bc/sI
15830Capture group count = 1
15831Compile options: dotall
15832Overall options: anchored dotall
15833Last code unit = 'c'
15834Subject length lower bound = 2
15835
15836# This should be anchored, as the condition is always false and there is
15837# no alternative branch.
15838
15839/(?(VERSION>=999)yes)^bc/I
15840Capture group count = 0
15841Compile options: <none>
15842Overall options: anchored
15843Subject length lower bound = 2
15844
15845# This should not be anchored.
15846
15847/(?(VERSION>=999)yes|no)^bc/I
15848Capture group count = 0
15849Last code unit = 'c'
15850Subject length lower bound = 4
15851
15852/(*LIMIT_HEAP=0)xxx/I
15853Capture group count = 0
15854Heap limit = 0
15855First code unit = 'x'
15856Last code unit = 'x'
15857Subject length lower bound = 3
15858
15859/\d{0,3}(*:abc)(?C1)xxx/callout_info
15860Callout 1  x
15861
15862# ----------------------------------------------------------------------
15863
15864# These are a whole pile of tests that touch lines of code that are not
15865# used by any other tests (at least when these were created).
15866
15867/^a+?x/i,no_start_optimize,no_auto_possess
15868\= Expect no match
15869    aaa
15870No match
15871
15872/^[^a]{3,}?x/i,no_start_optimize,no_auto_possess
15873\= Expect no match
15874    bbb
15875No match
15876    cc
15877No match
15878
15879/^X\S/no_start_optimize,no_auto_possess
15880\= Expect no match
15881    X
15882No match
15883
15884/^X\W/no_start_optimize,no_auto_possess
15885\= Expect no match
15886    X
15887No match
15888
15889/^X\H/no_start_optimize,no_auto_possess
15890\= Expect no match
15891    X
15892No match
15893
15894/^X\h/no_start_optimize,no_auto_possess
15895\= Expect no match
15896    X
15897No match
15898
15899/^X\V/no_start_optimize,no_auto_possess
15900\= Expect no match
15901    X
15902No match
15903
15904/^X\v/no_start_optimize,no_auto_possess
15905\= Expect no match
15906    X
15907No match
15908
15909/^X\h/no_start_optimize,no_auto_possess
15910\= Expect no match
15911    XY
15912No match
15913
15914/^X\V/no_start_optimize,no_auto_possess
15915\= Expect no match
15916    X\n
15917No match
15918
15919/^X\v/no_start_optimize,no_auto_possess
15920\= Expect no match
15921    XX
15922No match
15923
15924/^X.+?/s,no_start_optimize,no_auto_possess
15925\= Expect no match
15926    X
15927No match
15928
15929/^X\R+?/no_start_optimize,no_auto_possess
15930\= Expect no match
15931    XX
15932No match
15933
15934/^X\H+?/no_start_optimize,no_auto_possess
15935\= Expect no match
15936    X
15937No match
15938
15939/^X\h+?/no_start_optimize,no_auto_possess
15940\= Expect no match
15941    X
15942No match
15943
15944/^X\V+?/no_start_optimize,no_auto_possess
15945\= Expect no match
15946    X
15947No match
15948    X\n
15949No match
15950
15951/^X\D+?/no_start_optimize,no_auto_possess
15952\= Expect no match
15953    X
15954No match
15955    X9
15956No match
15957
15958/^X\S+?/no_start_optimize,no_auto_possess
15959\= Expect no match
15960    X
15961No match
15962    X\n
15963No match
15964
15965/^X\W+?/no_start_optimize,no_auto_possess
15966\= Expect no match
15967    X
15968No match
15969    XX
15970No match
15971
15972/^X.+?Z/no_start_optimize,no_auto_possess
15973\= Expect no match
15974    XY\n
15975No match
15976
15977/(*CRLF)^X.+?Z/no_start_optimize,no_auto_possess
15978\= Expect no match
15979    XY\r\=ps
15980Partial match: XY\x0d
15981
15982/^X\R+?Z/no_start_optimize,no_auto_possess
15983\= Expect no match
15984    X\nX
15985No match
15986    X\n\r\n
15987No match
15988    X\n\rY
15989No match
15990    X\n\nY
15991No match
15992    X\n\x{0c}Y
15993No match
15994
15995/(*BSR_ANYCRLF)^X\R+?Z/no_start_optimize,no_auto_possess
15996\= Expect no match
15997    X\nX
15998No match
15999    X\n\r\n
16000No match
16001    X\n\rY
16002No match
16003    X\n\nY
16004No match
16005    X\n\x{0c}Y
16006No match
16007
16008/^X\H+?Z/no_start_optimize,no_auto_possess
16009\= Expect no match
16010    XY\t
16011No match
16012    XYY
16013No match
16014
16015/^X\h+?Z/no_start_optimize,no_auto_possess
16016\= Expect no match
16017    X\t\t
16018No match
16019    X\tY
16020No match
16021
16022/^X\V+?Z/no_start_optimize,no_auto_possess
16023\= Expect no match
16024    XY\n
16025No match
16026    XYY
16027No match
16028
16029/^X\v+?Z/no_start_optimize,no_auto_possess
16030\= Expect no match
16031    X\n\n
16032No match
16033    X\nY
16034No match
16035
16036/^X\D+?Z/no_start_optimize,no_auto_possess
16037\= Expect no match
16038    XY9
16039No match
16040    XYY
16041No match
16042
16043/^X\d+?Z/no_start_optimize,no_auto_possess
16044\= Expect no match
16045    X99
16046No match
16047    X9Y
16048No match
16049
16050/^X\S+?Z/no_start_optimize,no_auto_possess
16051\= Expect no match
16052    XY\n
16053No match
16054    XYY
16055No match
16056
16057/^X\s+?Z/no_start_optimize,no_auto_possess
16058\= Expect no match
16059    X\n\n
16060No match
16061    X\nY
16062No match
16063
16064/^X\W+?Z/no_start_optimize,no_auto_possess
16065\= Expect no match
16066    X.A
16067No match
16068    X++
16069No match
16070
16071/^X\w+?Z/no_start_optimize,no_auto_possess
16072\= Expect no match
16073    Xa.
16074No match
16075    Xaa
16076No match
16077
16078/^X.{1,3}Z/s,no_start_optimize,no_auto_possess
16079\= Expect no match
16080    Xa.bd
16081No match
16082
16083/^X\h+Z/no_start_optimize,no_auto_possess
16084\= Expect no match
16085    X\t\t
16086No match
16087    X\tY
16088No match
16089
16090/^X\V+Z/no_start_optimize,no_auto_possess
16091\= Expect no match
16092    XY\n
16093No match
16094    XYY
16095No match
16096
16097/^(X(*THEN)Y|AB){0}(?1)/
16098    ABX
16099 0: AB
16100\= Expect no match
16101    XAB
16102No match
16103
16104/^(?!A(?C1)B)C/
16105    ABC\=callout_error=1,no_jit
16106No match
16107
16108/^(?!A(?C1)B)C/no_start_optimize
16109    ABC\=callout_error=1
16110--->ABC
16111  1 ^^      B
16112Failed: error -37: callout error code
16113
16114/^(?(?!A(?C1)B)C)/
16115    ABC\=callout_error=1
16116--->ABC
16117  1 ^^      B
16118Failed: error -37: callout error code
16119
16120# ----------------------------------------------------------------------
16121
16122/[a b c]/BxxI
16123------------------------------------------------------------------
16124        Bra
16125        [a-c]
16126        Ket
16127        End
16128------------------------------------------------------------------
16129Capture group count = 0
16130Options: extended_more
16131Starting code units: a b c
16132Subject length lower bound = 1
16133
16134/[a b c]/BxxxI
16135------------------------------------------------------------------
16136        Bra
16137        [a-c]
16138        Ket
16139        End
16140------------------------------------------------------------------
16141Capture group count = 0
16142Options: extended extended_more
16143Starting code units: a b c
16144Subject length lower bound = 1
16145
16146/[a b c]/B,extended_more
16147------------------------------------------------------------------
16148        Bra
16149        [a-c]
16150        Ket
16151        End
16152------------------------------------------------------------------
16153
16154/[ a b c ]/B,extended_more
16155------------------------------------------------------------------
16156        Bra
16157        [a-c]
16158        Ket
16159        End
16160------------------------------------------------------------------
16161
16162/[a b](?xx: [ 12 ] (?-xx:[ 34 ]) )y z/B
16163------------------------------------------------------------------
16164        Bra
16165        [ ab]
16166        Bra
16167        [12]
16168        Bra
16169        [ 34]
16170        Ket
16171        Ket
16172        y z
16173        Ket
16174        End
16175------------------------------------------------------------------
16176
16177# Unsetting /x also unsets /xx
16178
16179/[a b](?xx: [ 12 ] (?-x:[ 34 ]) )y z/B
16180------------------------------------------------------------------
16181        Bra
16182        [ ab]
16183        Bra
16184        [12]
16185        Bra
16186        [ 34]
16187        Ket
16188        Ket
16189        y z
16190        Ket
16191        End
16192------------------------------------------------------------------
16193
16194/(a)(?-n:(b))(c)/nB
16195------------------------------------------------------------------
16196        Bra
16197        Bra
16198        a
16199        Ket
16200        Bra
16201        CBra 1
16202        b
16203        Ket
16204        Ket
16205        Bra
16206        c
16207        Ket
16208        Ket
16209        End
16210------------------------------------------------------------------
16211
16212# ----------------------------------------------------------------------
16213# These test the dangerous PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL option.
16214
16215/\j\x{z}\o{82}\L\uabcd\u\U\g{\g/B,\bad_escape_is_literal
16216** Unrecognized modifier '\' in '\bad_escape_is_literal'
16217
16218/\N{\c/IB,bad_escape_is_literal
16219------------------------------------------------------------------
16220        Bra
16221        N{c
16222        Ket
16223        End
16224------------------------------------------------------------------
16225Capture group count = 0
16226Extra options: bad_escape_is_literal
16227First code unit = 'N'
16228Last code unit = 'c'
16229Subject length lower bound = 3
16230
16231/[\j\x{z}\o\gAb\g]/B,bad_escape_is_literal
16232------------------------------------------------------------------
16233        Bra
16234        [Abgjoxz{}]
16235        Ket
16236        End
16237------------------------------------------------------------------
16238
16239/[Q-\N]/B,bad_escape_is_literal
16240Failed: error 150 at offset 5: invalid range in character class
16241
16242/[\s-_]/bad_escape_is_literal
16243Failed: error 150 at offset 3: invalid range in character class
16244
16245/[_-\s]/bad_escape_is_literal
16246Failed: error 150 at offset 5: invalid range in character class
16247
16248/[\B\R\X]/B
16249Failed: error 107 at offset 2: escape sequence is invalid in character class
16250
16251/[\B\R\X]/B,bad_escape_is_literal
16252Failed: error 107 at offset 2: escape sequence is invalid in character class
16253
16254/[A-\BP-\RV-\X]/B
16255Failed: error 107 at offset 4: escape sequence is invalid in character class
16256
16257/[A-\BP-\RV-\X]/B,bad_escape_is_literal
16258Failed: error 107 at offset 4: escape sequence is invalid in character class
16259
16260# ----------------------------------------------------------------------
16261
16262/a\b(c/literal
16263    a\\b(c
16264 0: a\b(c
16265
16266/a\b(c/literal,caseless
16267    a\\b(c
16268 0: a\b(c
16269    a\\B(c
16270 0: a\B(c
16271
16272/a\b(c/literal,firstline
16273    XYYa\\b(c
16274 0: a\b(c
16275\= Expect no match
16276    X\na\\b(c
16277No match
16278
16279/a\b?c/literal,use_offset_limit
16280    XXXXa\\b?c\=offset_limit=4
16281 0: a\b?c
16282\= Expect no match
16283    XXXXa\\b?c\=offset_limit=3
16284No match
16285
16286/a\b(c/literal,anchored,endanchored
16287    a\\b(c
16288 0: a\b(c
16289\= Expect no match
16290    Xa\\b(c
16291No match
16292    a\\b(cX
16293No match
16294    Xa\\b(cX
16295No match
16296
16297//literal,extended
16298Failed: error 192 at offset 0: invalid option bits with PCRE2_LITERAL
16299
16300/a\b(c/literal,auto_callout,no_start_optimize
16301    XXXXa\\b(c
16302--->XXXXa\b(c
16303 +0 ^             a
16304 +0  ^            a
16305 +0   ^           a
16306 +0    ^          a
16307 +0     ^         a
16308 +1     ^^        \
16309 +2     ^ ^       b
16310 +3     ^  ^      (
16311 +4     ^   ^     c
16312 +5     ^    ^    End of pattern
16313 0: a\b(c
16314
16315/a\b(c/literal,auto_callout
16316    XXXXa\\b(c
16317--->XXXXa\b(c
16318 +0     ^         a
16319 +1     ^^        \
16320 +2     ^ ^       b
16321 +3     ^  ^      (
16322 +4     ^   ^     c
16323 +5     ^    ^    End of pattern
16324 0: a\b(c
16325
16326/(*CR)abc/literal
16327    (*CR)abc
16328 0: (*CR)abc
16329
16330/cat|dog/I,match_word
16331Capture group count = 0
16332Max lookbehind = 1
16333Extra options: match_word
16334Starting code units: c d
16335Subject length lower bound = 3
16336    the cat sat
16337 0: cat
16338\= Expect no match
16339    caterpillar
16340No match
16341    snowcat
16342No match
16343    syndicate
16344No match
16345
16346/(cat)|dog/I,match_line,literal
16347Capture group count = 0
16348Compile options: literal
16349Overall options: anchored literal
16350Extra options: match_line
16351First code unit = '('
16352Subject length lower bound = 9
16353    (cat)|dog
16354 0: (cat)|dog
16355\= Expect no match
16356    the cat sat
16357No match
16358    caterpillar
16359No match
16360    snowcat
16361No match
16362    syndicate
16363No match
16364
16365/a whole line/match_line,multiline
16366    Rhubarb \na whole line\n custard
16367 0: a whole line
16368\= Expect no match
16369    Not a whole line
16370No match
16371
16372# Perl gets this wrong, failing to capture 'b' in group 1.
16373
16374/^(b+|a){1,2}?bc/
16375    bbc
16376 0: bbc
16377 1: b
16378
16379# And again here, for the "babc" subject string.
16380
16381/^(b*|ba){1,2}?bc/
16382    babc
16383 0: babc
16384 1: ba
16385    bbabc
16386 0: bbabc
16387 1: ba
16388    bababc
16389 0: bababc
16390 1: ba
16391\= Expect no match
16392    bababbc
16393No match
16394    babababc
16395No match
16396
16397/[[:digit:]-a]/
16398Failed: error 150 at offset 10: invalid range in character class
16399
16400/[[:digit:]-[:print:]]/
16401Failed: error 150 at offset 10: invalid range in character class
16402
16403/[\d-a]/
16404Failed: error 150 at offset 3: invalid range in character class
16405
16406/[\H-z]/
16407Failed: error 150 at offset 3: invalid range in character class
16408
16409/[\d-[:print:]]/
16410Failed: error 150 at offset 3: invalid range in character class
16411
16412# Perl gets the second of these wrong, giving no match.
16413
16414"(?<=(a))\1?b"I
16415Capture group count = 1
16416Max back reference = 1
16417Max lookbehind = 1
16418Last code unit = 'b'
16419Subject length lower bound = 1
16420    ab
16421 0: b
16422 1: a
16423    aaab
16424 0: ab
16425 1: a
16426
16427"(?=(a))\1?b"I
16428Capture group count = 1
16429Max back reference = 1
16430First code unit = 'a'
16431Last code unit = 'b'
16432Subject length lower bound = 2
16433    ab
16434 0: ab
16435 1: a
16436    aaab
16437 0: ab
16438 1: a
16439
16440# JIT does not support callout_extra
16441
16442/(*NO_JIT)(a+)b/auto_callout,no_start_optimize,no_auto_possess
16443\= Expect no match
16444    aac\=callout_extra
16445New match attempt
16446--->aac
16447 +9 ^       (
16448+10 ^       a+
16449+12 ^ ^     )
16450+13 ^ ^     b
16451Backtrack
16452--->aac
16453+12 ^^      )
16454+13 ^^      b
16455Backtrack
16456No other matching paths
16457New match attempt
16458--->aac
16459 +9  ^      (
16460+10  ^      a+
16461+12  ^^     )
16462+13  ^^     b
16463Backtrack
16464No other matching paths
16465New match attempt
16466--->aac
16467 +9   ^     (
16468+10   ^     a+
16469Backtrack
16470No other matching paths
16471New match attempt
16472--->aac
16473 +9    ^    (
16474+10    ^    a+
16475No match
16476
16477/(*NO_JIT)a+(?C'XXX')b/no_start_optimize,no_auto_possess
16478\= Expect no match
16479    aac\=callout_extra
16480New match attempt
16481Callout (15): 'XXX'
16482--->aac
16483    ^ ^     b
16484Backtrack
16485Callout (15): 'XXX'
16486--->aac
16487    ^^      b
16488Backtrack
16489No other matching paths
16490New match attempt
16491Callout (15): 'XXX'
16492--->aac
16493     ^^     b
16494No match
16495
16496/\n/firstline
16497    xyz\nabc
16498 0: \x0a
16499
16500/\nabc/firstline
16501    xyz\nabc
16502 0: \x0aabc
16503
16504/\x{0a}abc/firstline,newline=crlf
16505\= Expect no match
16506    xyz\r\nabc
16507No match
16508
16509/[abc]/firstline
16510\= Expect no match
16511    \na
16512No match
16513
16514# These tests are matched in test 1 as they are Perl compatible. Here we are
16515# looking at what does and does not get auto-possessified.
16516
16517/(?(DEFINE)(?<optional_a>a?))^(?&optional_a)a$/B
16518------------------------------------------------------------------
16519        Bra
16520        Cond
16521        Cond false
16522        CBra 1
16523        a?
16524        Ket
16525        Ket
16526        ^
16527        Recurse
16528        a
16529        $
16530        Ket
16531        End
16532------------------------------------------------------------------
16533
16534/(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/B
16535------------------------------------------------------------------
16536        Bra
16537        Cond
16538        Cond false
16539        CBra 1
16540        a?
16541        Ket
16542        X
16543        Ket
16544        ^
16545        Recurse
16546        a
16547        $
16548        Ket
16549        End
16550------------------------------------------------------------------
16551
16552/^(a?)b(?1)a/B
16553------------------------------------------------------------------
16554        Bra
16555        ^
16556        CBra 1
16557        a?
16558        Ket
16559        b
16560        Recurse
16561        a
16562        Ket
16563        End
16564------------------------------------------------------------------
16565
16566/^(a?)+b(?1)a/B
16567------------------------------------------------------------------
16568        Bra
16569        ^
16570        SCBra 1
16571        a?
16572        KetRmax
16573        b
16574        Recurse
16575        a
16576        Ket
16577        End
16578------------------------------------------------------------------
16579
16580/^(a?)++b(?1)a/B
16581------------------------------------------------------------------
16582        Bra
16583        ^
16584        SCBraPos 1
16585        a?
16586        KetRpos
16587        b
16588        Recurse
16589        a
16590        Ket
16591        End
16592------------------------------------------------------------------
16593
16594/^(a?)+b/B
16595------------------------------------------------------------------
16596        Bra
16597        ^
16598        SCBra 1
16599        a?
16600        KetRmax
16601        b
16602        Ket
16603        End
16604------------------------------------------------------------------
16605
16606/(?=a+)a(a+)++b/B
16607------------------------------------------------------------------
16608        Bra
16609        Assert
16610        a++
16611        Ket
16612        a
16613        CBraPos 1
16614        a++
16615        KetRpos
16616        b
16617        Ket
16618        End
16619------------------------------------------------------------------
16620
16621/(?<=(?=.){4,5}x)/B
16622------------------------------------------------------------------
16623        Bra
16624        Assert back
16625        Reverse
16626        Assert
16627        Any
16628        Ket
16629        Assert
16630        Any
16631        Ket
16632        Assert
16633        Any
16634        Ket
16635        Assert
16636        Any
16637        Ket
16638        Brazero
16639        Assert
16640        Any
16641        Ket
16642        x
16643        Ket
16644        Ket
16645        End
16646------------------------------------------------------------------
16647
16648# Perl behaves differently with these when optimization is turned off
16649
16650/a(*PRUNE:X)bc|qq/mark,no_start_optimize
16651\= Expect no match
16652    axy
16653No match, mark = X
16654
16655/a(*THEN:X)bc|qq/mark,no_start_optimize
16656\= Expect no match
16657    axy
16658No match, mark = X
16659
16660/(?^x-i)AB/
16661Failed: error 194 at offset 4: invalid hyphen in option setting
16662
16663/(?^-i)AB/
16664Failed: error 194 at offset 3: invalid hyphen in option setting
16665
16666/(?x-i-i)/
16667Failed: error 194 at offset 5: invalid hyphen in option setting
16668
16669/(?(?=^))b/I
16670Capture group count = 0
16671Last code unit = 'b'
16672Subject length lower bound = 1
16673    abc
16674 0: b
16675
16676/(?(?=^)|)b/I
16677Capture group count = 0
16678First code unit = 'b'
16679Subject length lower bound = 1
16680    abc
16681 0: b
16682
16683/(?(?=^)|^)b/I
16684Capture group count = 0
16685Compile options: <none>
16686Overall options: anchored
16687First code unit = 'b'
16688Subject length lower bound = 1
16689    bbc
16690 0: b
16691\= Expect no match
16692    abc
16693No match
16694
16695/(?(1)^|^())/I
16696Capture group count = 1
16697Max back reference = 1
16698May match empty string
16699Compile options: <none>
16700Overall options: anchored
16701Subject length lower bound = 0
16702
16703/(?(1)^())b/I
16704Capture group count = 1
16705Max back reference = 1
16706Last code unit = 'b'
16707Subject length lower bound = 1
16708
16709/(?(1)^())+b/I,aftertext
16710Capture group count = 1
16711Max back reference = 1
16712Last code unit = 'b'
16713Subject length lower bound = 1
16714    abc
16715 0: b
16716 0+ c
16717
16718/(?(1)^()|^)+b/I,aftertext
16719Capture group count = 1
16720Max back reference = 1
16721Compile options: <none>
16722Overall options: anchored
16723First code unit = 'b'
16724Subject length lower bound = 1
16725    bbc
16726 0: b
16727 0+ bc
16728\= Expect no match
16729    abc
16730No match
16731
16732/(?(1)^()|^)*b/I,aftertext
16733Capture group count = 1
16734Max back reference = 1
16735First code unit = 'b'
16736Subject length lower bound = 1
16737    bbc
16738 0: b
16739 0+ bc
16740    abc
16741 0: b
16742 0+ c
16743    xbc
16744 0: b
16745 0+ c
16746
16747/(?(1)^())+b/I,aftertext
16748Capture group count = 1
16749Max back reference = 1
16750Last code unit = 'b'
16751Subject length lower bound = 1
16752    abc
16753 0: b
16754 0+ c
16755
16756/(?(1)^a()|^a)+b/I,aftertext
16757Capture group count = 1
16758Max back reference = 1
16759Compile options: <none>
16760Overall options: anchored
16761First code unit = 'a'
16762Last code unit = 'b'
16763Subject length lower bound = 2
16764    abc
16765 0: ab
16766 0+ c
16767\= Expect no match
16768    bbc
16769No match
16770
16771/(?(1)^|^(a))+b/I,aftertext
16772Capture group count = 1
16773Max back reference = 1
16774Compile options: <none>
16775Overall options: anchored
16776Last code unit = 'b'
16777Subject length lower bound = 1
16778    abc
16779 0: ab
16780 0+ c
16781 1: a
16782\= Expect no match
16783    bbc
16784No match
16785
16786/(?(1)^a()|^a)*b/I,aftertext
16787Capture group count = 1
16788Max back reference = 1
16789Last code unit = 'b'
16790Subject length lower bound = 1
16791    abc
16792 0: ab
16793 0+ c
16794    bbc
16795 0: b
16796 0+ bc
16797    xbc
16798 0: b
16799 0+ c
16800
16801/a(b)c|xyz/g,allvector,replace=<$0>
16802    abcdefabcpqr\=ovector=4
16803 2: <abc>def<abc>pqr
16804 0: 6 9
16805 1: 7 8
16806 2: <unchanged>
16807 3: <unchanged>
16808    abxyz\=ovector=4
16809 1: ab<xyz>
16810 0: 2 5
16811 1: <unset>
16812 2: <unchanged>
16813 3: <unchanged>
16814    abcdefxyz\=ovector=4
16815 2: <abc>def<xyz>
16816 0: 6 9
16817 1: <unset>
16818 2: <unchanged>
16819 3: <unchanged>
16820
16821/a(b)c|xyz/allvector
16822    abcdef\=ovector=4
16823 0: abc
16824 1: b
16825 2: <unchanged>
16826 3: <unchanged>
16827    abxyz\=ovector=4
16828 0: xyz
16829 1: <unset>
16830 2: <unchanged>
16831 3: <unchanged>
16832
16833/a(b)c|xyz/g,replace=<$0>,substitute_callout
16834    abcdefabcpqr
16835 1(2) Old 0 3 "abc" New 0 5 "<abc>"
16836 2(2) Old 6 9 "abc" New 8 13 "<abc>"
16837 2: <abc>def<abc>pqr
16838    abxyzpqrabcxyz
16839 1(1) Old 2 5 "xyz" New 2 7 "<xyz>"
16840 2(2) Old 8 11 "abc" New 10 15 "<abc>"
16841 3(1) Old 11 14 "xyz" New 15 20 "<xyz>"
16842 3: ab<xyz>pqr<abc><xyz>
16843    12abc34xyz99abc55\=substitute_stop=2
16844 1(2) Old 2 5 "abc" New 2 7 "<abc>"
16845 2(1) Old 7 10 "xyz" New 9 14 "<xyz> STOPPED"
16846 2: 12<abc>34xyz99abc55
16847    12abc34xyz99abc55\=substitute_skip=1
16848 1(2) Old 2 5 "abc" New 2 7 "<abc> SKIPPED"
16849 2(1) Old 7 10 "xyz" New 7 12 "<xyz>"
16850 3(2) Old 12 15 "abc" New 14 19 "<abc>"
16851 3: 12abc34<xyz>99<abc>55
16852    12abc34xyz99abc55\=substitute_skip=2
16853 1(2) Old 2 5 "abc" New 2 7 "<abc>"
16854 2(1) Old 7 10 "xyz" New 9 14 "<xyz> SKIPPED"
16855 3(2) Old 12 15 "abc" New 14 19 "<abc>"
16856 3: 12<abc>34xyz99<abc>55
16857
16858/a(b)c|xyz/g,replace=<$0>
16859    abcdefabcpqr
16860 2: <abc>def<abc>pqr
16861    abxyzpqrabcxyz
16862 3: ab<xyz>pqr<abc><xyz>
16863    12abc34xyz\=substitute_stop=2
16864 1(2) Old 2 5 "abc" New 2 7 "<abc>"
16865 2(1) Old 7 10 "xyz" New 9 14 "<xyz> STOPPED"
16866 2: 12<abc>34xyz
16867    12abc34xyz\=substitute_skip=1
16868 1(2) Old 2 5 "abc" New 2 7 "<abc> SKIPPED"
16869 2(1) Old 7 10 "xyz" New 7 12 "<xyz>"
16870 2: 12abc34<xyz>
16871
16872/a(b)c|xyz/replace=<$0>
16873    abcdefabcpqr
16874 1: <abc>defabcpqr
16875    12abc34xyz\=substitute_skip=1
16876 1(2) Old 2 5 "abc" New 2 7 "<abc> SKIPPED"
16877 1: 12abc34xyz
16878    12abc34xyz\=substitute_stop=1
16879 1(2) Old 2 5 "abc" New 2 7 "<abc> STOPPED"
16880 1: 12abc34xyz
16881
16882/abc\rdef/
16883    abc\ndef
16884No match
16885
16886/abc\rdef\x{0d}xyz/escaped_cr_is_lf
16887    abc\ndef\rxyz
16888 0: abc\x0adef\x0dxyz
16889\= Expect no match
16890    abc\ndef\nxyz
16891No match
16892
16893/(?(*ACCEPT)xxx)/
16894Failed: error 128 at offset 2: assertion expected after (?( or (?(?C)
16895
16896/(?(*atomic:xx)xxx)/
16897Failed: error 128 at offset 10: assertion expected after (?( or (?(?C)
16898
16899/(?(*script_run:xxx)zzz)/
16900Failed: error 128 at offset 14: assertion expected after (?( or (?(?C)
16901
16902/foobar/
16903    the foobar thing\=copy_matched_subject
16904 0: foobar
16905    the foobar thing\=copy_matched_subject,zero_terminate
16906 0: foobar
16907
16908/foobar/g
16909    the foobar thing foobar again\=copy_matched_subject
16910 0: foobar
16911 0: foobar
16912
16913/(*:XX)^abc/I
16914Capture group count = 0
16915Compile options: <none>
16916Overall options: anchored
16917First code unit = 'a'
16918Subject length lower bound = 3
16919
16920/(*COMMIT:XX)^abc/I
16921Capture group count = 0
16922Compile options: <none>
16923Overall options: anchored
16924First code unit = 'a'
16925Subject length lower bound = 3
16926
16927/(*ACCEPT:XX)^abc/I
16928Capture group count = 0
16929May match empty string
16930Subject length lower bound = 0
16931
16932/abc/replace=xyz
16933    abc\=null_context
16934 1: xyz
16935
16936/abc/replace=xyz,substitute_callout
16937    abc
16938 1(1) Old 0 3 "abc" New 0 3 "xyz"
16939 1: xyz
16940\= Expect error message
16941    abc\=null_context
16942** Replacement callouts are not supported with null_context.
16943
16944/\[()]{65535}()/expand
16945Failed: error 197 at offset 131071: too many capturing groups (maximum 65535)
16946
16947/\[()]{65535}(?<A>)/expand
16948Failed: error 197 at offset 131075: too many capturing groups (maximum 65535)
16949
16950/a(?:(*ACCEPT))??bc/
16951    abc
16952 0: abc
16953    axy
16954 0: a
16955
16956/a(*ACCEPT)??bc/
16957    abc
16958 0: abc
16959    axy
16960 0: a
16961
16962/a(*ACCEPT:XX)??bc/mark
16963    abc
16964 0: abc
16965    axy
16966 0: a
16967MK: XX
16968
16969/(*:\)?/
16970Failed: error 109 at offset 5: quantifier does not follow a repeatable item
16971
16972/(*:\Q \E){5}/alt_verbnames
16973Failed: error 109 at offset 11: quantifier does not follow a repeatable item
16974
16975/(?=abc)/I
16976Capture group count = 0
16977May match empty string
16978First code unit = 'a'
16979Last code unit = 'c'
16980Subject length lower bound = 2
16981
16982/(?|(X)|(XY))\1abc/I
16983Capture group count = 1
16984Max back reference = 1
16985First code unit = 'X'
16986Last code unit = 'c'
16987Subject length lower bound = 4
16988
16989/(?|(a)|(bcde))(c)\2/I
16990Capture group count = 2
16991Max back reference = 2
16992Starting code units: a b
16993Last code unit = 'c'
16994Subject length lower bound = 3
16995
16996/(?|(a)|(bcde))(c)\1/I
16997Capture group count = 2
16998Max back reference = 1
16999Starting code units: a b
17000Last code unit = 'c'
17001Subject length lower bound = 2
17002
17003/(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'B'(?'A')/I,dupnames
17004Capture group count = 3
17005Max back reference = 2
17006Named capture groups:
17007  A   1
17008  A   3
17009  B   2
17010Options: dupnames
17011Starting code units: a b
17012Last code unit = 'c'
17013Subject length lower bound = 3
17014
17015/(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'A'(?'A')/I,dupnames
17016Capture group count = 3
17017Max back reference = 3
17018Named capture groups:
17019  A   1
17020  A   3
17021  B   2
17022Options: dupnames
17023Starting code units: a b
17024Last code unit = 'c'
17025Subject length lower bound = 2
17026
17027/((a|)+)+Z/I
17028Capture group count = 2
17029Starting code units: Z a
17030Last code unit = 'Z'
17031Subject length lower bound = 1
17032
17033/((?=a))[abcd]/I
17034Capture group count = 1
17035First code unit = 'a'
17036Subject length lower bound = 1
17037
17038/A(?:(*ACCEPT))?B/info
17039Capture group count = 0
17040First code unit = 'A'
17041Subject length lower bound = 1
17042
17043/(A(*ACCEPT)??B)C/
17044    ABC
17045 0: ABC
17046 1: AB
17047    AXY
17048 0: A
17049 1: A
17050
17051/(?<=(?<=a)b)c.*/I
17052Capture group count = 0
17053Max lookbehind = 1
17054First code unit = 'c'
17055Subject length lower bound = 1
17056    abc\=ph
17057Partial match: c
17058\= Expect no match
17059    xbc\=ph
17060No match
17061
17062/(?<=ab)c.*/I
17063Capture group count = 0
17064Max lookbehind = 2
17065First code unit = 'c'
17066Subject length lower bound = 1
17067    abc\=ph
17068Partial match: c
17069\= Expect no match
17070    xbc\=ph
17071No match
17072
17073/(?<=a(?<=a|a)c)/I
17074Capture group count = 0
17075Max lookbehind = 2
17076May match empty string
17077Subject length lower bound = 0
17078
17079/(?<=a(?<=a|ba)c)/I
17080Capture group count = 0
17081Max lookbehind = 2
17082May match empty string
17083Subject length lower bound = 0
17084
17085/(?<=(?<=a)b)(?<!abcd)/I
17086Capture group count = 0
17087Max lookbehind = 4
17088May match empty string
17089Subject length lower bound = 0
17090
17091/(?<=(?<=a)b)(?<!abcd)(?<=(?<=a)bcde)/I
17092Capture group count = 0
17093Max lookbehind = 4
17094May match empty string
17095Subject length lower bound = 0
17096
17097# Addition overflow
17098/( {32742} {42})(?<!\1{65481})/
17099Failed: error 187 at offset 15: lookbehind assertion is too long
17100
17101# Multiplication overflow
17102/(X{65535})(?<=\1{32770})/
17103Failed: error 187 at offset 10: lookbehind assertion is too long
17104
17105# ---- Non-atomic assertion tests ----
17106
17107# Expect error: not allowed as a condition
17108/(?(*napla:xx)bc)/
17109Failed: error 198 at offset 9: atomic assertion expected after (?( or (?(?C)
17110
17111/\A(*pla:.*\b(\w++))(?>.*?\b\1\b){3}/
17112    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
17113No match
17114
17115/\A(*napla:.*\b(\w++))(?>.*?\b\1\b){3}/
17116    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
17117 0: word1 word3 word1 word2 word3 word2 word2 word1 word3
17118 1: word3
17119
17120/\A(?*.*\b(\w++))(?>.*?\b\1\b){3}/
17121    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
17122 0: word1 word3 word1 word2 word3 word2 word2 word1 word3
17123 1: word3
17124
17125/(*plb:(.)..|(.)...)(\1|\2)/
17126    abcdb\=offset=4
17127 0: b
17128 1: b
17129 2: <unset>
17130 3: b
17131    abcda\=offset=4
17132No match
17133
17134/(*naplb:(.)..|(.)...)(\1|\2)/
17135    abcdb\=offset=4
17136 0: b
17137 1: b
17138 2: <unset>
17139 3: b
17140    abcda\=offset=4
17141 0: a
17142 1: <unset>
17143 2: a
17144 3: a
17145
17146/(?<*(.)..|(.)...)(\1|\2)/
17147    abcdb\=offset=4
17148 0: b
17149 1: b
17150 2: <unset>
17151 3: b
17152    abcda\=offset=4
17153 0: a
17154 1: <unset>
17155 2: a
17156 3: a
17157
17158/(*non_atomic_positive_lookahead:ab)/B
17159------------------------------------------------------------------
17160        Bra
17161        Non-atomic assert
17162        ab
17163        Ket
17164        Ket
17165        End
17166------------------------------------------------------------------
17167
17168/(*non_atomic_positive_lookbehind:ab)/B
17169------------------------------------------------------------------
17170        Bra
17171        Non-atomic assert back
17172        Reverse
17173        ab
17174        Ket
17175        Ket
17176        End
17177------------------------------------------------------------------
17178
17179/(*pla:ab+)/B
17180------------------------------------------------------------------
17181        Bra
17182        Assert
17183        a
17184        b++
17185        Ket
17186        Ket
17187        End
17188------------------------------------------------------------------
17189
17190/(*napla:ab+)/B
17191------------------------------------------------------------------
17192        Bra
17193        Non-atomic assert
17194        a
17195        b+
17196        Ket
17197        Ket
17198        End
17199------------------------------------------------------------------
17200
17201/(*napla:)+/
17202
17203/(*naplb:)+/
17204
17205/(*napla:^x|^y)/I
17206Capture group count = 0
17207May match empty string
17208Compile options: <none>
17209Overall options: anchored
17210Starting code units: x y
17211Subject length lower bound = 1
17212
17213/(*napla:abc|abd)/I
17214Capture group count = 0
17215May match empty string
17216First code unit = 'a'
17217Subject length lower bound = 1
17218
17219/(*napla:a|(.)(*ACCEPT)zz)\1../
17220    abcd
17221 0: abc
17222 1: a
17223
17224/(*napla:a(*ACCEPT)zz|(.))\1../
17225    abcd
17226 0: bcd
17227 1: b
17228
17229/(*napla:a|(*COMMIT)(.))\1\1/
17230    aabc
17231 0: aa
17232 1: a
17233\= Expect no match
17234    abbc
17235No match
17236
17237/(*napla:a|(.))\1\1/
17238    aabc
17239 0: aa
17240 1: a
17241    abbc
17242 0: bb
17243 1: b
17244
17245# ----
17246
17247# Expect error (recursion => not fixed length)
17248/(\2)((?=(?<=\1)))/
17249Failed: error 125 at offset 8: lookbehind assertion is not fixed length
17250
17251/c*+(?<=[bc])/
17252    abc\=ph
17253Partial match: c
17254    ab\=ph
17255Partial match:
17256    abc\=ps
17257 0: c
17258    ab\=ps
17259 0:
17260
17261/c++(?<=[bc])/
17262    abc\=ph
17263Partial match: c
17264    ab\=ph
17265Partial match:
17266
17267/(?<=(?=.(?<=x)))/
17268    abx
17269 0:
17270    ab\=ph
17271Partial match:
17272    bxyz
17273 0:
17274    xyz
17275 0:
17276
17277/\z/
17278   abc\=ph
17279Partial match:
17280   abc\=ps
17281 0:
17282
17283/\Z/
17284   abc\=ph
17285Partial match:
17286   abc\=ps
17287 0:
17288   abc\n\=ph
17289Partial match: \x0a
17290   abc\n\=ps
17291 0:
17292
17293/(?![ab]).*/
17294    ab\=ph
17295Partial match:
17296
17297/c*+/
17298    ab\=ph,offset=2
17299Partial match:
17300
17301/\A\s*(a|(?:[^`]{28500}){4})/I
17302Capture group count = 1
17303Max lookbehind = 1
17304Compile options: <none>
17305Overall options: anchored
17306Subject length lower bound = 1
17307    a
17308 0: a
17309 1: a
17310
17311/\A\s*((?:[^`]{28500}){4})/I
17312Capture group count = 1
17313Max lookbehind = 1
17314Compile options: <none>
17315Overall options: anchored
17316Subject length lower bound = 65535
17317
17318/\A\s*((?:[^`]{28500}){4}|a)/I
17319Capture group count = 1
17320Max lookbehind = 1
17321Compile options: <none>
17322Overall options: anchored
17323Subject length lower bound = 1
17324    a
17325 0: a
17326 1: a
17327
17328/(?<A>a)(?(<A>)b)((?<=b).*)/B
17329------------------------------------------------------------------
17330        Bra
17331        CBra 1
17332        a
17333        Ket
17334        Cond
17335      1 Cond ref
17336        b
17337        Ket
17338        CBra 2
17339        Assert back
17340        Reverse
17341        b
17342        Ket
17343        Any*+
17344        Ket
17345        Ket
17346        End
17347------------------------------------------------------------------
17348
17349/(?(1)b)((?<=b).*)/B
17350------------------------------------------------------------------
17351        Bra
17352        Cond
17353      1 Cond ref
17354        b
17355        Ket
17356        CBra 1
17357        Assert back
17358        Reverse
17359        b
17360        Ket
17361        Any*+
17362        Ket
17363        Ket
17364        End
17365------------------------------------------------------------------
17366
17367/(?(R1)b)((?<=b).*)/B
17368------------------------------------------------------------------
17369        Bra
17370        Cond
17371        Cond recurse 1
17372        b
17373        Ket
17374        CBra 1
17375        Assert back
17376        Reverse
17377        b
17378        Ket
17379        Any*+
17380        Ket
17381        Ket
17382        End
17383------------------------------------------------------------------
17384
17385/(?(DEFINE)b)((?<=b).*)/B
17386------------------------------------------------------------------
17387        Bra
17388        Cond
17389        Cond false
17390        b
17391        Ket
17392        CBra 1
17393        Assert back
17394        Reverse
17395        b
17396        Ket
17397        Any*+
17398        Ket
17399        Ket
17400        End
17401------------------------------------------------------------------
17402
17403/(?(VERSION=10.4)b)((?<=b).*)/B
17404------------------------------------------------------------------
17405        Bra
17406        Cond
17407        Cond false
17408        b
17409        Ket
17410        CBra 1
17411        Assert back
17412        Reverse
17413        b
17414        Ket
17415        Any*+
17416        Ket
17417        Ket
17418        End
17419------------------------------------------------------------------
17420
17421/[aA]b[cC]/IB
17422------------------------------------------------------------------
17423        Bra
17424     /i a
17425        b
17426     /i c
17427        Ket
17428        End
17429------------------------------------------------------------------
17430Capture group count = 0
17431First code unit = 'a' (caseless)
17432Last code unit = 'c' (caseless)
17433Subject length lower bound = 3
17434
17435/[cc]abcd/I
17436Capture group count = 0
17437First code unit = 'c'
17438Last code unit = 'd'
17439Subject length lower bound = 5
17440
17441/[Cc]abcd/I
17442Capture group count = 0
17443First code unit = 'C' (caseless)
17444Last code unit = 'd'
17445Subject length lower bound = 5
17446
17447/[c]abcd/I
17448Capture group count = 0
17449First code unit = 'c'
17450Last code unit = 'd'
17451Subject length lower bound = 5
17452
17453/(?:c|C)abcd/I
17454Capture group count = 0
17455First code unit = 'C' (caseless)
17456Last code unit = 'd'
17457Subject length lower bound = 5
17458
17459/(a)?a/I
17460Capture group count = 1
17461Starting code units: a
17462Last code unit = 'a'
17463Subject length lower bound = 1
17464    manm
17465 0: a
17466
17467/^(?|(\*)(*napla:\S*_(\2?+.+))|(\w)(?=\S*_(\2?+\1)))+_\2$/
17468    *abc_12345abc
17469 0: *abc_12345abc
17470 1: c
17471 2: 12345abc
17472
17473/^(?|(\*)(*napla:\S*_(\3?+.+))|(\w)(?=\S*_((\2?+\1))))+_\2$/
17474    *abc_12345abc
17475 0: *abc_12345abc
17476 1: c
17477 2: 12345abc
17478 3: 12345abc
17479
17480/^((\1+)(?C)|\d)+133X$/
17481    111133X\=callout_capture
17482Callout 0: last capture = 2
17483 1: 1
17484 2: 111
17485--->111133X
17486    ^   ^       |
17487Callout 0: last capture = 2
17488 1: 3
17489 2: 3
17490--->111133X
17491    ^     ^     |
17492Callout 0: last capture = 2
17493 1: 1
17494 2: 11
17495--->111133X
17496    ^  ^        |
17497Callout 0: last capture = 2
17498 1: 3
17499 2: 3
17500--->111133X
17501    ^     ^     |
17502 0: 111133X
17503 1: 11
17504 2: 11
17505
17506/abc/replace=xyz,substitute_replacement_only
17507    123abc456
17508 1: xyz
17509
17510/a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z,substitute_replacement_only
17511    "abcde-abcde-"
17512 2: Xb+dZXb+dZ
17513
17514/a(b)c|xyz/g,replace=<$0>,substitute_callout,substitute_replacement_only
17515    abcdefabcpqr
17516 1(2) Old 0 3 "abc" New 0 5 "<abc>"
17517 2(2) Old 6 9 "abc" New 5 10 "<abc>"
17518 2: <abc><abc>
17519    abxyzpqrabcxyz
17520 1(1) Old 2 5 "xyz" New 0 5 "<xyz>"
17521 2(2) Old 8 11 "abc" New 5 10 "<abc>"
17522 3(1) Old 11 14 "xyz" New 10 15 "<xyz>"
17523 3: <xyz><abc><xyz>
17524    12abc34xyz99abc55\=substitute_stop=2
17525 1(2) Old 2 5 "abc" New 0 5 "<abc>"
17526 2(1) Old 7 10 "xyz" New 5 10 "<xyz> STOPPED"
17527 2: <abc>
17528    12abc34xyz99abc55\=substitute_skip=1
17529 1(2) Old 2 5 "abc" New 0 5 "<abc> SKIPPED"
17530 2(1) Old 7 10 "xyz" New 0 5 "<xyz>"
17531 3(2) Old 12 15 "abc" New 5 10 "<abc>"
17532 3: <xyz><abc>
17533    12abc34xyz99abc55\=substitute_skip=2
17534 1(2) Old 2 5 "abc" New 0 5 "<abc>"
17535 2(1) Old 7 10 "xyz" New 5 10 "<xyz> SKIPPED"
17536 3(2) Old 12 15 "abc" New 5 10 "<abc>"
17537 3: <abc><abc>
17538
17539/a(..)d/replace=>$1<,substitute_matched
17540    xyzabcdxyzabcdxyz
17541 1: xyz>bc<xyzabcdxyz
17542    xyzabcdxyzabcdxyz\=ovector=2
17543 1: xyz>bc<xyzabcdxyz
17544\= Expect error
17545    xyzabcdxyzabcdxyz\=ovector=1
17546Failed: error -54 at offset 3 in replacement: requested value is not available
17547
17548/a(..)d/g,replace=>$1<,substitute_matched
17549    xyzabcdxyzabcdxyz
17550 2: xyz>bc<xyz>bc<xyz
17551    xyzabcdxyzabcdxyz\=ovector=2
17552 2: xyz>bc<xyz>bc<xyz
17553\= Expect error
17554    xyzabcdxyzabcdxyz\=ovector=1
17555Failed: error -54 at offset 3 in replacement: requested value is not available
17556    xyzabcdxyzabcdxyz\=ovector=1,substitute_unset_empty
17557Failed: error -54 at offset 3 in replacement: requested value is not available
17558
17559/55|a(..)d/g,replace=>$1<,substitute_matched
17560    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
17561 3: xyz><>bc<xyz>bc<xyz
17562\= Expect error
17563    xyz55abcdxyzabcdxyz\=ovector=2
17564Failed: error -55 at offset 3 in replacement: requested value is not set
17565
17566/55|a(..)d/replace=>$1<,substitute_matched
17567    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
17568 1: xyz><abcdxyzabcdxyz
17569
17570/55|a(..)d/replace=>$1<
17571    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
17572 1: xyz><abcdxyzabcdxyz
17573
17574/55|a(..)d/g,replace=>$1<
17575    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
17576 3: xyz><>bc<xyz>bc<xyz
17577
17578# Expect non-fixed-length error
17579
17580"(?<=X(?(DEFINE)(.*))(?1))."
17581Failed: error 125 at offset 0: lookbehind assertion is not fixed length
17582
17583/\sxxx\s/tables=1
17584\= Expect no match
17585    AB\x{85}xxx\x{a0}XYZ
17586No match
17587
17588/\sxxx\s/tables=2
17589    AB\x{85}xxx\x{a0}XYZ
17590 0: \x85xxx\xa0
17591
17592/^\w+/tables=2
17593    École
17594 0: \xc3
17595
17596/^\w+/tables=3
17597** 'Tables = 3' is invalid: binary tables have not been loaded
17598    École
17599
17600#loadtables ./testbtables
17601
17602/^\w+/tables=3
17603    École
17604 0: \xc3
17605
17606/"(*MARK:>" 00 "<).."/hex,mark,no_start_optimize
17607    AB
17608 0: AB
17609MK: >\x00<
17610    A\=ph
17611Partial match, mark=>\x00<: A
17612\= Expect no match
17613    A
17614No match, mark = >\x00<
17615
17616/"(*MARK:>" 00 "<).(?C1)."/hex,mark,no_start_optimize
17617    AB
17618--->AB
17619  1 ^^     .
17620Latest Mark: >\x00<
17621 0: AB
17622MK: >\x00<
17623
17624/(?(VERSION=0.0/
17625Failed: error 179 at offset 14: syntax error or number too big in (?(VERSION condition
17626
17627# Perl has made \K in lookarounds an error. At the moment PCRE2 still accepts.
17628
17629/(?=a\Kb)ab/
17630    ab
17631 0: b
17632
17633/(?!a\Kb)ac/
17634    ac
17635 0: ac
17636
17637/^abc(?<=b\Kc)d/
17638    abcd
17639 0: cd
17640
17641/^abc(?<!b\Kq)d/
17642    abcd
17643 0: abcd
17644
17645# ---------
17646
17647# End of testinput2
17648Error -70: PCRE2_ERROR_BADDATA (unknown error number)
17649Error -62: bad serialized data
17650Error -2: partial match
17651Error -1: no match
17652Error 0: PCRE2_ERROR_BADDATA (unknown error number)
17653Error 100: no error
17654Error 101: \ at end of pattern
17655Error 191: PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is not allowed in UTF-16 mode
17656Error 200: PCRE2_ERROR_BADDATA (unknown error number)
17657