• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This set of tests is not Perl-compatible. It checks on special features
2# of PCRE2's API, error diagnostics, and the compiled code of some patterns.
3# It also checks the non-Perl syntax that PCRE2 supports (Python, .NET,
4# Oniguruma). There are also some tests where PCRE2 and Perl differ,
5# either because PCRE2 can't be compatible, or there is a possible Perl
6# bug.
7
8# NOTE: This is a non-UTF set of tests. When UTF support is needed, use
9# test 5.
10
11#forbid_utf
12#newline_default lf any anycrlf
13
14# Test binary zeroes in the pattern
15
16# /a\0B/ where 0 is a binary zero
17/61 5c 00 62/B,hex
18------------------------------------------------------------------
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/\g6666666666/
8378Failed: error 161 at offset 7: subpattern number is too big
8379
8380/[\g6666666666]/B
8381------------------------------------------------------------------
8382        Bra
8383        [6g]
8384        Ket
8385        End
8386------------------------------------------------------------------
8387
8388/(?1)\c[/
8389Failed: error 115 at offset 3: reference to non-existent subpattern
8390
8391/.+A/newline=crlf
8392\= Expect no match
8393    \r\nA
8394No match
8395
8396/\nA/newline=crlf
8397    \r\nA
8398 0: \x0aA
8399
8400/[\r\n]A/newline=crlf
8401    \r\nA
8402 0: \x0aA
8403
8404/(\r|\n)A/newline=crlf
8405    \r\nA
8406 0: \x0aA
8407 1: \x0a
8408
8409/a(*CR)b/
8410Failed: error 160 at offset 5: (*VERB) not recognized or malformed
8411
8412/(*CR)a.b/
8413    a\nb
8414 0: a\x0ab
8415\= Expect no match
8416    a\rb
8417No match
8418
8419/(*CR)a.b/newline=lf
8420    a\nb
8421 0: a\x0ab
8422\= Expect no match
8423    a\rb
8424No match
8425
8426/(*LF)a.b/newline=CRLF
8427    a\rb
8428 0: a\x0db
8429\= Expect no match
8430    a\nb
8431No match
8432
8433/(*CRLF)a.b/
8434    a\rb
8435 0: a\x0db
8436    a\nb
8437 0: a\x0ab
8438\= Expect no match
8439    a\r\nb
8440No match
8441
8442/(*ANYCRLF)a.b/newline=CR
8443\= Expect no match
8444    a\rb
8445No match
8446    a\nb
8447No match
8448    a\r\nb
8449No match
8450
8451/(*ANY)a.b/newline=cr
8452\= Expect no match
8453    a\rb
8454No match
8455    a\nb
8456No match
8457    a\r\nb
8458No match
8459    a\x85b
8460No match
8461
8462/(*ANY).*/g
8463    abc\r\ndef
8464 0: abc
8465 0:
8466 0: def
8467 0:
8468
8469/(*ANYCRLF).*/g
8470    abc\r\ndef
8471 0: abc
8472 0:
8473 0: def
8474 0:
8475
8476/(*CRLF).*/g
8477    abc\r\ndef
8478 0: abc
8479 0:
8480 0: def
8481 0:
8482
8483/(*NUL)^.*/
8484    a\nb\x00ccc
8485 0: a\x0ab
8486
8487/(*NUL)^.*/s
8488    a\nb\x00ccc
8489 0: a\x0ab\x00ccc
8490
8491/^x/m,newline=NUL
8492    ab\x00xy
8493 0: x
8494
8495/'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex
8496    x\nyz
8497 0: x\x0ay
8498
8499/(*NUL)^X\NY/
8500    X\nY
8501 0: X\x0aY
8502    X\rY
8503 0: X\x0dY
8504\= Expect no match
8505    X\x00Y
8506No match
8507
8508/a\Rb/I,bsr=anycrlf
8509Capture group count = 0
8510\R matches CR, LF, or CRLF
8511First code unit = 'a'
8512Last code unit = 'b'
8513Subject length lower bound = 3
8514    a\rb
8515 0: a\x0db
8516    a\nb
8517 0: a\x0ab
8518    a\r\nb
8519 0: a\x0d\x0ab
8520\= Expect no match
8521    a\x85b
8522No match
8523    a\x0bb
8524No match
8525
8526/a\Rb/I,bsr=unicode
8527Capture group count = 0
8528\R matches any Unicode newline
8529First code unit = 'a'
8530Last code unit = 'b'
8531Subject length lower bound = 3
8532    a\rb
8533 0: a\x0db
8534    a\nb
8535 0: a\x0ab
8536    a\r\nb
8537 0: a\x0d\x0ab
8538    a\x85b
8539 0: a\x85b
8540    a\x0bb
8541 0: a\x0bb
8542
8543/a\R?b/I,bsr=anycrlf
8544Capture group count = 0
8545\R matches CR, LF, or CRLF
8546First code unit = 'a'
8547Last code unit = 'b'
8548Subject length lower bound = 2
8549    a\rb
8550 0: a\x0db
8551    a\nb
8552 0: a\x0ab
8553    a\r\nb
8554 0: a\x0d\x0ab
8555\= Expect no match
8556    a\x85b
8557No match
8558    a\x0bb
8559No match
8560
8561/a\R?b/I,bsr=unicode
8562Capture group count = 0
8563\R matches any Unicode newline
8564First code unit = 'a'
8565Last code unit = 'b'
8566Subject length lower bound = 2
8567    a\rb
8568 0: a\x0db
8569    a\nb
8570 0: a\x0ab
8571    a\r\nb
8572 0: a\x0d\x0ab
8573    a\x85b
8574 0: a\x85b
8575    a\x0bb
8576 0: a\x0bb
8577
8578/a\R{2,4}b/I,bsr=anycrlf
8579Capture group count = 0
8580\R matches CR, LF, or CRLF
8581First code unit = 'a'
8582Last code unit = 'b'
8583Subject length lower bound = 4
8584    a\r\n\nb
8585 0: a\x0d\x0a\x0ab
8586    a\n\r\rb
8587 0: a\x0a\x0d\x0db
8588    a\r\n\r\n\r\n\r\nb
8589 0: a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0ab
8590\= Expect no match
8591    a\x85\x85b
8592No match
8593    a\x0b\x0bb
8594No match
8595
8596/a\R{2,4}b/I,bsr=unicode
8597Capture group count = 0
8598\R matches any Unicode newline
8599First code unit = 'a'
8600Last code unit = 'b'
8601Subject length lower bound = 4
8602    a\r\rb
8603 0: a\x0d\x0db
8604    a\n\n\nb
8605 0: a\x0a\x0a\x0ab
8606    a\r\n\n\r\rb
8607 0: a\x0d\x0a\x0a\x0d\x0db
8608    a\x85\x85b
8609 0: a\x85\x85b
8610    a\x0b\x0bb
8611 0: a\x0b\x0bb
8612\= Expect no match
8613    a\r\r\r\r\rb
8614No match
8615
8616/(*BSR_ANYCRLF)a\Rb/I
8617Capture group count = 0
8618\R matches CR, LF, or CRLF
8619First code unit = 'a'
8620Last code unit = 'b'
8621Subject length lower bound = 3
8622    a\nb
8623 0: a\x0ab
8624    a\rb
8625 0: a\x0db
8626
8627/(*BSR_UNICODE)a\Rb/I
8628Capture group count = 0
8629\R matches any Unicode newline
8630First code unit = 'a'
8631Last code unit = 'b'
8632Subject length lower bound = 3
8633    a\x85b
8634 0: a\x85b
8635
8636/(*BSR_ANYCRLF)(*CRLF)a\Rb/I
8637Capture group count = 0
8638\R matches CR, LF, or CRLF
8639Forced newline is CRLF
8640First code unit = 'a'
8641Last code unit = 'b'
8642Subject length lower bound = 3
8643    a\nb
8644 0: a\x0ab
8645    a\rb
8646 0: a\x0db
8647
8648/(*CRLF)(*BSR_UNICODE)a\Rb/I
8649Capture group count = 0
8650\R matches any Unicode newline
8651Forced newline is CRLF
8652First code unit = 'a'
8653Last code unit = 'b'
8654Subject length lower bound = 3
8655    a\x85b
8656 0: a\x85b
8657
8658/(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I
8659Capture group count = 0
8660\R matches CR, LF, or CRLF
8661Forced newline is CR
8662First code unit = 'a'
8663Last code unit = 'b'
8664Subject length lower bound = 2
8665
8666/(?<a>)(?&)/
8667Failed: error 162 at offset 9: subpattern name expected
8668
8669/(?<abc>)(?&a)/
8670Failed: error 115 at offset 11: reference to non-existent subpattern
8671
8672/(?<a>)(?&aaaaaaaaaaaaaaaaaaaaaaa)/
8673Failed: error 115 at offset 9: reference to non-existent subpattern
8674
8675/(?+-a)/
8676Failed: error 129 at offset 2: digit expected after (?+ or (?-
8677
8678/(?-+a)/
8679Failed: error 111 at offset 3: unrecognized character after (? or (?-
8680
8681/(?(-1))/
8682Failed: error 115 at offset 5: reference to non-existent subpattern
8683
8684/(?(+10))/
8685Failed: error 115 at offset 4: reference to non-existent subpattern
8686
8687/(?(10))/
8688Failed: error 115 at offset 3: reference to non-existent subpattern
8689
8690/(?(+2))()()/
8691
8692/(?(2))()()/
8693
8694/\k''/
8695Failed: error 162 at offset 3: subpattern name expected
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 169 at offset 2: \k is not followed by a braced, angle-bracketed, or quoted name
8705
8706/\kabc/
8707Failed: error 169 at offset 2: \k is not followed by a braced, angle-bracketed, or quoted name
8708
8709/(?P=)/
8710Failed: error 162 at offset 4: subpattern name expected
8711
8712/(?P>)/
8713Failed: error 162 at offset 4: subpattern name expected
8714
8715/[[:foo:]]/
8716Failed: error 130 at offset 3: unknown POSIX class name
8717
8718/[[:1234:]]/
8719Failed: error 130 at offset 3: unknown POSIX class name
8720
8721/[[:f\oo:]]/
8722Failed: error 130 at offset 3: unknown POSIX class name
8723
8724/[[: :]]/
8725Failed: error 130 at offset 3: unknown POSIX class name
8726
8727/[[:...:]]/
8728Failed: error 130 at offset 3: unknown POSIX class name
8729
8730/[[:l\ower:]]/
8731Failed: error 130 at offset 3: unknown POSIX class name
8732
8733/[[:abc\:]]/
8734Failed: error 130 at offset 3: unknown POSIX class name
8735
8736/[abc[:x\]pqr:]]/
8737Failed: error 130 at offset 6: unknown POSIX class name
8738
8739/[[:a\dz:]]/
8740Failed: error 130 at offset 3: unknown POSIX class name
8741
8742/(^(a|b\g<-1'c))/
8743Failed: error 157 at offset 8: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
8744
8745/^(?+1)(?<a>x|y){0}z/
8746    xzxx
8747 0: xz
8748    yzyy
8749 0: yz
8750\= Expect no match
8751    xxz
8752No match
8753
8754/(\3)(\1)(a)/
8755\= Expect no match
8756    cat
8757No match
8758
8759/(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
8760    cat
8761 0: a
8762 1:
8763 2:
8764 3: a
8765
8766/TA]/
8767    The ACTA] comes
8768 0: TA]
8769
8770/TA]/allow_empty_class,match_unset_backref,dupnames
8771    The ACTA] comes
8772 0: TA]
8773
8774/(?2)[]a()b](abc)/
8775Failed: error 115 at offset 3: reference to non-existent subpattern
8776    abcbabc
8777
8778/(?2)[^]a()b](abc)/
8779Failed: error 115 at offset 3: reference to non-existent subpattern
8780    abcbabc
8781
8782/(?1)[]a()b](abc)/
8783    abcbabc
8784 0: abcbabc
8785 1: abc
8786\= Expect no match
8787    abcXabc
8788No match
8789
8790/(?1)[^]a()b](abc)/
8791    abcXabc
8792 0: abcXabc
8793 1: abc
8794\= Expect no match
8795    abcbabc
8796No match
8797
8798/(?2)[]a()b](abc)(xyz)/
8799    xyzbabcxyz
8800 0: xyzbabcxyz
8801 1: abc
8802 2: xyz
8803
8804/(?&N)[]a(?<N>)](?<M>abc)/
8805Failed: error 115 at offset 3: reference to non-existent subpattern
8806   abc<abc
8807
8808/(?&N)[]a(?<N>)](abc)/
8809Failed: error 115 at offset 3: reference to non-existent subpattern
8810   abc<abc
8811
8812/a[]b/
8813Failed: error 106 at offset 4: missing terminating ] for character class
8814
8815/a[^]b/
8816Failed: error 106 at offset 5: missing terminating ] for character class
8817
8818/a[]b/allow_empty_class,match_unset_backref,dupnames
8819\= Expect no match
8820    ab
8821No match
8822
8823/a[]+b/allow_empty_class,match_unset_backref,dupnames
8824\= Expect no match
8825    ab
8826No match
8827
8828/a[]*+b/allow_empty_class,match_unset_backref,dupnames
8829\= Expect no match
8830    ab
8831No match
8832
8833/a[^]b/allow_empty_class,match_unset_backref,dupnames
8834    aXb
8835 0: aXb
8836    a\nb
8837 0: a\x0ab
8838\= Expect no match
8839    ab
8840No match
8841
8842/a[^]+b/allow_empty_class,match_unset_backref,dupnames
8843    aXb
8844 0: aXb
8845    a\nX\nXb
8846 0: a\x0aX\x0aXb
8847\= Expect no match
8848    ab
8849No match
8850
8851/a(?!)b/B
8852------------------------------------------------------------------
8853        Bra
8854        a
8855        *FAIL
8856        b
8857        Ket
8858        End
8859------------------------------------------------------------------
8860
8861/(?!)?a/B
8862------------------------------------------------------------------
8863        Bra
8864        Brazero
8865        Assert not
8866        Ket
8867        a
8868        Ket
8869        End
8870------------------------------------------------------------------
8871    ab
8872 0: a
8873
8874/a(*FAIL)+b/
8875Failed: error 109 at offset 8: quantifier does not follow a repeatable item
8876
8877/(abc|pqr|123){0}[xyz]/I
8878Capture group count = 1
8879Starting code units: x y z
8880Subject length lower bound = 1
8881
8882/(?(?=.*b)b|^)/I,auto_callout
8883Capture group count = 0
8884May match empty string
8885Options: auto_callout
8886Subject length lower bound = 0
8887   adc
8888--->adc
8889 +0 ^       (?
8890 +2 ^       (?=
8891 +5 ^       .*
8892 +7 ^  ^    b
8893 +7 ^ ^     b
8894 +7 ^^      b
8895 +7 ^       b
8896+11 ^       ^
8897+12 ^       )
8898+13 ^       End of pattern
8899 0:
8900   abc
8901--->abc
8902 +0 ^       (?
8903 +2 ^       (?=
8904 +5 ^       .*
8905 +7 ^  ^    b
8906 +7 ^ ^     b
8907 +7 ^^      b
8908 +8 ^ ^     )
8909 +9 ^       b
8910 +0  ^      (?
8911 +2  ^      (?=
8912 +5  ^      .*
8913 +7  ^ ^    b
8914 +7  ^^     b
8915 +7  ^      b
8916 +8  ^^     )
8917 +9  ^      b
8918+10  ^^     |
8919+13  ^^     End of pattern
8920 0: b
8921
8922/(?(?=b).*b|^d)/I
8923Capture group count = 0
8924Subject length lower bound = 1
8925
8926/(?(?=.*b).*b|^d)/I
8927Capture group count = 0
8928Subject length lower bound = 1
8929
8930/xyz/auto_callout
8931  xyz
8932--->xyz
8933 +0 ^       x
8934 +1 ^^      y
8935 +2 ^ ^     z
8936 +3 ^  ^    End of pattern
8937 0: xyz
8938  abcxyz
8939--->abcxyz
8940 +0    ^       x
8941 +1    ^^      y
8942 +2    ^ ^     z
8943 +3    ^  ^    End of pattern
8944 0: xyz
8945\= Expect no match
8946  abc
8947No match
8948  abcxypqr
8949No match
8950
8951/xyz/auto_callout,no_start_optimize
8952  abcxyz
8953--->abcxyz
8954 +0 ^          x
8955 +0  ^         x
8956 +0   ^        x
8957 +0    ^       x
8958 +1    ^^      y
8959 +2    ^ ^     z
8960 +3    ^  ^    End of pattern
8961 0: xyz
8962\= Expect no match
8963  abc
8964--->abc
8965 +0 ^       x
8966 +0  ^      x
8967 +0   ^     x
8968 +0    ^    x
8969No match
8970  abcxypqr
8971--->abcxypqr
8972 +0 ^            x
8973 +0  ^           x
8974 +0   ^          x
8975 +0    ^         x
8976 +1    ^^        y
8977 +2    ^ ^       z
8978 +0     ^        x
8979 +0      ^       x
8980 +0       ^      x
8981 +0        ^     x
8982 +0         ^    x
8983No match
8984
8985/(*NO_START_OPT)xyz/auto_callout
8986  abcxyz
8987--->abcxyz
8988+15 ^          x
8989+15  ^         x
8990+15   ^        x
8991+15    ^       x
8992+16    ^^      y
8993+17    ^ ^     z
8994+18    ^  ^    End of pattern
8995 0: xyz
8996
8997/(*NO_AUTO_POSSESS)a+b/B
8998------------------------------------------------------------------
8999        Bra
9000        a+
9001        b
9002        Ket
9003        End
9004------------------------------------------------------------------
9005
9006/xyz/auto_callout,no_start_optimize
9007  abcxyz
9008--->abcxyz
9009 +0 ^          x
9010 +0  ^         x
9011 +0   ^        x
9012 +0    ^       x
9013 +1    ^^      y
9014 +2    ^ ^     z
9015 +3    ^  ^    End of pattern
9016 0: xyz
9017
9018/^"((?(?=[a])[^"])|b)*"$/auto_callout
9019    "ab"
9020--->"ab"
9021 +0 ^        ^
9022 +1 ^        "
9023 +2 ^^       (
9024 +3 ^^       (?
9025 +5 ^^       (?=
9026 +8 ^^       [a]
9027+11 ^ ^      )
9028+12 ^^       [^"]
9029+16 ^ ^      )
9030+17 ^ ^      |
9031 +3 ^ ^      (?
9032 +5 ^ ^      (?=
9033 +8 ^ ^      [a]
9034+17 ^ ^      |
9035+21 ^ ^      "
9036+18 ^ ^      b
9037+19 ^  ^     )*
9038 +3 ^  ^     (?
9039 +5 ^  ^     (?=
9040 +8 ^  ^     [a]
9041+17 ^  ^     |
9042+21 ^  ^     "
9043+22 ^   ^    $
9044+23 ^   ^    End of pattern
9045 0: "ab"
9046 1:
9047
9048/^"((?(?=[a])[^"])|b)*"$/
9049    "ab"
9050 0: "ab"
9051 1:
9052
9053/^X(?5)(a)(?|(b)|(q))(c)(d)Y/
9054Failed: error 115 at offset 5: reference to non-existent subpattern
9055    XYabcdY
9056
9057/^X(?&N)(a)(?|(b)|(q))(c)(d)(?<N>Y)/
9058    XYabcdY
9059 0: XYabcdY
9060 1: a
9061 2: b
9062 3: c
9063 4: d
9064 5: Y
9065
9066/Xa{2,4}b/
9067    X\=ps
9068Partial match: X
9069    Xa\=ps
9070Partial match: Xa
9071    Xaa\=ps
9072Partial match: Xaa
9073    Xaaa\=ps
9074Partial match: Xaaa
9075    Xaaaa\=ps
9076Partial match: Xaaaa
9077
9078/Xa{2,4}?b/
9079    X\=ps
9080Partial match: X
9081    Xa\=ps
9082Partial match: Xa
9083    Xaa\=ps
9084Partial match: Xaa
9085    Xaaa\=ps
9086Partial match: Xaaa
9087    Xaaaa\=ps
9088Partial match: Xaaaa
9089
9090/Xa{2,4}+b/
9091    X\=ps
9092Partial match: X
9093    Xa\=ps
9094Partial match: Xa
9095    Xaa\=ps
9096Partial match: Xaa
9097    Xaaa\=ps
9098Partial match: Xaaa
9099    Xaaaa\=ps
9100Partial match: Xaaaa
9101
9102/X\d{2,4}b/
9103    X\=ps
9104Partial match: X
9105    X3\=ps
9106Partial match: X3
9107    X33\=ps
9108Partial match: X33
9109    X333\=ps
9110Partial match: X333
9111    X3333\=ps
9112Partial match: X3333
9113
9114/X\d{2,4}?b/
9115    X\=ps
9116Partial match: X
9117    X3\=ps
9118Partial match: X3
9119    X33\=ps
9120Partial match: X33
9121    X333\=ps
9122Partial match: X333
9123    X3333\=ps
9124Partial match: X3333
9125
9126/X\d{2,4}+b/
9127    X\=ps
9128Partial match: X
9129    X3\=ps
9130Partial match: X3
9131    X33\=ps
9132Partial match: X33
9133    X333\=ps
9134Partial match: X333
9135    X3333\=ps
9136Partial match: X3333
9137
9138/X\D{2,4}b/
9139    X\=ps
9140Partial match: X
9141    Xa\=ps
9142Partial match: Xa
9143    Xaa\=ps
9144Partial match: Xaa
9145    Xaaa\=ps
9146Partial match: Xaaa
9147    Xaaaa\=ps
9148Partial match: Xaaaa
9149
9150/X\D{2,4}?b/
9151    X\=ps
9152Partial match: X
9153    Xa\=ps
9154Partial match: Xa
9155    Xaa\=ps
9156Partial match: Xaa
9157    Xaaa\=ps
9158Partial match: Xaaa
9159    Xaaaa\=ps
9160Partial match: Xaaaa
9161
9162/X\D{2,4}+b/
9163    X\=ps
9164Partial match: X
9165    Xa\=ps
9166Partial match: Xa
9167    Xaa\=ps
9168Partial match: Xaa
9169    Xaaa\=ps
9170Partial match: Xaaa
9171    Xaaaa\=ps
9172Partial match: Xaaaa
9173
9174/X[abc]{2,4}b/
9175    X\=ps
9176Partial match: X
9177    Xa\=ps
9178Partial match: Xa
9179    Xaa\=ps
9180Partial match: Xaa
9181    Xaaa\=ps
9182Partial match: Xaaa
9183    Xaaaa\=ps
9184Partial match: Xaaaa
9185
9186/X[abc]{2,4}?b/
9187    X\=ps
9188Partial match: X
9189    Xa\=ps
9190Partial match: Xa
9191    Xaa\=ps
9192Partial match: Xaa
9193    Xaaa\=ps
9194Partial match: Xaaa
9195    Xaaaa\=ps
9196Partial match: Xaaaa
9197
9198/X[abc]{2,4}+b/
9199    X\=ps
9200Partial match: X
9201    Xa\=ps
9202Partial match: Xa
9203    Xaa\=ps
9204Partial match: Xaa
9205    Xaaa\=ps
9206Partial match: Xaaa
9207    Xaaaa\=ps
9208Partial match: Xaaaa
9209
9210/X[^a]{2,4}b/
9211    X\=ps
9212Partial match: X
9213    Xz\=ps
9214Partial match: Xz
9215    Xzz\=ps
9216Partial match: Xzz
9217    Xzzz\=ps
9218Partial match: Xzzz
9219    Xzzzz\=ps
9220Partial match: Xzzzz
9221
9222/X[^a]{2,4}?b/
9223    X\=ps
9224Partial match: X
9225    Xz\=ps
9226Partial match: Xz
9227    Xzz\=ps
9228Partial match: Xzz
9229    Xzzz\=ps
9230Partial match: Xzzz
9231    Xzzzz\=ps
9232Partial match: Xzzzz
9233
9234/X[^a]{2,4}+b/
9235    X\=ps
9236Partial match: X
9237    Xz\=ps
9238Partial match: Xz
9239    Xzz\=ps
9240Partial match: Xzz
9241    Xzzz\=ps
9242Partial match: Xzzz
9243    Xzzzz\=ps
9244Partial match: Xzzzz
9245
9246/(Y)X\1{2,4}b/
9247    YX\=ps
9248Partial match: YX
9249    YXY\=ps
9250Partial match: YXY
9251    YXYY\=ps
9252Partial match: YXYY
9253    YXYYY\=ps
9254Partial match: YXYYY
9255    YXYYYY\=ps
9256Partial match: YXYYYY
9257
9258/(Y)X\1{2,4}?b/
9259    YX\=ps
9260Partial match: YX
9261    YXY\=ps
9262Partial match: YXY
9263    YXYY\=ps
9264Partial match: YXYY
9265    YXYYY\=ps
9266Partial match: YXYYY
9267    YXYYYY\=ps
9268Partial match: YXYYYY
9269
9270/(Y)X\1{2,4}+b/
9271    YX\=ps
9272Partial match: YX
9273    YXY\=ps
9274Partial match: YXY
9275    YXYY\=ps
9276Partial match: YXYY
9277    YXYYY\=ps
9278Partial match: YXYYY
9279    YXYYYY\=ps
9280Partial match: YXYYYY
9281
9282/\++\KZ|\d+X|9+Y/startchar
9283    ++++123999\=ps
9284Partial match: 123999
9285    ++++123999Y\=ps
9286 0: 999Y
9287    ++++Z1234\=ps
9288 0: ++++Z
9289    ^^^^
9290
9291/Z(*F)/
9292\= Expect no match
9293    Z\=ps
9294No match
9295    ZA\=ps
9296No match
9297
9298/Z(?!)/
9299\= Expect no match
9300    Z\=ps
9301No match
9302    ZA\=ps
9303No match
9304
9305/dog(sbody)?/
9306    dogs\=ps
9307 0: dog
9308    dogs\=ph
9309Partial match: dogs
9310
9311/dog(sbody)??/
9312    dogs\=ps
9313 0: dog
9314    dogs\=ph
9315 0: dog
9316
9317/dog|dogsbody/
9318    dogs\=ps
9319 0: dog
9320    dogs\=ph
9321 0: dog
9322
9323/dogsbody|dog/
9324    dogs\=ps
9325 0: dog
9326    dogs\=ph
9327Partial match: dogs
9328
9329/\bthe cat\b/
9330    the cat\=ps
9331 0: the cat
9332    the cat\=ph
9333Partial match: the cat
9334
9335/abc/
9336   abc\=ps
9337 0: abc
9338   abc\=ph
9339 0: abc
9340
9341/abc\K123/startchar
9342    xyzabc123pqr
9343 0: abc123
9344    ^^^
9345    xyzabc12\=ps
9346Partial match: abc12
9347    xyzabc12\=ph
9348Partial match: abc12
9349
9350/(?<=abc)123/
9351    xyzabc123pqr
9352 0: 123
9353    xyzabc12\=ps
9354Partial match: 12
9355    xyzabc12\=ph
9356Partial match: 12
9357
9358/\babc\b/
9359    +++abc+++
9360 0: abc
9361    +++ab\=ps
9362Partial match: ab
9363    +++ab\=ph
9364Partial match: ab
9365
9366/(?&word)(?&element)(?(DEFINE)(?<element><[^m][^>]>[^<])(?<word>\w*+))/B
9367------------------------------------------------------------------
9368        Bra
9369        Recurse
9370        Recurse
9371        Cond
9372        Cond false
9373        CBra 1
9374        <
9375        [^m]
9376        [^>]
9377        >
9378        [^<]
9379        Ket
9380        CBra 2
9381        \w*+
9382        Ket
9383        Ket
9384        Ket
9385        End
9386------------------------------------------------------------------
9387
9388/(?&word)(?&element)(?(DEFINE)(?<element><[^\d][^>]>[^<])(?<word>\w*+))/B
9389------------------------------------------------------------------
9390        Bra
9391        Recurse
9392        Recurse
9393        Cond
9394        Cond false
9395        CBra 1
9396        <
9397        [\x00-/:-\xff] (neg)
9398        [^>]
9399        >
9400        [^<]
9401        Ket
9402        CBra 2
9403        \w*+
9404        Ket
9405        Ket
9406        Ket
9407        End
9408------------------------------------------------------------------
9409
9410/(ab)(x(y)z(cd(*ACCEPT)))pq/B
9411------------------------------------------------------------------
9412        Bra
9413        CBra 1
9414        ab
9415        Ket
9416        CBra 2
9417        x
9418        CBra 3
9419        y
9420        Ket
9421        z
9422        CBra 4
9423        cd
9424        Close 4
9425        Close 2
9426        *ACCEPT
9427        Ket
9428        Ket
9429        pq
9430        Ket
9431        End
9432------------------------------------------------------------------
9433
9434/abc\K/aftertext,startchar
9435    abcdef
9436 0: abc
9437    ^^^
9438 0+ def
9439    abcdef\=notempty_atstart
9440 0: abc
9441    ^^^
9442 0+ def
9443    xyzabcdef\=notempty_atstart
9444 0: abc
9445    ^^^
9446 0+ def
9447\= Expect no match
9448    abcdef\=notempty
9449No match
9450    xyzabcdef\=notempty
9451No match
9452
9453/^(?:(?=abc)|abc\K)/aftertext,startchar
9454    abcdef
9455 0:
9456 0+ abcdef
9457    abcdef\=notempty_atstart
9458 0: abc
9459    ^^^
9460 0+ def
9461\= Expect no match
9462    abcdef\=notempty
9463No match
9464
9465/a?b?/aftertext
9466    xyz
9467 0:
9468 0+ xyz
9469    xyzabc
9470 0:
9471 0+ xyzabc
9472    xyzabc\=notempty
9473 0: ab
9474 0+ c
9475    xyzabc\=notempty_atstart
9476 0:
9477 0+ yzabc
9478    xyz\=notempty_atstart
9479 0:
9480 0+ yz
9481\= Expect no match
9482    xyz\=notempty
9483No match
9484
9485/^a?b?/aftertext
9486    xyz
9487 0:
9488 0+ xyz
9489    xyzabc
9490 0:
9491 0+ xyzabc
9492\= Expect no match
9493    xyzabc\=notempty
9494No match
9495    xyzabc\=notempty_atstart
9496No match
9497    xyz\=notempty_atstart
9498No match
9499    xyz\=notempty
9500No match
9501
9502/^(?<name>a|b\g<name>c)/
9503    aaaa
9504 0: a
9505 1: a
9506    bacxxx
9507 0: bac
9508 1: bac
9509    bbaccxxx
9510 0: bbacc
9511 1: bbacc
9512    bbbacccxx
9513 0: bbbaccc
9514 1: bbbaccc
9515
9516/^(?<name>a|b\g'name'c)/
9517    aaaa
9518 0: a
9519 1: a
9520    bacxxx
9521 0: bac
9522 1: bac
9523    bbaccxxx
9524 0: bbacc
9525 1: bbacc
9526    bbbacccxx
9527 0: bbbaccc
9528 1: bbbaccc
9529
9530/^(a|b\g<1>c)/
9531    aaaa
9532 0: a
9533 1: a
9534    bacxxx
9535 0: bac
9536 1: bac
9537    bbaccxxx
9538 0: bbacc
9539 1: bbacc
9540    bbbacccxx
9541 0: bbbaccc
9542 1: bbbaccc
9543
9544/^(a|b\g'1'c)/
9545    aaaa
9546 0: a
9547 1: a
9548    bacxxx
9549 0: bac
9550 1: bac
9551    bbaccxxx
9552 0: bbacc
9553 1: bbacc
9554    bbbacccxx
9555 0: bbbaccc
9556 1: bbbaccc
9557
9558/^(a|b\g'-1'c)/
9559    aaaa
9560 0: a
9561 1: a
9562    bacxxx
9563 0: bac
9564 1: bac
9565    bbaccxxx
9566 0: bbacc
9567 1: bbacc
9568    bbbacccxx
9569 0: bbbaccc
9570 1: bbbaccc
9571
9572/(^(a|b\g<-1>c))/
9573    aaaa
9574 0: a
9575 1: a
9576 2: a
9577    bacxxx
9578 0: bac
9579 1: bac
9580 2: bac
9581    bbaccxxx
9582 0: bbacc
9583 1: bbacc
9584 2: bbacc
9585    bbbacccxx
9586 0: bbbaccc
9587 1: bbbaccc
9588 2: bbbaccc
9589
9590/(?-i:\g<name>)(?i:(?<name>a))/
9591    XaaX
9592 0: aa
9593 1: a
9594    XAAX
9595 0: AA
9596 1: A
9597
9598/(?i:\g<name>)(?-i:(?<name>a))/
9599    XaaX
9600 0: aa
9601 1: a
9602\= Expect no match
9603    XAAX
9604No match
9605
9606/(?-i:\g<+1>)(?i:(a))/
9607    XaaX
9608 0: aa
9609 1: a
9610    XAAX
9611 0: AA
9612 1: A
9613
9614/(?=(?<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>\})\}))\{/
9615
9616/(?<n>a|b|c)\g<n>*/
9617   abc
9618 0: abc
9619 1: a
9620   accccbbb
9621 0: accccbbb
9622 1: a
9623
9624/^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)/
9625    XYabcdY
9626 0: XYabcdY
9627 1: a
9628 2: b
9629 3: <unset>
9630 4: <unset>
9631 5: c
9632 6: d
9633 7: Y
9634
9635/(?<=b(?1)|zzz)(a)/
9636    xbaax
9637 0: a
9638 1: a
9639    xzzzax
9640 0: a
9641 1: a
9642
9643/(a)(?<=b\1)/
9644
9645/(a)(?<=b+(?1))/
9646Failed: error 125 at offset 3: lookbehind assertion is not fixed length
9647
9648/(a+)(?<=b(?1))/
9649Failed: error 125 at offset 4: lookbehind assertion is not fixed length
9650
9651/(a(?<=b(?1)))/
9652Failed: error 125 at offset 2: lookbehind assertion is not fixed length
9653
9654/(?<=b(?1))xyz/
9655Failed: error 115 at offset 8: reference to non-existent subpattern
9656
9657/(?<=b(?1))xyz(b+)pqrstuvew/
9658Failed: error 125 at offset 0: lookbehind assertion is not fixed length
9659
9660/(a|bc)\1/I
9661Capture group count = 1
9662Max back reference = 1
9663Starting code units: a b
9664Subject length lower bound = 2
9665
9666/(a|bc)\1{2,3}/I
9667Capture group count = 1
9668Max back reference = 1
9669Starting code units: a b
9670Subject length lower bound = 3
9671
9672/(a|bc)(?1)/I
9673Capture group count = 1
9674Starting code units: a b
9675Subject length lower bound = 2
9676
9677/(a|b\1)(a|b\1)/I
9678Capture group count = 2
9679Max back reference = 1
9680Starting code units: a b
9681Subject length lower bound = 2
9682
9683/(a|b\1){2}/I
9684Capture group count = 1
9685Max back reference = 1
9686Starting code units: a b
9687Subject length lower bound = 2
9688
9689/(a|bbbb\1)(a|bbbb\1)/I
9690Capture group count = 2
9691Max back reference = 1
9692Starting code units: a b
9693Subject length lower bound = 2
9694
9695/(a|bbbb\1){2}/I
9696Capture group count = 1
9697Max back reference = 1
9698Starting code units: a b
9699Subject length lower bound = 2
9700
9701/^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
9702Capture group count = 1
9703Compile options: <none>
9704Overall options: anchored
9705First code unit = 'F'
9706Last code unit = ':'
9707Subject length lower bound = 22
9708
9709/<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
9710Capture group count = 11
9711Options: caseless dotall
9712First code unit = '<'
9713Last code unit = '>'
9714Subject length lower bound = 47
9715
9716"(?>.*/)foo"I
9717Capture group count = 0
9718Last code unit = 'o'
9719Subject length lower bound = 4
9720
9721/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /Ix
9722Capture group count = 0
9723Options: extended
9724Last code unit = '-'
9725Subject length lower bound = 8
9726
9727/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/Ii
9728Capture group count = 1
9729Options: caseless
9730Starting code units: A B C a b c
9731Subject length lower bound = 1
9732
9733/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/I
9734Capture group count = 0
9735Starting code units: c d
9736Last code unit = 'b'
9737Subject length lower bound = 41
9738
9739/<a[\s]+href[\s]*=[\s]*          # find <a href=
9740 ([\"\'])?                       # find single or double quote
9741 (?(1) (.*?)\1 | ([^\s]+))       # if quote found, match up to next matching
9742                                 # quote, otherwise match up to next space
9743/Iisx
9744Capture group count = 3
9745Max back reference = 1
9746Options: caseless dotall extended
9747First code unit = '<'
9748Last code unit = '='
9749Subject length lower bound = 9
9750
9751/^(?!:)                       # colon disallowed at start
9752  (?:                         # start of item
9753    (?: [0-9a-f]{1,4} |       # 1-4 hex digits or
9754    (?(1)0 | () ) )           # if null previously matched, fail; else null
9755    :                         # followed by colon
9756  ){1,7}                      # end item; 1-7 of them required
9757  [0-9a-f]{1,4} $             # final hex number at end of string
9758  (?(1)|.)                    # check that there was an empty component
9759  /Iix
9760Capture group count = 1
9761Max back reference = 1
9762Compile options: caseless extended
9763Overall options: anchored caseless extended
9764Last code unit = ':'
9765Subject length lower bound = 2
9766
9767/(?|(?<a>A)|(?<a>B))/I
9768Capture group count = 1
9769Named capture groups:
9770  a   1
9771Starting code units: A B
9772Subject length lower bound = 1
9773    AB\=copy=a
9774 0: A
9775 1: A
9776  C A (1) a (group 1)
9777    BA\=copy=a
9778 0: B
9779 1: B
9780  C B (1) a (group 1)
9781
9782/(?|(?<a>A)|(?<b>B))/
9783Failed: error 165 at offset 16: different names for subpatterns of the same number are not allowed
9784
9785/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |
9786    b(?<quote> (?<apostrophe>')|(?<realquote>")) )
9787    (?('quote')[a-z]+|[0-9]+)/Ix,dupnames
9788Capture group count = 6
9789Max back reference = 4
9790Named capture groups:
9791  apostrophe   2
9792  apostrophe   5
9793  quote        1
9794  quote        4
9795  realquote    3
9796  realquote    6
9797Options: dupnames extended
9798Starting code units: a b
9799Subject length lower bound = 3
9800    a"aaaaa
9801 0: a"aaaaa
9802 1: "
9803 2: <unset>
9804 3: "
9805    b"aaaaa
9806 0: b"aaaaa
9807 1: <unset>
9808 2: <unset>
9809 3: <unset>
9810 4: "
9811 5: <unset>
9812 6: "
9813\= Expect no match
9814    b"11111
9815No match
9816    a"11111
9817No match
9818
9819/^(?|(a)(b)(c)(?<D>d)|(?<D>e)) (?('D')X|Y)/IBx,dupnames
9820------------------------------------------------------------------
9821        Bra
9822        ^
9823        Bra
9824        CBra 1
9825        a
9826        Ket
9827        CBra 2
9828        b
9829        Ket
9830        CBra 3
9831        c
9832        Ket
9833        CBra 4
9834        d
9835        Ket
9836        Alt
9837        CBra 1
9838        e
9839        Ket
9840        Ket
9841        Cond
9842        Cond ref <D>2
9843        X
9844        Alt
9845        Y
9846        Ket
9847        Ket
9848        End
9849------------------------------------------------------------------
9850Capture group count = 4
9851Max back reference = 4
9852Named capture groups:
9853  D   4
9854  D   1
9855Compile options: dupnames extended
9856Overall options: anchored dupnames extended
9857Starting code units: a e
9858Subject length lower bound = 2
9859    abcdX
9860 0: abcdX
9861 1: a
9862 2: b
9863 3: c
9864 4: d
9865    eX
9866 0: eX
9867 1: e
9868\= Expect no match
9869    abcdY
9870No match
9871    ey
9872No match
9873
9874/(?<A>a) (b)(c)  (?<A>d  (?(R&A)$ | (?4)) )/IBx,dupnames
9875------------------------------------------------------------------
9876        Bra
9877        CBra 1
9878        a
9879        Ket
9880        CBra 2
9881        b
9882        Ket
9883        CBra 3
9884        c
9885        Ket
9886        CBra 4
9887        d
9888        Cond
9889        Cond recurse <A>2
9890        $
9891        Alt
9892        Recurse
9893        Ket
9894        Ket
9895        Ket
9896        End
9897------------------------------------------------------------------
9898Capture group count = 4
9899Max back reference = 4
9900Named capture groups:
9901  A   1
9902  A   4
9903Options: dupnames extended
9904First code unit = 'a'
9905Last code unit = 'd'
9906Subject length lower bound = 4
9907    abcdd
9908 0: abcdd
9909 1: a
9910 2: b
9911 3: c
9912 4: dd
9913\= Expect no match
9914    abcdde
9915No match
9916
9917/abcd*/
9918    xxxxabcd\=ps
9919 0: abcd
9920    xxxxabcd\=ph
9921Partial match: abcd
9922
9923/abcd*/i
9924    xxxxabcd\=ps
9925 0: abcd
9926    xxxxabcd\=ph
9927Partial match: abcd
9928    XXXXABCD\=ps
9929 0: ABCD
9930    XXXXABCD\=ph
9931Partial match: ABCD
9932
9933/abc\d*/
9934    xxxxabc1\=ps
9935 0: abc1
9936    xxxxabc1\=ph
9937Partial match: abc1
9938
9939/(a)bc\1*/
9940    xxxxabca\=ps
9941 0: abca
9942 1: a
9943    xxxxabca\=ph
9944Partial match: abca
9945
9946/abc[de]*/
9947    xxxxabcde\=ps
9948 0: abcde
9949    xxxxabcde\=ph
9950Partial match: abcde
9951
9952/(\3)(\1)(a)/allow_empty_class,match_unset_backref,dupnames
9953    cat
9954 0: a
9955 1:
9956 2:
9957 3: a
9958
9959/(\3)(\1)(a)/I,allow_empty_class,match_unset_backref,dupnames
9960Capture group count = 3
9961Max back reference = 3
9962Options: allow_empty_class dupnames match_unset_backref
9963Last code unit = 'a'
9964Subject length lower bound = 1
9965    cat
9966 0: a
9967 1:
9968 2:
9969 3: a
9970
9971/(\3)(\1)(a)/I
9972Capture group count = 3
9973Max back reference = 3
9974Last code unit = 'a'
9975Subject length lower bound = 3
9976\= Expect no match
9977    cat
9978No match
9979
9980/i(?(DEFINE)(?<s>a))/I
9981Capture group count = 1
9982Named capture groups:
9983  s   1
9984First code unit = 'i'
9985Subject length lower bound = 1
9986    i
9987 0: i
9988
9989/()i(?(1)a)/I
9990Capture group count = 1
9991Max back reference = 1
9992First code unit = 'i'
9993Subject length lower bound = 1
9994    ia
9995 0: ia
9996 1:
9997
9998/(?i)a(?-i)b|c/B
9999------------------------------------------------------------------
10000        Bra
10001     /i a
10002        b
10003        Alt
10004        c
10005        Ket
10006        End
10007------------------------------------------------------------------
10008    XabX
10009 0: ab
10010    XAbX
10011 0: Ab
10012    CcC
10013 0: c
10014\= Expect no match
10015    XABX
10016No match
10017
10018/(?i)a(?s)b|c/B
10019------------------------------------------------------------------
10020        Bra
10021     /i ab
10022        Alt
10023     /i c
10024        Ket
10025        End
10026------------------------------------------------------------------
10027
10028/(?i)a(?s-i)b|c/B
10029------------------------------------------------------------------
10030        Bra
10031     /i a
10032        b
10033        Alt
10034        c
10035        Ket
10036        End
10037------------------------------------------------------------------
10038
10039/^(ab(c\1)d|x){2}$/B
10040------------------------------------------------------------------
10041        Bra
10042        ^
10043        CBra 1
10044        ab
10045        CBra 2
10046        c
10047        \1
10048        Ket
10049        d
10050        Alt
10051        x
10052        Ket
10053        CBra 1
10054        ab
10055        CBra 2
10056        c
10057        \1
10058        Ket
10059        d
10060        Alt
10061        x
10062        Ket
10063        $
10064        Ket
10065        End
10066------------------------------------------------------------------
10067    xabcxd
10068 0: xabcxd
10069 1: abcxd
10070 2: cx
10071
10072/^(?&t)*+(?(DEFINE)(?<t>.))$/B
10073------------------------------------------------------------------
10074        Bra
10075        ^
10076        Braposzero
10077        SBraPos
10078        Recurse
10079        KetRpos
10080        Cond
10081        Cond false
10082        CBra 1
10083        Any
10084        Ket
10085        Ket
10086        $
10087        Ket
10088        End
10089------------------------------------------------------------------
10090
10091/^(?&t)*(?(DEFINE)(?<t>.))$/B
10092------------------------------------------------------------------
10093        Bra
10094        ^
10095        Brazero
10096        SBra
10097        Recurse
10098        KetRmax
10099        Cond
10100        Cond false
10101        CBra 1
10102        Any
10103        Ket
10104        Ket
10105        $
10106        Ket
10107        End
10108------------------------------------------------------------------
10109
10110# This one is here because Perl gives the match as "b" rather than "ab". I
10111# believe this to be a Perl bug.
10112
10113/(?>a\Kb)z|(ab)/
10114    ab\=startchar
10115 0: ab
10116 1: ab
10117
10118/(?P<L1>(?P<L2>0|)|(?P>L2)(?P>L1))/
10119    abcd
10120 0:
10121 1:
10122 2:
10123    0abc
10124 0: 0
10125 1: 0
10126 2: 0
10127
10128/abc(*MARK:)pqr/
10129Failed: error 166 at offset 10: (*MARK) must have an argument
10130
10131/abc(*:)pqr/
10132Failed: error 166 at offset 6: (*MARK) must have an argument
10133
10134/(*COMMIT:X)/B
10135------------------------------------------------------------------
10136        Bra
10137        *COMMIT X
10138        Ket
10139        End
10140------------------------------------------------------------------
10141
10142# This should, and does, fail. In Perl, it does not, which I think is a
10143# bug because replacing the B in the pattern by (B|D) does make it fail.
10144# Turning off Perl's optimization by inserting (??{""}) also makes it fail.
10145
10146/A(*COMMIT)B/aftertext,mark
10147\= Expect no match
10148    ACABX
10149No match
10150
10151# These should be different, but in Perl they are not, which I think
10152# is a bug in Perl.
10153
10154/A(*THEN)B|A(*THEN)C/mark
10155    AC
10156 0: AC
10157
10158/A(*PRUNE)B|A(*PRUNE)C/mark
10159\= Expect no match
10160    AC
10161No match
10162
10163# Mark names can be duplicated. Perl doesn't give a mark for this one,
10164# though PCRE2 does.
10165
10166/^A(*:A)B|^X(*:A)Y/mark
10167\= Expect no match
10168    XAQQ
10169No match, mark = A
10170
10171# COMMIT at the start of a pattern should be the same as an anchor. Perl
10172# optimizations defeat this. So does the PCRE2 optimization unless we disable
10173# it.
10174
10175/(*COMMIT)ABC/
10176    ABCDEFG
10177 0: ABC
10178
10179/(*COMMIT)ABC/no_start_optimize
10180\= Expect no match
10181    DEFGABC
10182No match
10183
10184/^(ab (c+(*THEN)cd) | xyz)/x
10185\= Expect no match
10186    abcccd
10187No match
10188
10189/^(ab (c+(*PRUNE)cd) | xyz)/x
10190\= Expect no match
10191    abcccd
10192No match
10193
10194/^(ab (c+(*FAIL)cd) | xyz)/x
10195\= Expect no match
10196    abcccd
10197No match
10198
10199# Perl gets some of these wrong
10200
10201/(?>.(*ACCEPT))*?5/
10202    abcde
10203 0: a
10204
10205/(.(*ACCEPT))*?5/
10206    abcde
10207 0: a
10208 1: a
10209
10210/(.(*ACCEPT))5/
10211    abcde
10212 0: a
10213 1: a
10214
10215/(.(*ACCEPT))*5/
10216    abcde
10217 0: a
10218 1: a
10219
10220/A\NB./B
10221------------------------------------------------------------------
10222        Bra
10223        A
10224        Any
10225        B
10226        Any
10227        Ket
10228        End
10229------------------------------------------------------------------
10230    ACBD
10231 0: ACBD
10232\= Expect no match
10233    A\nB
10234No match
10235    ACB\n
10236No match
10237
10238/A\NB./Bs
10239------------------------------------------------------------------
10240        Bra
10241        A
10242        Any
10243        B
10244        AllAny
10245        Ket
10246        End
10247------------------------------------------------------------------
10248    ACBD
10249 0: ACBD
10250    ACB\n
10251 0: ACB\x0a
10252\= Expect no match
10253    A\nB
10254No match
10255
10256/A\NB/newline=crlf
10257    A\nB
10258 0: A\x0aB
10259    A\rB
10260 0: A\x0dB
10261\= Expect no match
10262    A\r\nB
10263No match
10264
10265/\R+b/B
10266------------------------------------------------------------------
10267        Bra
10268        \R++
10269        b
10270        Ket
10271        End
10272------------------------------------------------------------------
10273
10274/\R+\n/B
10275------------------------------------------------------------------
10276        Bra
10277        \R+
10278        \x0a
10279        Ket
10280        End
10281------------------------------------------------------------------
10282
10283/\R+\d/B
10284------------------------------------------------------------------
10285        Bra
10286        \R++
10287        \d
10288        Ket
10289        End
10290------------------------------------------------------------------
10291
10292/\d*\R/B
10293------------------------------------------------------------------
10294        Bra
10295        \d*+
10296        \R
10297        Ket
10298        End
10299------------------------------------------------------------------
10300
10301/\s*\R/B
10302------------------------------------------------------------------
10303        Bra
10304        \s*
10305        \R
10306        Ket
10307        End
10308------------------------------------------------------------------
10309    \x20\x0a
10310 0:  \x0a
10311    \x20\x0d
10312 0:  \x0d
10313    \x20\x0d\x0a
10314 0:  \x0d\x0a
10315
10316/\S*\R/B
10317------------------------------------------------------------------
10318        Bra
10319        \S*+
10320        \R
10321        Ket
10322        End
10323------------------------------------------------------------------
10324    a\x0a
10325 0: a\x0a
10326
10327/X\h*\R/B
10328------------------------------------------------------------------
10329        Bra
10330        X
10331        \h*+
10332        \R
10333        Ket
10334        End
10335------------------------------------------------------------------
10336    X\x20\x0a
10337 0: X \x0a
10338
10339/X\H*\R/B
10340------------------------------------------------------------------
10341        Bra
10342        X
10343        \H*
10344        \R
10345        Ket
10346        End
10347------------------------------------------------------------------
10348    X\x0d\x0a
10349 0: X\x0d\x0a
10350
10351/X\H+\R/B
10352------------------------------------------------------------------
10353        Bra
10354        X
10355        \H+
10356        \R
10357        Ket
10358        End
10359------------------------------------------------------------------
10360    X\x0d\x0a
10361 0: X\x0d\x0a
10362
10363/X\H++\R/B
10364------------------------------------------------------------------
10365        Bra
10366        X
10367        \H++
10368        \R
10369        Ket
10370        End
10371------------------------------------------------------------------
10372\= Expect no match
10373    X\x0d\x0a
10374No match
10375
10376/(?<=abc)def/
10377    abc\=ph
10378Partial match:
10379
10380/abc$/
10381    abc
10382 0: abc
10383    abc\=ps
10384 0: abc
10385    abc\=ph
10386Partial match: abc
10387
10388/abc$/m
10389    abc
10390 0: abc
10391    abc\n
10392 0: abc
10393    abc\=ph
10394Partial match: abc
10395    abc\n\=ph
10396 0: abc
10397    abc\=ps
10398 0: abc
10399    abc\n\=ps
10400 0: abc
10401
10402/abc\z/
10403    abc
10404 0: abc
10405    abc\=ps
10406 0: abc
10407    abc\=ph
10408Partial match: abc
10409
10410/abc\Z/
10411    abc
10412 0: abc
10413    abc\=ps
10414 0: abc
10415    abc\=ph
10416Partial match: abc
10417
10418/abc\b/
10419    abc
10420 0: abc
10421    abc\=ps
10422 0: abc
10423    abc\=ph
10424Partial match: abc
10425
10426/abc\B/
10427    abc\=ps
10428Partial match: abc
10429    abc\=ph
10430Partial match: abc
10431\= Expect no match
10432    abc
10433No match
10434
10435/.+/
10436\= Bad offsets
10437    abc\=offset=4
10438Failed: error -33: bad offset value
10439    abc\=offset=-4
10440** Invalid value in 'offset=-4'
10441\= Valid data
10442    abc\=offset=0
10443 0: abc
10444    abc\=offset=1
10445 0: bc
10446    abc\=offset=2
10447 0: c
10448\= Expect no match
10449    abc\=offset=3
10450No match
10451
10452/^\cģ/
10453Failed: error 168 at offset 3: \c must be followed by a printable ASCII character
10454
10455/(?P<abn>(?P=abn)xxx)/B
10456------------------------------------------------------------------
10457        Bra
10458        CBra 1
10459        \1
10460        xxx
10461        Ket
10462        Ket
10463        End
10464------------------------------------------------------------------
10465
10466/(a\1z)/B
10467------------------------------------------------------------------
10468        Bra
10469        CBra 1
10470        a
10471        \1
10472        z
10473        Ket
10474        Ket
10475        End
10476------------------------------------------------------------------
10477
10478/(?P<abn>(?P=abn)(?<badstufxxx)/B
10479Failed: error 142 at offset 29: syntax error in subpattern name (missing terminator?)
10480
10481/(?P<abn>(?P=axn)xxx)/B
10482Failed: error 115 at offset 12: reference to non-existent subpattern
10483
10484/(?P<abn>(?P=axn)xxx)(?<axn>yy)/B
10485------------------------------------------------------------------
10486        Bra
10487        CBra 1
10488        \2
10489        xxx
10490        Ket
10491        CBra 2
10492        yy
10493        Ket
10494        Ket
10495        End
10496------------------------------------------------------------------
10497
10498# These tests are here because Perl gets the first one wrong.
10499
10500/(\R*)(.)/s
10501    \r\n
10502 0: \x0d
10503 1:
10504 2: \x0d
10505    \r\r\n\n\r
10506 0: \x0d\x0d\x0a\x0a\x0d
10507 1: \x0d\x0d\x0a\x0a
10508 2: \x0d
10509    \r\r\n\n\r\n
10510 0: \x0d\x0d\x0a\x0a\x0d
10511 1: \x0d\x0d\x0a\x0a
10512 2: \x0d
10513
10514/(\R)*(.)/s
10515    \r\n
10516 0: \x0d
10517 1: <unset>
10518 2: \x0d
10519    \r\r\n\n\r
10520 0: \x0d\x0d\x0a\x0a\x0d
10521 1: \x0a
10522 2: \x0d
10523    \r\r\n\n\r\n
10524 0: \x0d\x0d\x0a\x0a\x0d
10525 1: \x0a
10526 2: \x0d
10527
10528/((?>\r\n|\n|\x0b|\f|\r|\x85)*)(.)/s
10529    \r\n
10530 0: \x0d
10531 1:
10532 2: \x0d
10533    \r\r\n\n\r
10534 0: \x0d\x0d\x0a\x0a\x0d
10535 1: \x0d\x0d\x0a\x0a
10536 2: \x0d
10537    \r\r\n\n\r\n
10538 0: \x0d\x0d\x0a\x0a\x0d
10539 1: \x0d\x0d\x0a\x0a
10540 2: \x0d
10541
10542# -------------
10543
10544/^abc$/B
10545------------------------------------------------------------------
10546        Bra
10547        ^
10548        abc
10549        $
10550        Ket
10551        End
10552------------------------------------------------------------------
10553
10554/^abc$/Bm
10555------------------------------------------------------------------
10556        Bra
10557     /m ^
10558        abc
10559     /m $
10560        Ket
10561        End
10562------------------------------------------------------------------
10563
10564/^(a)*+(\w)/
10565    aaaaX
10566 0: aaaaX
10567 1: a
10568 2: X
10569\= Expect no match
10570    aaaa
10571No match
10572
10573/^(?:a)*+(\w)/
10574    aaaaX
10575 0: aaaaX
10576 1: X
10577\= Expect no match
10578    aaaa
10579No match
10580
10581/(a)++1234/IB
10582------------------------------------------------------------------
10583        Bra
10584        CBraPos 1
10585        a
10586        KetRpos
10587        1234
10588        Ket
10589        End
10590------------------------------------------------------------------
10591Capture group count = 1
10592First code unit = 'a'
10593Last code unit = '4'
10594Subject length lower bound = 5
10595
10596/([abc])++1234/I
10597Capture group count = 1
10598Starting code units: a b c
10599Last code unit = '4'
10600Subject length lower bound = 5
10601
10602/(?<=(abc)+)X/
10603Failed: error 125 at offset 0: lookbehind assertion is not fixed length
10604
10605/(^ab)/I
10606Capture group count = 1
10607Compile options: <none>
10608Overall options: anchored
10609First code unit = 'a'
10610Subject length lower bound = 2
10611
10612/(^ab)++/I
10613Capture group count = 1
10614Compile options: <none>
10615Overall options: anchored
10616First code unit = 'a'
10617Subject length lower bound = 2
10618
10619/(^ab|^)+/I
10620Capture group count = 1
10621May match empty string
10622Compile options: <none>
10623Overall options: anchored
10624Subject length lower bound = 0
10625
10626/(^ab|^)++/I
10627Capture group count = 1
10628May match empty string
10629Compile options: <none>
10630Overall options: anchored
10631Subject length lower bound = 0
10632
10633/(?:^ab)/I
10634Capture group count = 0
10635Compile options: <none>
10636Overall options: anchored
10637First code unit = 'a'
10638Subject length lower bound = 2
10639
10640/(?:^ab)++/I
10641Capture group count = 0
10642Compile options: <none>
10643Overall options: anchored
10644First code unit = 'a'
10645Subject length lower bound = 2
10646
10647/(?:^ab|^)+/I
10648Capture group count = 0
10649May match empty string
10650Compile options: <none>
10651Overall options: anchored
10652Subject length lower bound = 0
10653
10654/(?:^ab|^)++/I
10655Capture group count = 0
10656May match empty string
10657Compile options: <none>
10658Overall options: anchored
10659Subject length lower bound = 0
10660
10661/(.*ab)/I
10662Capture group count = 1
10663First code unit at start or follows newline
10664Last code unit = 'b'
10665Subject length lower bound = 2
10666
10667/(.*ab)++/I
10668Capture group count = 1
10669First code unit at start or follows newline
10670Last code unit = 'b'
10671Subject length lower bound = 2
10672
10673/(.*ab|.*)+/I
10674Capture group count = 1
10675May match empty string
10676First code unit at start or follows newline
10677Subject length lower bound = 0
10678
10679/(.*ab|.*)++/I
10680Capture group count = 1
10681May match empty string
10682First code unit at start or follows newline
10683Subject length lower bound = 0
10684
10685/(?:.*ab)/I
10686Capture group count = 0
10687First code unit at start or follows newline
10688Last code unit = 'b'
10689Subject length lower bound = 2
10690
10691/(?:.*ab)++/I
10692Capture group count = 0
10693First code unit at start or follows newline
10694Last code unit = 'b'
10695Subject length lower bound = 2
10696
10697/(?:.*ab|.*)+/I
10698Capture group count = 0
10699May match empty string
10700First code unit at start or follows newline
10701Subject length lower bound = 0
10702
10703/(?:.*ab|.*)++/I
10704Capture group count = 0
10705May match empty string
10706First code unit at start or follows newline
10707Subject length lower bound = 0
10708
10709/(?=a)[bcd]/I
10710Capture group count = 0
10711First code unit = 'a'
10712Subject length lower bound = 1
10713
10714/((?=a))[bcd]/I
10715Capture group count = 1
10716First code unit = 'a'
10717Subject length lower bound = 1
10718
10719/((?=a))+[bcd]/I
10720Capture group count = 1
10721First code unit = 'a'
10722Subject length lower bound = 1
10723
10724/((?=a))++[bcd]/I
10725Capture group count = 1
10726First code unit = 'a'
10727Subject length lower bound = 1
10728
10729/(?=a+)[bcd]/Ii
10730Capture group count = 0
10731Options: caseless
10732First code unit = 'a' (caseless)
10733Subject length lower bound = 1
10734
10735/(?=a+?)[bcd]/Ii
10736Capture group count = 0
10737Options: caseless
10738First code unit = 'a' (caseless)
10739Subject length lower bound = 1
10740
10741/(?=a++)[bcd]/Ii
10742Capture group count = 0
10743Options: caseless
10744First code unit = 'a' (caseless)
10745Subject length lower bound = 1
10746
10747/(?=a{3})[bcd]/Ii
10748Capture group count = 0
10749Options: caseless
10750First code unit = 'a' (caseless)
10751Last code unit = 'a' (caseless)
10752Subject length lower bound = 2
10753
10754/(abc)\1+/
10755
10756# Perl doesn't get these right IMO (the 3rd is PCRE2-specific)
10757
10758/(?1)(?:(b(*ACCEPT))){0}/
10759    b
10760 0: b
10761
10762/(?1)(?:(b(*ACCEPT))){0}c/
10763    bc
10764 0: bc
10765\= Expect no match
10766    b
10767No match
10768
10769/(?1)(?:((*ACCEPT))){0}c/
10770    c
10771 0: c
10772    c\=notempty
10773 0: c
10774
10775/^.*?(?(?=a)a|b(*THEN)c)/
10776\= Expect no match
10777    ba
10778No match
10779
10780/^.*?(?(?=a)a|bc)/
10781    ba
10782 0: ba
10783
10784/^.*?(?(?=a)a(*THEN)b|c)/
10785\= Expect no match
10786    ac
10787No match
10788
10789/^.*?(?(?=a)a(*THEN)b)c/
10790\= Expect no match
10791    ac
10792No match
10793
10794/^.*?(a(*THEN)b)c/
10795\= Expect no match
10796    aabc
10797No match
10798
10799/^.*? (?1) c (?(DEFINE)(a(*THEN)b))/x
10800    aabc
10801 0: aabc
10802
10803/^.*?(a(*THEN)b|z)c/
10804    aabc
10805 0: aabc
10806 1: ab
10807
10808/^.*?(z|a(*THEN)b)c/
10809    aabc
10810 0: aabc
10811 1: ab
10812
10813# These are here because they are not Perl-compatible; the studying means the
10814# mark is not seen.
10815
10816/(*MARK:A)(*SKIP:B)(C|X)/mark
10817    C
10818 0: C
10819 1: C
10820MK: A
10821\= Expect no match
10822    D
10823No match, mark = A
10824
10825/(*:A)A+(*SKIP:A)(B|Z)/mark
10826\= Expect no match
10827    AAAC
10828No match, mark = A
10829
10830# ----------------------------
10831
10832"(?=a*(*ACCEPT)b)c"
10833    c
10834 0: c
10835    c\=notempty
10836 0: c
10837
10838/(?1)c(?(DEFINE)((*ACCEPT)b))/
10839    c
10840 0: c
10841    c\=notempty
10842 0: c
10843
10844/(?>(*ACCEPT)b)c/
10845    c
10846 0:
10847\= Expect no match
10848    c\=notempty
10849No match
10850
10851/(?:(?>(a)))+a%/allaftertext
10852    %aa%
10853 0: aa%
10854 0+
10855 1: a
10856 1+ a%
10857
10858/(a)b|ac/allaftertext
10859    ac\=ovector=1
10860 0: ac
10861 0+
10862
10863/(a)(b)x|abc/allaftertext
10864     abc\=ovector=2
10865 0: abc
10866 0+
10867
10868/(a)bc|(a)(b)\2/
10869    abc\=ovector=1
10870Matched, but too many substrings
10871 0: abc
10872    abc\=ovector=2
10873 0: abc
10874 1: a
10875    aba\=ovector=1
10876Matched, but too many substrings
10877 0: aba
10878    aba\=ovector=2
10879Matched, but too many substrings
10880 0: aba
10881 1: <unset>
10882    aba\=ovector=3
10883Matched, but too many substrings
10884 0: aba
10885 1: <unset>
10886 2: a
10887    aba\=ovector=4
10888 0: aba
10889 1: <unset>
10890 2: a
10891 3: b
10892
10893/(?(DEFINE)(a(?2)|b)(b(?1)|a))(?:(?1)|(?2))/I
10894Capture group count = 2
10895May match empty string
10896Subject length lower bound = 0
10897
10898/(a(?2)|b)(b(?1)|a)(?:(?1)|(?2))/I
10899Capture group count = 2
10900Starting code units: a b
10901Subject length lower bound = 3
10902
10903/(a(?2)|b)(b(?1)|a)(?1)(?2)/I
10904Capture group count = 2
10905Starting code units: a b
10906Subject length lower bound = 4
10907
10908/(abc)(?1)/I
10909Capture group count = 1
10910First code unit = 'a'
10911Last code unit = 'c'
10912Subject length lower bound = 6
10913
10914/(?:(foo)|(bar)|(baz))X/allcaptures
10915    bazfooX
10916 0: fooX
10917 1: foo
10918 2: <unset>
10919 3: <unset>
10920    foobazbarX
10921 0: barX
10922 1: <unset>
10923 2: bar
10924 3: <unset>
10925    barfooX
10926 0: fooX
10927 1: foo
10928 2: <unset>
10929 3: <unset>
10930    bazX
10931 0: bazX
10932 1: <unset>
10933 2: <unset>
10934 3: baz
10935    foobarbazX
10936 0: bazX
10937 1: <unset>
10938 2: <unset>
10939 3: baz
10940    bazfooX\=ovector=0
10941 0: fooX
10942 1: foo
10943 2: <unset>
10944 3: <unset>
10945    bazfooX\=ovector=1
10946Matched, but too many substrings
10947 0: fooX
10948    bazfooX\=ovector=2
10949 0: fooX
10950 1: foo
10951    bazfooX\=ovector=3
10952 0: fooX
10953 1: foo
10954 2: <unset>
10955
10956/(?=abc){3}abc/B
10957------------------------------------------------------------------
10958        Bra
10959        Assert
10960        abc
10961        Ket
10962        Assert
10963        abc
10964        Ket
10965        Assert
10966        abc
10967        Ket
10968        abc
10969        Ket
10970        End
10971------------------------------------------------------------------
10972
10973/(?=abc)+abc/B
10974------------------------------------------------------------------
10975        Bra
10976        Assert
10977        abc
10978        Ket
10979        Brazero
10980        Assert
10981        abc
10982        Ket
10983        abc
10984        Ket
10985        End
10986------------------------------------------------------------------
10987
10988/(?=abc)++abc/B
10989------------------------------------------------------------------
10990        Bra
10991        Once
10992        Assert
10993        abc
10994        Ket
10995        Brazero
10996        Assert
10997        abc
10998        Ket
10999        Ket
11000        abc
11001        Ket
11002        End
11003------------------------------------------------------------------
11004
11005/(?=abc){0}xyz/B
11006------------------------------------------------------------------
11007        Bra
11008        Skip zero
11009        Assert
11010        abc
11011        Ket
11012        xyz
11013        Ket
11014        End
11015------------------------------------------------------------------
11016
11017/(?=(a))?./B
11018------------------------------------------------------------------
11019        Bra
11020        Brazero
11021        Assert
11022        CBra 1
11023        a
11024        Ket
11025        Ket
11026        Any
11027        Ket
11028        End
11029------------------------------------------------------------------
11030
11031/(?=(a))??./B
11032------------------------------------------------------------------
11033        Bra
11034        Braminzero
11035        Assert
11036        CBra 1
11037        a
11038        Ket
11039        Ket
11040        Any
11041        Ket
11042        End
11043------------------------------------------------------------------
11044
11045/^(?=(a)){0}b(?1)/B
11046------------------------------------------------------------------
11047        Bra
11048        ^
11049        Skip zero
11050        Assert
11051        CBra 1
11052        a
11053        Ket
11054        Ket
11055        b
11056        Recurse
11057        Ket
11058        End
11059------------------------------------------------------------------
11060
11061/(?(DEFINE)(a))?b(?1)/B
11062------------------------------------------------------------------
11063        Bra
11064        Cond
11065        Cond false
11066        CBra 1
11067        a
11068        Ket
11069        Ket
11070        b
11071        Recurse
11072        Ket
11073        End
11074------------------------------------------------------------------
11075
11076/^(?=(?1))?[az]([abc])d/B
11077------------------------------------------------------------------
11078        Bra
11079        ^
11080        Brazero
11081        Assert
11082        Recurse
11083        Ket
11084        [az]
11085        CBra 1
11086        [a-c]
11087        Ket
11088        d
11089        Ket
11090        End
11091------------------------------------------------------------------
11092
11093/^(?!a){0}\w+/B
11094------------------------------------------------------------------
11095        Bra
11096        ^
11097        Skip zero
11098        Assert not
11099        a
11100        Ket
11101        \w++
11102        Ket
11103        End
11104------------------------------------------------------------------
11105
11106/(?<=(abc))?xyz/B
11107------------------------------------------------------------------
11108        Bra
11109        Brazero
11110        Assert back
11111        Reverse
11112        CBra 1
11113        abc
11114        Ket
11115        Ket
11116        xyz
11117        Ket
11118        End
11119------------------------------------------------------------------
11120
11121/[:a[:abc]b:]/B
11122------------------------------------------------------------------
11123        Bra
11124        [:[a-c]
11125        b:]
11126        Ket
11127        End
11128------------------------------------------------------------------
11129
11130/^(a(*:A)(d|e(*:B))z|aeq)/auto_callout
11131    adz
11132--->adz
11133 +0 ^       ^
11134 +1 ^       (
11135 +2 ^       a
11136 +3 ^^      (*:A)
11137 +8 ^^      (
11138Latest Mark: A
11139 +9 ^^      d
11140+10 ^ ^     |
11141+18 ^ ^     z
11142+19 ^  ^    |
11143+24 ^  ^    End of pattern
11144 0: adz
11145 1: adz
11146 2: d
11147    aez
11148--->aez
11149 +0 ^       ^
11150 +1 ^       (
11151 +2 ^       a
11152 +3 ^^      (*:A)
11153 +8 ^^      (
11154Latest Mark: A
11155 +9 ^^      d
11156+11 ^^      e
11157+12 ^ ^     (*:B)
11158+17 ^ ^     )
11159Latest Mark: B
11160+18 ^ ^     z
11161+19 ^  ^    |
11162+24 ^  ^    End of pattern
11163 0: aez
11164 1: aez
11165 2: e
11166    aeqwerty
11167--->aeqwerty
11168 +0 ^            ^
11169 +1 ^            (
11170 +2 ^            a
11171 +3 ^^           (*:A)
11172 +8 ^^           (
11173Latest Mark: A
11174 +9 ^^           d
11175+11 ^^           e
11176+12 ^ ^          (*:B)
11177+17 ^ ^          )
11178Latest Mark: B
11179+18 ^ ^          z
11180+20 ^            a
11181+21 ^^           e
11182+22 ^ ^          q
11183+23 ^  ^         )
11184+24 ^  ^         End of pattern
11185 0: aeq
11186 1: aeq
11187
11188/.(*F)/
11189\= Expect no match
11190    abc\=ph
11191No match
11192
11193/\btype\b\W*?\btext\b\W*?\bjavascript\b/I
11194Capture group count = 0
11195Max lookbehind = 1
11196First code unit = 't'
11197Last code unit = 't'
11198Subject length lower bound = 18
11199
11200/\btype\b\W*?\btext\b\W*?\bjavascript\b|\burl\b\W*?\bshell:|<input\b.*?\btype\b\W*?\bimage\b|\bonkeyup\b\W*?\=/I
11201Capture group count = 0
11202Max lookbehind = 1
11203Starting code units: < o t u
11204Subject length lower bound = 8
11205
11206/a(*SKIP)c|b(*ACCEPT)|/I,aftertext
11207Capture group count = 0
11208May match empty string
11209Subject length lower bound = 0
11210    a
11211 0:
11212 0+
11213
11214/a(*SKIP)c|b(*ACCEPT)cd(*ACCEPT)|x/I
11215Capture group count = 0
11216Starting code units: a b x
11217Subject length lower bound = 1
11218    ax
11219 0: x
11220
11221'a*(*ACCEPT)b'aftertext
11222    abc\=notempty_atstart
11223 0: a
11224 0+ bc
11225    bbb\=notempty_atstart
11226 0:
11227 0+ bb
11228\= Expect no match
11229    \=notempty_atstart
11230No match
11231
11232/(*ACCEPT)a/I,aftertext
11233Capture group count = 0
11234May match empty string
11235Subject length lower bound = 0
11236    bax
11237 0:
11238 0+ bax
11239
11240/z(*ACCEPT)a/I,aftertext
11241Capture group count = 0
11242First code unit = 'z'
11243Subject length lower bound = 1
11244    baxzbx
11245 0: z
11246 0+ bx
11247
11248/^(?>a+)(?>(z+))\w/B
11249------------------------------------------------------------------
11250        Bra
11251        ^
11252        Once
11253        a++
11254        Ket
11255        Once
11256        CBra 1
11257        z++
11258        Ket
11259        Ket
11260        \w
11261        Ket
11262        End
11263------------------------------------------------------------------
11264    aaaazzzzb
11265 0: aaaazzzzb
11266 1: zzzz
11267\= Expect no match
11268    aazz
11269No match
11270
11271/(.)(\1|a(?2))/
11272    bab
11273 0: bab
11274 1: b
11275 2: ab
11276
11277/\1|(.)(?R)\1/
11278    cbbbc
11279 0: cbbbc
11280 1: c
11281
11282/(.)((?(1)c|a)|a(?2))/
11283\= Expect no match
11284    baa
11285No match
11286
11287/(?P<abn>(?P=abn)xxx)/B
11288------------------------------------------------------------------
11289        Bra
11290        CBra 1
11291        \1
11292        xxx
11293        Ket
11294        Ket
11295        End
11296------------------------------------------------------------------
11297
11298/(a\1z)/B
11299------------------------------------------------------------------
11300        Bra
11301        CBra 1
11302        a
11303        \1
11304        z
11305        Ket
11306        Ket
11307        End
11308------------------------------------------------------------------
11309
11310/^a\x41z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11311    aAz
11312 0: aAz
11313\= Expect no match
11314    ax41z
11315No match
11316
11317/^a[m\x41]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11318    aAz
11319 0: aAz
11320
11321/^a\x1z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11322    ax1z
11323 0: ax1z
11324
11325/^a\u0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11326    aAz
11327 0: aAz
11328\= Expect no match
11329    au0041z
11330No match
11331
11332/^a[m\u0041]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11333    aAz
11334 0: aAz
11335
11336/^a\u041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11337    au041z
11338 0: au041z
11339\= Expect no match
11340    aAz
11341No match
11342
11343/^a\U0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
11344    aU0041z
11345 0: aU0041z
11346\= Expect no match
11347    aAz
11348No match
11349
11350/^\u{7a}/alt_bsux
11351    u{7a}
11352 0: u{7a}
11353\= Expect no match
11354    zoo
11355No match
11356
11357/^\u{7a}/extra_alt_bsux
11358    zoo
11359 0: z
11360
11361/(?(?=c)c|d)++Y/B
11362------------------------------------------------------------------
11363        Bra
11364        BraPos
11365        Cond
11366        Assert
11367        c
11368        Ket
11369        c
11370        Alt
11371        d
11372        Ket
11373        KetRpos
11374        Y
11375        Ket
11376        End
11377------------------------------------------------------------------
11378
11379/(?(?=c)c|d)*+Y/B
11380------------------------------------------------------------------
11381        Bra
11382        Braposzero
11383        BraPos
11384        Cond
11385        Assert
11386        c
11387        Ket
11388        c
11389        Alt
11390        d
11391        Ket
11392        KetRpos
11393        Y
11394        Ket
11395        End
11396------------------------------------------------------------------
11397
11398/a[\NB]c/
11399Failed: error 171 at offset 4: \N is not supported in a class
11400    aNc
11401
11402/a[B-\Nc]/
11403Failed: error 150 at offset 6: invalid range in character class
11404
11405/a[B\Nc]/
11406Failed: error 171 at offset 5: \N is not supported in a class
11407
11408/(a)(?2){0,1999}?(b)/
11409
11410/(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/
11411
11412# This test, with something more complicated than individual letters, causes
11413# different behaviour in Perl. Perhaps it disables some optimization; no tag is
11414# passed back for the failures, whereas in PCRE2 there is a tag.
11415
11416/(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/x,mark
11417    AABC
11418 0: AB
11419 1: A
11420 2: B
11421MK: A
11422    XXYZ
11423 0: XXY
11424 1: <unset>
11425 2: <unset>
11426 3: X
11427 4: X
11428 5: Y
11429MK: B
11430\= Expect no match
11431    XAQQ
11432No match, mark = A
11433    XAQQXZZ
11434No match, mark = A
11435    AXQQQ
11436No match, mark = A
11437    AXXQQQ
11438No match, mark = B
11439
11440# Perl doesn't give marks for these, though it does if the alternatives are
11441# replaced by single letters.
11442
11443/(b|q)(*:m)f|a(*:n)w/mark
11444    aw
11445 0: aw
11446MK: n
11447\= Expect no match
11448    abc
11449No match, mark = m
11450
11451/(q|b)(*:m)f|a(*:n)w/mark
11452    aw
11453 0: aw
11454MK: n
11455\= Expect no match
11456    abc
11457No match, mark = m
11458
11459# After a partial match, the behaviour is as for a failure.
11460
11461/^a(*:X)bcde/mark
11462   abc\=ps
11463Partial match, mark=X: abc
11464
11465# These are here because Perl doesn't return a mark, except for the first.
11466
11467/(?=(*:x))(q|)/aftertext,mark
11468    abc
11469 0:
11470 0+ abc
11471 1:
11472MK: x
11473
11474/(?=(*:x))((*:y)q|)/aftertext,mark
11475    abc
11476 0:
11477 0+ abc
11478 1:
11479MK: x
11480
11481/(?=(*:x))(?:(*:y)q|)/aftertext,mark
11482    abc
11483 0:
11484 0+ abc
11485MK: x
11486
11487/(?=(*:x))(?>(*:y)q|)/aftertext,mark
11488    abc
11489 0:
11490 0+ abc
11491MK: x
11492
11493/(?=a(*:x))(?!a(*:y)c)/aftertext,mark
11494    ab
11495 0:
11496 0+ ab
11497MK: x
11498
11499/(?=a(*:x))(?=a(*:y)c|)/aftertext,mark
11500    ab
11501 0:
11502 0+ ab
11503MK: x
11504
11505/(..)\1/
11506    ab\=ps
11507Partial match: ab
11508    aba\=ps
11509Partial match: aba
11510    abab\=ps
11511 0: abab
11512 1: ab
11513
11514/(..)\1/i
11515    ab\=ps
11516Partial match: ab
11517    abA\=ps
11518Partial match: abA
11519    aBAb\=ps
11520 0: aBAb
11521 1: aB
11522
11523/(..)\1{2,}/
11524    ab\=ps
11525Partial match: ab
11526    aba\=ps
11527Partial match: aba
11528    abab\=ps
11529Partial match: abab
11530    ababa\=ps
11531Partial match: ababa
11532    ababab\=ps
11533 0: ababab
11534 1: ab
11535    ababab\=ph
11536Partial match: ababab
11537    abababa\=ps
11538 0: ababab
11539 1: ab
11540    abababa\=ph
11541Partial match: abababa
11542
11543/(..)\1{2,}/i
11544    ab\=ps
11545Partial match: ab
11546    aBa\=ps
11547Partial match: aBa
11548    aBAb\=ps
11549Partial match: aBAb
11550    AbaBA\=ps
11551Partial match: AbaBA
11552    abABAb\=ps
11553 0: abABAb
11554 1: ab
11555    aBAbaB\=ph
11556Partial match: aBAbaB
11557    abABabA\=ps
11558 0: abABab
11559 1: ab
11560    abaBABa\=ph
11561Partial match: abaBABa
11562
11563/(..)\1{2,}?x/i
11564    ab\=ps
11565Partial match: ab
11566    abA\=ps
11567Partial match: abA
11568    aBAb\=ps
11569Partial match: aBAb
11570    abaBA\=ps
11571Partial match: abaBA
11572    abAbaB\=ps
11573Partial match: abAbaB
11574    abaBabA\=ps
11575Partial match: abaBabA
11576    abAbABaBx\=ps
11577 0: abAbABaBx
11578 1: ab
11579
11580/^(..)\1/
11581    aba\=ps
11582Partial match: aba
11583
11584/^(..)\1{2,3}x/
11585    aba\=ps
11586Partial match: aba
11587    ababa\=ps
11588Partial match: ababa
11589    ababa\=ph
11590Partial match: ababa
11591    abababx
11592 0: abababx
11593 1: ab
11594    ababababx
11595 0: ababababx
11596 1: ab
11597
11598/^(..)\1{2,3}?x/
11599    aba\=ps
11600Partial match: aba
11601    ababa\=ps
11602Partial match: ababa
11603    ababa\=ph
11604Partial match: ababa
11605    abababx
11606 0: abababx
11607 1: ab
11608    ababababx
11609 0: ababababx
11610 1: ab
11611
11612/^(..)(\1{2,3})ab/
11613    abababab
11614 0: abababab
11615 1: ab
11616 2: abab
11617
11618/^\R/
11619    \r\=ps
11620 0: \x0d
11621    \r\=ph
11622Partial match: \x0d
11623
11624/^\R{2,3}x/
11625    \r\=ps
11626Partial match: \x0d
11627    \r\=ph
11628Partial match: \x0d
11629    \r\r\=ps
11630Partial match: \x0d\x0d
11631    \r\r\=ph
11632Partial match: \x0d\x0d
11633    \r\r\r\=ps
11634Partial match: \x0d\x0d\x0d
11635    \r\r\r\=ph
11636Partial match: \x0d\x0d\x0d
11637    \r\rx
11638 0: \x0d\x0dx
11639    \r\r\rx
11640 0: \x0d\x0d\x0dx
11641
11642/^\R{2,3}?x/
11643    \r\=ps
11644Partial match: \x0d
11645    \r\=ph
11646Partial match: \x0d
11647    \r\r\=ps
11648Partial match: \x0d\x0d
11649    \r\r\=ph
11650Partial match: \x0d\x0d
11651    \r\r\r\=ps
11652Partial match: \x0d\x0d\x0d
11653    \r\r\r\=ph
11654Partial match: \x0d\x0d\x0d
11655    \r\rx
11656 0: \x0d\x0dx
11657    \r\r\rx
11658 0: \x0d\x0d\x0dx
11659
11660/^\R?x/
11661    \r\=ps
11662Partial match: \x0d
11663    \r\=ph
11664Partial match: \x0d
11665    x
11666 0: x
11667    \rx
11668 0: \x0dx
11669
11670/^\R+x/
11671    \r\=ps
11672Partial match: \x0d
11673    \r\=ph
11674Partial match: \x0d
11675    \r\n\=ps
11676Partial match: \x0d\x0a
11677    \r\n\=ph
11678Partial match: \x0d\x0a
11679    \rx
11680 0: \x0dx
11681
11682/^a$/newline=crlf
11683    a\r\=ps
11684Partial match: a\x0d
11685    a\r\=ph
11686Partial match: a\x0d
11687
11688/^a$/m,newline=crlf
11689    a\r\=ps
11690Partial match: a\x0d
11691    a\r\=ph
11692Partial match: a\x0d
11693
11694/^(a$|a\r)/newline=crlf
11695    a\r\=ps
11696 0: a\x0d
11697 1: a\x0d
11698    a\r\=ph
11699Partial match: a\x0d
11700
11701/^(a$|a\r)/m,newline=crlf
11702    a\r\=ps
11703 0: a\x0d
11704 1: a\x0d
11705    a\r\=ph
11706Partial match: a\x0d
11707
11708/./newline=crlf
11709    \r\=ps
11710 0: \x0d
11711    \r\=ph
11712Partial match: \x0d
11713
11714/.{2,3}/newline=crlf
11715    \r\=ps
11716Partial match: \x0d
11717    \r\=ph
11718Partial match: \x0d
11719    \r\r\=ps
11720 0: \x0d\x0d
11721    \r\r\=ph
11722Partial match: \x0d\x0d
11723    \r\r\r\=ps
11724 0: \x0d\x0d\x0d
11725    \r\r\r\=ph
11726Partial match: \x0d\x0d\x0d
11727
11728/.{2,3}?/newline=crlf
11729    \r\=ps
11730Partial match: \x0d
11731    \r\=ph
11732Partial match: \x0d
11733    \r\r\=ps
11734 0: \x0d\x0d
11735    \r\r\=ph
11736Partial match: \x0d\x0d
11737    \r\r\r\=ps
11738 0: \x0d\x0d
11739    \r\r\r\=ph
11740 0: \x0d\x0d
11741
11742"AB(C(D))(E(F))?(?(?=\2)(?=\4))"
11743    ABCDGHI\=ovector=01
11744Matched, but too many substrings
11745 0: ABCD
11746
11747# These are all run as real matches in test 1; here we are just checking the
11748# settings of the anchored and startline bits.
11749
11750/(?>.*?a)(?<=ba)/I
11751Capture group count = 0
11752Max lookbehind = 2
11753Last code unit = 'a'
11754Subject length lower bound = 1
11755
11756/(?:.*?a)(?<=ba)/I
11757Capture group count = 0
11758Max lookbehind = 2
11759First code unit at start or follows newline
11760Last code unit = 'a'
11761Subject length lower bound = 1
11762
11763/.*?a(*PRUNE)b/I
11764Capture group count = 0
11765Last code unit = 'b'
11766Subject length lower bound = 2
11767
11768/.*?a(*PRUNE)b/Is
11769Capture group count = 0
11770Options: dotall
11771Last code unit = 'b'
11772Subject length lower bound = 2
11773
11774/^a(*PRUNE)b/Is
11775Capture group count = 0
11776Compile options: dotall
11777Overall options: anchored dotall
11778First code unit = 'a'
11779Subject length lower bound = 2
11780
11781/.*?a(*SKIP)b/I
11782Capture group count = 0
11783Last code unit = 'b'
11784Subject length lower bound = 2
11785
11786/(?>.*?a)b/Is
11787Capture group count = 0
11788Options: dotall
11789Last code unit = 'b'
11790Subject length lower bound = 2
11791
11792/(?>.*?a)b/I
11793Capture group count = 0
11794Last code unit = 'b'
11795Subject length lower bound = 2
11796
11797/(?>^a)b/Is
11798Capture group count = 0
11799Compile options: dotall
11800Overall options: anchored dotall
11801First code unit = 'a'
11802Subject length lower bound = 2
11803
11804/(?>.*?)(?<=(abcd)|(wxyz))/I
11805Capture group count = 2
11806Max lookbehind = 4
11807May match empty string
11808Subject length lower bound = 0
11809
11810/(?>.*)(?<=(abcd)|(wxyz))/I
11811Capture group count = 2
11812Max lookbehind = 4
11813May match empty string
11814Subject length lower bound = 0
11815
11816"(?>.*)foo"I
11817Capture group count = 0
11818Last code unit = 'o'
11819Subject length lower bound = 3
11820
11821"(?>.*?)foo"I
11822Capture group count = 0
11823Last code unit = 'o'
11824Subject length lower bound = 3
11825
11826/(?>^abc)/Im
11827Capture group count = 0
11828Options: multiline
11829First code unit at start or follows newline
11830Last code unit = 'c'
11831Subject length lower bound = 3
11832
11833/(?>.*abc)/Im
11834Capture group count = 0
11835Options: multiline
11836Last code unit = 'c'
11837Subject length lower bound = 3
11838
11839/(?:.*abc)/Im
11840Capture group count = 0
11841Options: multiline
11842First code unit at start or follows newline
11843Last code unit = 'c'
11844Subject length lower bound = 3
11845
11846/(?:(a)+(?C1)bb|aa(?C2)b)/
11847    aab\=callout_capture
11848Callout 1: last capture = 1
11849 1: a
11850--->aab
11851    ^ ^     b
11852Callout 1: last capture = 1
11853 1: a
11854--->aab
11855    ^^      b
11856Callout 2: last capture = 0
11857--->aab
11858    ^ ^     b
11859 0: aab
11860
11861/(?:(a)++(?C1)bb|aa(?C2)b)/
11862    aab\=callout_capture
11863Callout 1: last capture = 1
11864 1: a
11865--->aab
11866    ^ ^     b
11867Callout 2: last capture = 0
11868--->aab
11869    ^ ^     b
11870 0: aab
11871
11872/(?:(?>(a))(?C1)bb|aa(?C2)b)/
11873    aab\=callout_capture
11874Callout 1: last capture = 1
11875 1: a
11876--->aab
11877    ^^      b
11878Callout 2: last capture = 0
11879--->aab
11880    ^ ^     b
11881 0: aab
11882
11883/(?:(?1)(?C1)x|ab(?C2))((a)){0}/
11884    aab\=callout_capture
11885Callout 1: last capture = 0
11886--->aab
11887    ^^      x
11888Callout 1: last capture = 0
11889--->aab
11890     ^^     x
11891Callout 2: last capture = 0
11892--->aab
11893     ^ ^    )
11894 0: ab
11895
11896/(?1)(?C1)((a)(?C2)){0}/
11897    aab\=callout_capture
11898Callout 2: last capture = 2
11899 1: <unset>
11900 2: a
11901--->aab
11902    ^^      ){0}
11903Callout 1: last capture = 0
11904--->aab
11905    ^^      (
11906 0: a
11907
11908/(?:(a)+(?C1)bb|aa(?C2)b)++/
11909    aab\=callout_capture
11910Callout 1: last capture = 1
11911 1: a
11912--->aab
11913    ^ ^     b
11914Callout 1: last capture = 1
11915 1: a
11916--->aab
11917    ^^      b
11918Callout 2: last capture = 0
11919--->aab
11920    ^ ^     b
11921 0: aab
11922    aab\=callout_capture,ovector=1
11923Callout 1: last capture = 1
11924 1: a
11925--->aab
11926    ^ ^     b
11927Callout 1: last capture = 1
11928 1: a
11929--->aab
11930    ^^      b
11931Callout 2: last capture = 0
11932--->aab
11933    ^ ^     b
11934 0: aab
11935
11936/(ab)x|ab/
11937    ab\=ovector=0
11938 0: ab
11939    ab\=ovector=1
11940 0: ab
11941
11942/(?<=123)(*MARK:xx)abc/mark
11943    xxxx123a\=ph
11944Partial match, mark=xx: a
11945    xxxx123a\=ps
11946Partial match, mark=xx: a
11947
11948/123\Kabc/startchar
11949    xxxx123a\=ph
11950Partial match: 123a
11951    xxxx123a\=ps
11952Partial match: 123a
11953
11954/^(?(?=a)aa|bb)/auto_callout
11955    bb
11956--->bb
11957 +0 ^      ^
11958 +1 ^      (?
11959 +3 ^      (?=
11960 +6 ^      a
11961+11 ^      b
11962+12 ^^     b
11963+13 ^ ^    )
11964+14 ^ ^    End of pattern
11965 0: bb
11966
11967/(?C1)^(?C2)(?(?C99)(?=(?C3)a(?C4))(?C5)a(?C6)a(?C7)|(?C8)b(?C9)b(?C10))(?C11)/
11968    bb
11969--->bb
11970  1 ^      ^
11971  2 ^      (?
11972 99 ^      (?=
11973  3 ^      a
11974  8 ^      b
11975  9 ^^     b
11976 10 ^ ^    )
11977 11 ^ ^    End of pattern
11978 0: bb
11979
11980# Perl seems to have a bug with this one.
11981
11982/aaaaa(*COMMIT)(*PRUNE)b|a+c/
11983    aaaaaac
11984 0: aaaac
11985
11986# Here are some that Perl treats differently because of the way it handles
11987# backtracking verbs.
11988
11989/(?!a(*COMMIT)b)ac|ad/
11990     ac
11991 0: ac
11992     ad
11993 0: ad
11994
11995/^(?!a(*THEN)b|ac)../
11996     ad
11997 0: ad
11998\= Expect no match
11999     ac
12000No match
12001
12002/^(?=a(*THEN)b|ac)/
12003    ac
12004 0:
12005
12006/\A.*?(?:a|b(*THEN)c)/
12007    ba
12008 0: ba
12009
12010/\A.*?(?:a|b(*THEN)c)++/
12011    ba
12012 0: ba
12013
12014/\A.*?(?:a|b(*THEN)c|d)/
12015    ba
12016 0: ba
12017
12018/(?:(a(*MARK:X)a+(*SKIP:X)b)){0}(?:(?1)|aac)/
12019    aac
12020 0: aac
12021
12022/\A.*?(a|b(*THEN)c)/
12023    ba
12024 0: ba
12025 1: a
12026
12027/^(A(*THEN)B|A(*THEN)D)/
12028    AD
12029 0: AD
12030 1: AD
12031
12032/(?!b(*THEN)a)bn|bnn/
12033    bnn
12034 0: bn
12035
12036/(?(?=b(*SKIP)a)bn|bnn)/
12037    bnn
12038 0: bnn
12039
12040/(?=b(*THEN)a|)bn|bnn/
12041    bnn
12042 0: bn
12043
12044# This test causes a segfault with Perl 5.18.0
12045
12046/^(?=(a)){0}b(?1)/
12047    backgammon
12048 0: ba
12049
12050/(?|(?<n>f)|(?<n>b))/I,dupnames
12051Capture group count = 1
12052Named capture groups:
12053  n   1
12054Options: dupnames
12055Starting code units: b f
12056Subject length lower bound = 1
12057
12058/(?<a>abc)(?<a>z)\k<a>()/IB,dupnames
12059------------------------------------------------------------------
12060        Bra
12061        CBra 1
12062        abc
12063        Ket
12064        CBra 2
12065        z
12066        Ket
12067        \k<a>2
12068        CBra 3
12069        Ket
12070        Ket
12071        End
12072------------------------------------------------------------------
12073Capture group count = 3
12074Max back reference = 2
12075Named capture groups:
12076  a   1
12077  a   2
12078Options: dupnames
12079First code unit = 'a'
12080Last code unit = 'z'
12081Subject length lower bound = 5
12082
12083/a*[bcd]/B
12084------------------------------------------------------------------
12085        Bra
12086        a*+
12087        [b-d]
12088        Ket
12089        End
12090------------------------------------------------------------------
12091
12092/[bcd]*a/B
12093------------------------------------------------------------------
12094        Bra
12095        [b-d]*+
12096        a
12097        Ket
12098        End
12099------------------------------------------------------------------
12100
12101# A complete set of tests for auto-possessification of character types, but
12102# omitting \C because it might be disabled (it has its own tests).
12103
12104/\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
12105------------------------------------------------------------------
12106        Bra
12107        \D+
12108        \D
12109        \D++
12110        \d
12111        \D+
12112        \S
12113        \D+
12114        \s
12115        \D+
12116        \W
12117        \D+
12118        \w
12119        \D+
12120        Any
12121        \D+
12122        \R
12123        \D+
12124        \H
12125        \D+
12126        \h
12127        \D+
12128        \V
12129        \D+
12130        \v
12131        \D+
12132        \Z
12133        \D++
12134        \z
12135        \D+
12136        $
12137        Ket
12138        End
12139------------------------------------------------------------------
12140
12141/\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
12142------------------------------------------------------------------
12143        Bra
12144        \d++
12145        \D
12146        \d+
12147        \d
12148        \d+
12149        \S
12150        \d++
12151        \s
12152        \d++
12153        \W
12154        \d+
12155        \w
12156        \d+
12157        Any
12158        \d++
12159        \R
12160        \d+
12161        \H
12162        \d++
12163        \h
12164        \d+
12165        \V
12166        \d++
12167        \v
12168        \d++
12169        \Z
12170        \d++
12171        \z
12172        \d++
12173        $
12174        Ket
12175        End
12176------------------------------------------------------------------
12177
12178/\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
12179------------------------------------------------------------------
12180        Bra
12181        \S+
12182        \D
12183        \S+
12184        \d
12185        \S+
12186        \S
12187        \S++
12188        \s
12189        \S+
12190        \W
12191        \S+
12192        \w
12193        \S+
12194        Any
12195        \S++
12196        \R
12197        \S+
12198        \H
12199        \S++
12200        \h
12201        \S+
12202        \V
12203        \S++
12204        \v
12205        \S++
12206        \Z
12207        \S++
12208        \z
12209        \S++
12210        $
12211        Ket
12212        End
12213------------------------------------------------------------------
12214
12215/\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
12216------------------------------------------------------------------
12217        Bra
12218        \s+
12219        \D
12220        \s++
12221        \d
12222        \s++
12223        \S
12224        \s+
12225        \s
12226        \s+
12227        \W
12228        \s++
12229        \w
12230        \s+
12231        Any
12232        \s+
12233        \R
12234        \s+
12235        \H
12236        \s+
12237        \h
12238        \s+
12239        \V
12240        \s+
12241        \v
12242        \s+
12243        \Z
12244        \s++
12245        \z
12246        \s+
12247        $
12248        Ket
12249        End
12250------------------------------------------------------------------
12251
12252/\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
12253------------------------------------------------------------------
12254        Bra
12255        \W+
12256        \D
12257        \W++
12258        \d
12259        \W+
12260        \S
12261        \W+
12262        \s
12263        \W+
12264        \W
12265        \W++
12266        \w
12267        \W+
12268        Any
12269        \W+
12270        \R
12271        \W+
12272        \H
12273        \W+
12274        \h
12275        \W+
12276        \V
12277        \W+
12278        \v
12279        \W+
12280        \Z
12281        \W++
12282        \z
12283        \W+
12284        $
12285        Ket
12286        End
12287------------------------------------------------------------------
12288
12289/\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
12290------------------------------------------------------------------
12291        Bra
12292        \w+
12293        \D
12294        \w+
12295        \d
12296        \w+
12297        \S
12298        \w++
12299        \s
12300        \w++
12301        \W
12302        \w+
12303        \w
12304        \w+
12305        Any
12306        \w++
12307        \R
12308        \w+
12309        \H
12310        \w++
12311        \h
12312        \w+
12313        \V
12314        \w++
12315        \v
12316        \w++
12317        \Z
12318        \w++
12319        \z
12320        \w++
12321        $
12322        Ket
12323        End
12324------------------------------------------------------------------
12325
12326/\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
12327------------------------------------------------------------------
12328        Bra
12329        \R+
12330        \D
12331        \R++
12332        \d
12333        \R+
12334        \S
12335        \R++
12336        \s
12337        \R+
12338        \W
12339        \R++
12340        \w
12341        \R++
12342        Any
12343        \R+
12344        \R
12345        \R+
12346        \H
12347        \R++
12348        \h
12349        \R+
12350        \V
12351        \R+
12352        \v
12353        \R+
12354        \Z
12355        \R++
12356        \z
12357        \R+
12358        $
12359        Ket
12360        End
12361------------------------------------------------------------------
12362
12363/\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
12364------------------------------------------------------------------
12365        Bra
12366        \H+
12367        \D
12368        \H+
12369        \d
12370        \H+
12371        \S
12372        \H+
12373        \s
12374        \H+
12375        \W
12376        \H+
12377        \w
12378        \H+
12379        Any
12380        \H+
12381        \R
12382        \H+
12383        \H
12384        \H++
12385        \h
12386        \H+
12387        \V
12388        \H+
12389        \v
12390        \H+
12391        \Z
12392        \H++
12393        \z
12394        \H+
12395        $
12396        Ket
12397        End
12398------------------------------------------------------------------
12399
12400/\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
12401------------------------------------------------------------------
12402        Bra
12403        \h+
12404        \D
12405        \h++
12406        \d
12407        \h++
12408        \S
12409        \h+
12410        \s
12411        \h+
12412        \W
12413        \h++
12414        \w
12415        \h+
12416        Any
12417        \h++
12418        \R
12419        \h++
12420        \H
12421        \h+
12422        \h
12423        \h+
12424        \V
12425        \h++
12426        \v
12427        \h+
12428        \Z
12429        \h++
12430        \z
12431        \h+
12432        $
12433        Ket
12434        End
12435------------------------------------------------------------------
12436
12437/\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
12438------------------------------------------------------------------
12439        Bra
12440        \V+
12441        \D
12442        \V+
12443        \d
12444        \V+
12445        \S
12446        \V+
12447        \s
12448        \V+
12449        \W
12450        \V+
12451        \w
12452        \V+
12453        Any
12454        \V++
12455        \R
12456        \V+
12457        \H
12458        \V+
12459        \h
12460        \V+
12461        \V
12462        \V++
12463        \v
12464        \V+
12465        \Z
12466        \V++
12467        \z
12468        \V+
12469        $
12470        Ket
12471        End
12472------------------------------------------------------------------
12473
12474/\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
12475------------------------------------------------------------------
12476        Bra
12477        \v+
12478        \D
12479        \v++
12480        \d
12481        \v++
12482        \S
12483        \v+
12484        \s
12485        \v+
12486        \W
12487        \v++
12488        \w
12489        \v+
12490        Any
12491        \v+
12492        \R
12493        \v+
12494        \H
12495        \v++
12496        \h
12497        \v++
12498        \V
12499        \v+
12500        \v
12501        \v+
12502        \Z
12503        \v++
12504        \z
12505        \v+
12506        $
12507        Ket
12508        End
12509------------------------------------------------------------------
12510
12511/ 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
12512------------------------------------------------------------------
12513        Bra
12514        a+
12515        \D
12516        a++
12517        \d
12518        a+
12519        \S
12520        a++
12521        \s
12522        a++
12523        \W
12524        a+
12525        \w
12526        a+
12527        Any
12528        a++
12529        \R
12530        a+
12531        \H
12532        a++
12533        \h
12534        a+
12535        \V
12536        a++
12537        \v
12538        a++
12539        \Z
12540        a++
12541        \z
12542        a++
12543        $
12544        Ket
12545        End
12546------------------------------------------------------------------
12547
12548/\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
12549------------------------------------------------------------------
12550        Bra
12551        \x0a+
12552        \D
12553        \x0a++
12554        \d
12555        \x0a++
12556        \S
12557        \x0a+
12558        \s
12559        \x0a+
12560        \W
12561        \x0a++
12562        \w
12563        \x0a+
12564        Any
12565        \x0a+
12566        \R
12567        \x0a+
12568        \H
12569        \x0a++
12570        \h
12571        \x0a++
12572        \V
12573        \x0a+
12574        \v
12575        \x0a+
12576        \Z
12577        \x0a++
12578        \z
12579        \x0a+
12580        $
12581        Ket
12582        End
12583------------------------------------------------------------------
12584
12585/ .+\D  .+\d  .+\S  .+\s  .+\W  .+\w  .+.  .+\R  .+\H  .+\h  .+\V  .+\v  .+\Z  .+\z  .+$/Bx
12586------------------------------------------------------------------
12587        Bra
12588        Any+
12589        \D
12590        Any+
12591        \d
12592        Any+
12593        \S
12594        Any+
12595        \s
12596        Any+
12597        \W
12598        Any+
12599        \w
12600        Any+
12601        Any
12602        Any++
12603        \R
12604        Any+
12605        \H
12606        Any+
12607        \h
12608        Any+
12609        \V
12610        Any+
12611        \v
12612        Any+
12613        \Z
12614        Any++
12615        \z
12616        Any+
12617        $
12618        Ket
12619        End
12620------------------------------------------------------------------
12621
12622/ .+\D  .+\d  .+\S  .+\s  .+\W  .+\w  .+.  .+\R  .+\H  .+\h  .+\V  .+\v  .+\Z  .+\z  .+$/Bsx
12623------------------------------------------------------------------
12624        Bra
12625        AllAny+
12626        \D
12627        AllAny+
12628        \d
12629        AllAny+
12630        \S
12631        AllAny+
12632        \s
12633        AllAny+
12634        \W
12635        AllAny+
12636        \w
12637        AllAny+
12638        AllAny
12639        AllAny+
12640        \R
12641        AllAny+
12642        \H
12643        AllAny+
12644        \h
12645        AllAny+
12646        \V
12647        AllAny+
12648        \v
12649        AllAny+
12650        \Z
12651        AllAny++
12652        \z
12653        AllAny+
12654        $
12655        Ket
12656        End
12657------------------------------------------------------------------
12658
12659/ \D+$  \d+$  \S+$  \s+$  \W+$  \w+$  \R+$  \H+$  \h+$  \V+$ \v+$  a+$   \n+$  .+$  .+$/Bmx
12660------------------------------------------------------------------
12661        Bra
12662        \D+
12663     /m $
12664        \d++
12665     /m $
12666        \S++
12667     /m $
12668        \s+
12669     /m $
12670        \W+
12671     /m $
12672        \w++
12673     /m $
12674        \R+
12675     /m $
12676        \H+
12677     /m $
12678        \h+
12679     /m $
12680        \V+
12681     /m $
12682        \v+
12683     /m $
12684        a+
12685     /m $
12686        \x0a+
12687     /m $
12688        Any+
12689     /m $
12690        Any+
12691     /m $
12692        Ket
12693        End
12694------------------------------------------------------------------
12695
12696/(?=a+)a(a+)++a/B
12697------------------------------------------------------------------
12698        Bra
12699        Assert
12700        a++
12701        Ket
12702        a
12703        CBraPos 1
12704        a+
12705        KetRpos
12706        a
12707        Ket
12708        End
12709------------------------------------------------------------------
12710
12711/a+(bb|cc)a+(?:bb|cc)a+(?>bb|cc)a+(?:bb|cc)+a+(aa)a+(?:bb|aa)/B
12712------------------------------------------------------------------
12713        Bra
12714        a++
12715        CBra 1
12716        bb
12717        Alt
12718        cc
12719        Ket
12720        a++
12721        Bra
12722        bb
12723        Alt
12724        cc
12725        Ket
12726        a++
12727        Once
12728        bb
12729        Alt
12730        cc
12731        Ket
12732        a++
12733        Bra
12734        bb
12735        Alt
12736        cc
12737        KetRmax
12738        a+
12739        CBra 2
12740        aa
12741        Ket
12742        a+
12743        Bra
12744        bb
12745        Alt
12746        aa
12747        Ket
12748        Ket
12749        End
12750------------------------------------------------------------------
12751
12752/a+(bb|cc)?#a+(?:bb|cc)??#a+(?:bb|cc)?+#a+(?:bb|cc)*#a+(bb|cc)?a#a+(?:aa)?/B
12753------------------------------------------------------------------
12754        Bra
12755        a++
12756        Brazero
12757        CBra 1
12758        bb
12759        Alt
12760        cc
12761        Ket
12762        #
12763        a++
12764        Braminzero
12765        Bra
12766        bb
12767        Alt
12768        cc
12769        Ket
12770        #
12771        a++
12772        Once
12773        Brazero
12774        Bra
12775        bb
12776        Alt
12777        cc
12778        Ket
12779        Ket
12780        #
12781        a++
12782        Brazero
12783        Bra
12784        bb
12785        Alt
12786        cc
12787        KetRmax
12788        #
12789        a+
12790        Brazero
12791        CBra 2
12792        bb
12793        Alt
12794        cc
12795        Ket
12796        a#
12797        a+
12798        Brazero
12799        Bra
12800        aa
12801        Ket
12802        Ket
12803        End
12804------------------------------------------------------------------
12805
12806/a+(?:bb)?a#a+(?:|||)#a+(?:|b)a#a+(?:|||)?a/B
12807------------------------------------------------------------------
12808        Bra
12809        a+
12810        Brazero
12811        Bra
12812        bb
12813        Ket
12814        a#
12815        a++
12816        Bra
12817        Alt
12818        Alt
12819        Alt
12820        Ket
12821        #
12822        a+
12823        Bra
12824        Alt
12825        b
12826        Ket
12827        a#
12828        a+
12829        Brazero
12830        Bra
12831        Alt
12832        Alt
12833        Alt
12834        Ket
12835        a
12836        Ket
12837        End
12838------------------------------------------------------------------
12839
12840/[ab]*/B
12841------------------------------------------------------------------
12842        Bra
12843        [ab]*+
12844        Ket
12845        End
12846------------------------------------------------------------------
12847    aaaa
12848 0: aaaa
12849
12850/[ab]*?/B
12851------------------------------------------------------------------
12852        Bra
12853        [ab]*?
12854        Ket
12855        End
12856------------------------------------------------------------------
12857    aaaa
12858 0:
12859
12860/[ab]?/B
12861------------------------------------------------------------------
12862        Bra
12863        [ab]?+
12864        Ket
12865        End
12866------------------------------------------------------------------
12867    aaaa
12868 0: a
12869
12870/[ab]??/B
12871------------------------------------------------------------------
12872        Bra
12873        [ab]??
12874        Ket
12875        End
12876------------------------------------------------------------------
12877    aaaa
12878 0:
12879
12880/[ab]+/B
12881------------------------------------------------------------------
12882        Bra
12883        [ab]++
12884        Ket
12885        End
12886------------------------------------------------------------------
12887    aaaa
12888 0: aaaa
12889
12890/[ab]+?/B
12891------------------------------------------------------------------
12892        Bra
12893        [ab]+?
12894        Ket
12895        End
12896------------------------------------------------------------------
12897    aaaa
12898 0: a
12899
12900/[ab]{2,3}/B
12901------------------------------------------------------------------
12902        Bra
12903        [ab]{2,3}+
12904        Ket
12905        End
12906------------------------------------------------------------------
12907    aaaa
12908 0: aaa
12909
12910/[ab]{2,3}?/B
12911------------------------------------------------------------------
12912        Bra
12913        [ab]{2,3}?
12914        Ket
12915        End
12916------------------------------------------------------------------
12917    aaaa
12918 0: aa
12919
12920/[ab]{2,}/B
12921------------------------------------------------------------------
12922        Bra
12923        [ab]{2,}+
12924        Ket
12925        End
12926------------------------------------------------------------------
12927    aaaa
12928 0: aaaa
12929
12930/[ab]{2,}?/B
12931------------------------------------------------------------------
12932        Bra
12933        [ab]{2,}?
12934        Ket
12935        End
12936------------------------------------------------------------------
12937    aaaa
12938 0: aa
12939
12940/\d+\s{0,5}=\s*\S?=\w{0,4}\W*/B
12941------------------------------------------------------------------
12942        Bra
12943        \d++
12944        \s{0,5}+
12945        =
12946        \s*+
12947        \S?
12948        =
12949        \w{0,4}+
12950        \W*+
12951        Ket
12952        End
12953------------------------------------------------------------------
12954
12955/[a-d]{5,12}[e-z0-9]*#[^a-z]+[b-y]*a[2-7]?[^0-9a-z]+/B
12956------------------------------------------------------------------
12957        Bra
12958        [a-d]{5,12}+
12959        [0-9e-z]*+
12960        #
12961        [\x00-`{-\xff] (neg)++
12962        [b-y]*+
12963        a
12964        [2-7]?+
12965        [\x00-/:-`{-\xff] (neg)++
12966        Ket
12967        End
12968------------------------------------------------------------------
12969
12970/[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
12971------------------------------------------------------------------
12972        Bra
12973        [a-z]*+
12974        \s
12975        #
12976        [\x09 ]?+
12977        \S
12978        #
12979        [a-c]*
12980        \S
12981        #
12982        [C-G]++
12983        \d
12984        #
12985        [4-8]*+
12986        \D
12987        #
12988        [,4-9]*
12989        \D
12990        #
12991        [!$]{0,5}+
12992        \w
12993        #
12994        [M-Xf-l]++
12995        \W
12996        #
12997        [,a-c]?
12998        \W
12999        Ket
13000        End
13001------------------------------------------------------------------
13002
13003/a+(aa|bb)*c#a*(bb|cc)*a#a?(bb|cc)*d#[a-f]*(g|hh)*f/B
13004------------------------------------------------------------------
13005        Bra
13006        a+
13007        Brazero
13008        CBra 1
13009        aa
13010        Alt
13011        bb
13012        KetRmax
13013        c#
13014        a*
13015        Brazero
13016        CBra 2
13017        bb
13018        Alt
13019        cc
13020        KetRmax
13021        a#
13022        a?+
13023        Brazero
13024        CBra 3
13025        bb
13026        Alt
13027        cc
13028        KetRmax
13029        d#
13030        [a-f]*
13031        Brazero
13032        CBra 4
13033        g
13034        Alt
13035        hh
13036        KetRmax
13037        f
13038        Ket
13039        End
13040------------------------------------------------------------------
13041
13042/[a-f]*(g|hh|i)*i#[a-x]{4,}(y{0,6})*y#[a-k]+(ll|mm)+n/B
13043------------------------------------------------------------------
13044        Bra
13045        [a-f]*+
13046        Brazero
13047        CBra 1
13048        g
13049        Alt
13050        hh
13051        Alt
13052        i
13053        KetRmax
13054        i#
13055        [a-x]{4,}
13056        Brazero
13057        SCBra 2
13058        y{0,6}
13059        KetRmax
13060        y#
13061        [a-k]++
13062        CBra 3
13063        ll
13064        Alt
13065        mm
13066        KetRmax
13067        n
13068        Ket
13069        End
13070------------------------------------------------------------------
13071
13072/[a-f]*(?>gg|hh)+#[a-f]*(?>gg|hh)?#[a-f]*(?>gg|hh)*a#[a-f]*(?>gg|hh)*h/B
13073------------------------------------------------------------------
13074        Bra
13075        [a-f]*+
13076        Once
13077        gg
13078        Alt
13079        hh
13080        KetRmax
13081        #
13082        [a-f]*+
13083        Brazero
13084        Once
13085        gg
13086        Alt
13087        hh
13088        Ket
13089        #
13090        [a-f]*
13091        Brazero
13092        Once
13093        gg
13094        Alt
13095        hh
13096        KetRmax
13097        a#
13098        [a-f]*+
13099        Brazero
13100        Once
13101        gg
13102        Alt
13103        hh
13104        KetRmax
13105        h
13106        Ket
13107        End
13108------------------------------------------------------------------
13109
13110/[a-c]*d/IB
13111------------------------------------------------------------------
13112        Bra
13113        [a-c]*+
13114        d
13115        Ket
13116        End
13117------------------------------------------------------------------
13118Capture group count = 0
13119Starting code units: a b c d
13120Last code unit = 'd'
13121Subject length lower bound = 1
13122
13123/[a-c]+d/IB
13124------------------------------------------------------------------
13125        Bra
13126        [a-c]++
13127        d
13128        Ket
13129        End
13130------------------------------------------------------------------
13131Capture group count = 0
13132Starting code units: a b c
13133Last code unit = 'd'
13134Subject length lower bound = 2
13135
13136/[a-c]?d/IB
13137------------------------------------------------------------------
13138        Bra
13139        [a-c]?+
13140        d
13141        Ket
13142        End
13143------------------------------------------------------------------
13144Capture group count = 0
13145Starting code units: a b c d
13146Last code unit = 'd'
13147Subject length lower bound = 1
13148
13149/[a-c]{4,6}d/IB
13150------------------------------------------------------------------
13151        Bra
13152        [a-c]{4,6}+
13153        d
13154        Ket
13155        End
13156------------------------------------------------------------------
13157Capture group count = 0
13158Starting code units: a b c
13159Last code unit = 'd'
13160Subject length lower bound = 5
13161
13162/[a-c]{0,6}d/IB
13163------------------------------------------------------------------
13164        Bra
13165        [a-c]{0,6}+
13166        d
13167        Ket
13168        End
13169------------------------------------------------------------------
13170Capture group count = 0
13171Starting code units: a b c d
13172Last code unit = 'd'
13173Subject length lower bound = 1
13174
13175# End of special auto-possessive tests
13176
13177/^A\o{1239}B/
13178Failed: error 164 at offset 8: non-octal character in \o{} (closing brace missing?)
13179    A\123B
13180
13181/^A\oB/
13182Failed: error 155 at offset 4: missing opening brace after \o
13183
13184/^A\x{zz}B/
13185Failed: error 167 at offset 5: non-hex character in \x{} (closing brace missing?)
13186
13187/^A\x{12Z/
13188Failed: error 167 at offset 7: non-hex character in \x{} (closing brace missing?)
13189
13190/^A\x{/
13191Failed: error 178 at offset 5: digits missing in \x{} or \o{} or \N{U+}
13192
13193/[ab]++/B,no_auto_possess
13194------------------------------------------------------------------
13195        Bra
13196        [ab]++
13197        Ket
13198        End
13199------------------------------------------------------------------
13200
13201/[^ab]*+/B,no_auto_possess
13202------------------------------------------------------------------
13203        Bra
13204        [\x00-`c-\xff] (neg)*+
13205        Ket
13206        End
13207------------------------------------------------------------------
13208
13209/a{4}+/B,no_auto_possess
13210------------------------------------------------------------------
13211        Bra
13212        a{4}
13213        Ket
13214        End
13215------------------------------------------------------------------
13216
13217/a{4}+/Bi,no_auto_possess
13218------------------------------------------------------------------
13219        Bra
13220     /i a{4}
13221        Ket
13222        End
13223------------------------------------------------------------------
13224
13225/[a-[:digit:]]+/
13226Failed: error 150 at offset 4: invalid range in character class
13227
13228/[A-[:digit:]]+/
13229Failed: error 150 at offset 4: invalid range in character class
13230
13231/[a-[.xxx.]]+/
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 108 at offset 3: range out of order in character class
13239
13240/[A-[!xxx!]]+/
13241    A]]]
13242 0: A]]]
13243
13244/[a-\d]+/
13245Failed: error 150 at offset 5: invalid range in character class
13246
13247/(?<0abc>xx)/
13248Failed: error 144 at offset 3: subpattern name must start with a non-digit
13249
13250/(?&1abc)xx(?<1abc>y)/
13251Failed: error 144 at offset 3: subpattern name must start with a non-digit
13252
13253/(?<ab-cd>xx)/
13254Failed: error 142 at offset 5: syntax error in subpattern name (missing terminator?)
13255
13256/(?'0abc'xx)/
13257Failed: error 144 at offset 3: subpattern name must start with a non-digit
13258
13259/(?P<0abc>xx)/
13260Failed: error 144 at offset 4: subpattern name must start with a non-digit
13261
13262/\k<5ghj>/
13263Failed: error 144 at offset 3: 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{2fgh}/
13269Failed: error 144 at offset 3: subpattern name must start with a non-digit
13270
13271/(?P=8yuki)/
13272Failed: error 144 at offset 4: subpattern name must start with a non-digit
13273
13274/\g{4df}/
13275Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
13276
13277/(?&1abc)xx(?<1abc>y)/
13278Failed: error 144 at offset 3: subpattern name must start with a non-digit
13279
13280/(?P>1abc)xx(?<1abc>y)/
13281Failed: error 144 at offset 4: subpattern name must start with a non-digit
13282
13283/\g'3gh'/
13284Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
13285
13286/\g<5fg>/
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/(?(<4gh>)abc)/
13290Failed: error 144 at offset 4: subpattern name must start with a non-digit
13291
13292/(?('4gh')abc)/
13293Failed: error 144 at offset 4: subpattern name must start with a non-digit
13294
13295/(?(4gh)abc)/
13296Failed: error 124 at offset 4: missing closing parenthesis for condition
13297
13298/(?(R&6yh)abc)/
13299Failed: error 144 at offset 5: subpattern name must start with a non-digit
13300
13301/(((a\2)|(a*)\g<-1>))*a?/B
13302------------------------------------------------------------------
13303        Bra
13304        Brazero
13305        SCBra 1
13306        CBra 2
13307        CBra 3
13308        a
13309        \2
13310        Ket
13311        Alt
13312        CBra 4
13313        a*
13314        Ket
13315        Recurse
13316        Ket
13317        KetRmax
13318        a?+
13319        Ket
13320        End
13321------------------------------------------------------------------
13322
13323# Test the ugly "start or end of word" compatibility syntax.
13324
13325/[[:<:]]red[[:>:]]/B
13326------------------------------------------------------------------
13327        Bra
13328        \b
13329        Assert
13330        \w
13331        Ket
13332        red
13333        \b
13334        Assert back
13335        Reverse
13336        \w
13337        Ket
13338        Ket
13339        End
13340------------------------------------------------------------------
13341    little red riding hood
13342 0: red
13343    a /red/ thing
13344 0: red
13345    red is a colour
13346 0: red
13347    put it all on red
13348 0: red
13349\= Expect no match
13350    no reduction
13351No match
13352    Alfred Winifred
13353No match
13354
13355/[a[:<:]] should give error/
13356Failed: error 130 at offset 4: unknown POSIX class name
13357
13358/(?=ab\K)/aftertext,allow_lookaround_bsk
13359    abcd\=startchar
13360Start of matched string is beyond its end - displaying from end to start.
13361 0: ab
13362 0+ abcd
13363
13364/abcd/newline=lf,firstline
13365\= Expect no match
13366    xx\nxabcd
13367No match
13368
13369# Test stack guard external calls.
13370
13371/(((a)))/stackguard=1
13372Failed: error 133 at offset 7: parentheses are too deeply nested (stack check)
13373
13374/(((a)))/stackguard=2
13375Failed: error 133 at offset 7: parentheses are too deeply nested (stack check)
13376
13377/(((a)))/stackguard=3
13378
13379/(((((a)))))/
13380
13381# End stack guard tests
13382
13383/^\w+(?>\s*)(?<=\w)/B
13384------------------------------------------------------------------
13385        Bra
13386        ^
13387        \w+
13388        Once
13389        \s*+
13390        Ket
13391        Assert back
13392        Reverse
13393        \w
13394        Ket
13395        Ket
13396        End
13397------------------------------------------------------------------
13398
13399/\othing/
13400Failed: error 155 at offset 2: missing opening brace after \o
13401
13402/\o{}/
13403Failed: error 178 at offset 3: digits missing in \x{} or \o{} or \N{U+}
13404
13405/\o{whatever}/
13406Failed: error 164 at offset 3: non-octal character in \o{} (closing brace missing?)
13407
13408/\xthing/
13409
13410/\x{}/
13411Failed: error 178 at offset 3: digits missing in \x{} or \o{} or \N{U+}
13412
13413/\x{whatever}/
13414Failed: error 167 at offset 3: non-hex character in \x{} (closing brace missing?)
13415
13416/A\8B/
13417Failed: error 115 at offset 2: reference to non-existent subpattern
13418
13419/A\9B/
13420Failed: error 115 at offset 2: reference to non-existent subpattern
13421
13422# This one is here because Perl fails to match "12" for this pattern when the $
13423# is present.
13424
13425/^(?(?=abc)\w{3}:|\d\d)$/
13426    abc:
13427 0: abc:
13428    12
13429 0: 12
13430\= Expect no match
13431    123
13432No match
13433    xyz
13434No match
13435
13436# Perl gets this one wrong, giving "a" as the after text for ca and failing to
13437# match for cd.
13438
13439/(?(?=ab)ab)/aftertext
13440    abxxx
13441 0: ab
13442 0+ xxx
13443    ca
13444 0:
13445 0+ ca
13446    cd
13447 0:
13448 0+ cd
13449
13450# This should test both paths for processing OP_RECURSE.
13451
13452/(?(R)a+|(?R)b)/
13453    aaaabcde
13454 0: aaaab
13455    aaaabcde\=ovector=100
13456 0: aaaab
13457
13458/a*?b*?/
13459    ab
13460 0:
13461
13462/(*NOTEMPTY)a*?b*?/
13463    ab
13464 0: a
13465    ba
13466 0: b
13467    cb
13468 0: b
13469
13470/(*NOTEMPTY_ATSTART)a*?b*?/aftertext
13471    ab
13472 0: a
13473 0+ b
13474    cdab
13475 0:
13476 0+ dab
13477
13478/(?(VERSION>=10.0)yes|no)/I
13479Capture group count = 0
13480Subject length lower bound = 2
13481    yesno
13482 0: yes
13483
13484/(?(VERSION>=10.04)yes|no)/
13485    yesno
13486 0: yes
13487
13488/(?(VERSION=8)yes){3}/BI,aftertext
13489------------------------------------------------------------------
13490        Bra
13491        Cond
13492        Cond false
13493        yes
13494        Ket
13495        Ket
13496        End
13497------------------------------------------------------------------
13498Capture group count = 0
13499May match empty string
13500Subject length lower bound = 0
13501    yesno
13502 0:
13503 0+ yesno
13504
13505/(?(VERSION=8)yes|no){3}/I
13506Capture group count = 0
13507Subject length lower bound = 6
13508    yesnononoyes
13509 0: nonono
13510\= Expect no match
13511    yesno
13512No match
13513
13514/(?:(?<VERSION>abc)|xyz)(?(VERSION)yes|no)/I
13515Capture group count = 1
13516Max back reference = 1
13517Named capture groups:
13518  VERSION   1
13519Starting code units: a x
13520Subject length lower bound = 5
13521    abcyes
13522 0: abcyes
13523 1: abc
13524    xyzno
13525 0: xyzno
13526\= Expect no match
13527    abcno
13528No match
13529    xyzyes
13530No match
13531
13532/(?(VERSION<10)yes|no)/
13533Failed: error 179 at offset 10: syntax error or number too big in (?(VERSION condition
13534
13535/(?(VERSION>10)yes|no)/
13536Failed: error 179 at offset 11: syntax error or number too big in (?(VERSION condition
13537
13538/(?(VERSION>=10.0.0)yes|no)/
13539Failed: error 179 at offset 16: syntax error or number too big in (?(VERSION condition
13540
13541/(?(VERSION=10.101)yes|no)/
13542Failed: error 179 at offset 16: syntax error or number too big in (?(VERSION condition
13543
13544/abcd/I
13545Capture group count = 0
13546First code unit = 'a'
13547Last code unit = 'd'
13548Subject length lower bound = 4
13549
13550/abcd/I,no_start_optimize
13551Capture group count = 0
13552Options: no_start_optimize
13553
13554/(|ab)*?d/I
13555Capture group count = 1
13556Starting code units: a d
13557Last code unit = 'd'
13558Subject length lower bound = 1
13559   abd
13560 0: abd
13561 1: ab
13562   xyd
13563 0: d
13564
13565/(|ab)*?d/I,no_start_optimize
13566Capture group count = 1
13567Options: no_start_optimize
13568   abd
13569 0: abd
13570 1: ab
13571   xyd
13572 0: d
13573
13574/\k<A>*(?<A>aa)(?<A>bb)/match_unset_backref,dupnames
13575    aabb
13576 0: aabb
13577 1: aa
13578 2: bb
13579
13580/(((((a)))))/parens_nest_limit=2
13581Failed: error 119 at offset 3: parentheses are too deeply nested
13582
13583/abc/replace=XYZ
13584    123123
13585 0: 123123
13586    123abc123
13587 1: 123XYZ123
13588    123abc123abc123
13589 1: 123XYZ123abc123
13590    123123\=zero_terminate
13591 0: 123123
13592    123abc123\=zero_terminate
13593 1: 123XYZ123
13594    123abc123abc123\=zero_terminate
13595 1: 123XYZ123abc123
13596
13597/abc/g,replace=XYZ
13598    123abc123
13599 1: 123XYZ123
13600    123abc123abc123
13601 2: 123XYZ123XYZ123
13602
13603/abc/replace=X$$Z
13604    123abc123
13605 1: 123X$Z123
13606
13607/abc/g,replace=X$$Z
13608    123abc123abc123
13609 2: 123X$Z123X$Z123
13610
13611/a(b)c(d)e/replace=X$1Y${2}Z
13612    "abcde"
13613 1: "XbYdZ"
13614
13615/a(b)c(d)e/replace=X$1Y${2}Z,global
13616    "abcde-abcde"
13617 2: "XbYdZ-XbYdZ"
13618
13619/a(?<ONE>b)c(?<TWO>d)e/replace=X$ONE+${TWO}Z
13620    "abcde"
13621 1: "Xb+dZ"
13622
13623/a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z
13624    "abcde-abcde-"
13625 2: "Xb+dZ-Xb+dZ-"
13626
13627/abc/replace=a$++
13628    123abc
13629Failed: error -35 at offset 2 in replacement: invalid replacement string
13630
13631/abc/replace=a$bad
13632    123abc
13633Failed: error -49 at offset 5 in replacement: unknown substring
13634
13635/abc/replace=a${A234567890123456789_123456789012}z
13636    123abc
13637Failed: error -49 at offset 36 in replacement: unknown substring
13638
13639/abc/replace=a${A23456789012345678901234567890123}z
13640    123abc
13641Failed: error -35 at offset 35 in replacement: invalid replacement string
13642
13643/abc/replace=a${bcd
13644    123abc
13645Failed: error -58 at offset 6 in replacement: expected closing curly bracket in replacement string
13646
13647/abc/replace=a${b+d}z
13648    123abc
13649Failed: error -58 at offset 4 in replacement: expected closing curly bracket in replacement string
13650
13651/abc/replace=[10]XYZ
13652    123abc123
13653 1: 123XYZ123
13654
13655/abc/replace=[9]XYZ
13656    123abc123
13657Failed: error -48: no more memory
13658
13659/abc/replace=xyz
13660    1abc2\=partial_hard
13661Failed: error -34: bad option value
13662
13663/abc/replace=xyz
13664    123abc456
13665 1: 123xyz456
13666    123abc456\=replace=pqr
13667 1: 123pqr456
13668    123abc456abc789
13669 1: 123xyz456abc789
13670    123abc456abc789\=g
13671 2: 123xyz456xyz789
13672
13673/(?<=abc)(|def)/g,replace=<$0>
13674    123abcxyzabcdef789abcpqr
13675 4: 123abc<>xyzabc<><def>789abc<>pqr
13676
13677/./replace=$0
13678    a
13679 1: a
13680
13681/(.)(.)/replace=$2+$1
13682    abc
13683 1: b+ac
13684
13685/(?<A>.)(?<B>.)/replace=$B+$A
13686    abc
13687 1: b+ac
13688
13689/(.)(.)/g,replace=$2$1
13690    abcdefgh
13691 4: badcfehg
13692
13693/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=${*MARK}
13694    apple lemon blackberry
13695 3: pear orange strawberry
13696    apple strudel
13697 1: pear strudel
13698    fruitless
13699 0: fruitless
13700
13701/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} sauce,
13702    apple lemon blackberry
13703 1: pear sauce lemon blackberry
13704
13705/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK>
13706    apple lemon blackberry
13707 3: <pear> <orange> <strawberry>
13708    apple strudel
13709 1: <pear> strudel
13710    fruitless
13711 0: fruitless
13712
13713/(*:pear)apple/g,replace=${*MARKING}
13714    apple lemon blackberry
13715Failed: error -35 at offset 11 in replacement: invalid replacement string
13716
13717/(*:pear)apple/g,replace=${*MARK-time
13718    apple lemon blackberry
13719Failed: error -58 at offset 7 in replacement: expected closing curly bracket in replacement string
13720
13721/(*:pear)apple/g,replace=${*mark}
13722    apple lemon blackberry
13723Failed: error -35 at offset 8 in replacement: invalid replacement string
13724
13725/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARKET>
13726    apple lemon blackberry
13727Failed: error -35 at offset 9 in replacement: invalid replacement string
13728
13729/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[22]${*MARK}
13730    apple lemon blackberry
13731Failed: error -48: no more memory
13732    apple lemon blackberry\=substitute_overflow_length
13733Failed: error -48: no more memory: 23 code units are needed
13734
13735/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=[23]${*MARK}
13736    apple lemon blackberry
13737 3: pear orange strawberry
13738
13739/abc/
13740    123abc123\=replace=[9]XYZ
13741Failed: error -48: no more memory
13742    123abc123\=substitute_overflow_length,replace=[9]XYZ
13743Failed: error -48: no more memory: 10 code units are needed
13744    123abc123\=substitute_overflow_length,replace=[6]XYZ
13745Failed: error -48: no more memory: 10 code units are needed
13746    123abc123\=substitute_overflow_length,replace=[1]XYZ
13747Failed: error -48: no more memory: 10 code units are needed
13748    123abc123\=substitute_overflow_length,replace=[0]XYZ
13749Failed: error -48: no more memory: 10 code units are needed
13750
13751/a(b)c/
13752    123abc123\=replace=[9]x$1z
13753Failed: error -48: no more memory
13754    123abc123\=substitute_overflow_length,replace=[9]x$1z
13755Failed: error -48: no more memory: 10 code units are needed
13756    123abc123\=substitute_overflow_length,replace=[6]x$1z
13757Failed: error -48: no more memory: 10 code units are needed
13758    123abc123\=substitute_overflow_length,replace=[1]x$1z
13759Failed: error -48: no more memory: 10 code units are needed
13760    123abc123\=substitute_overflow_length,replace=[0]x$1z
13761Failed: error -48: no more memory: 10 code units are needed
13762
13763"((?=(?(?=(?(?=(?(?=()))))))))"
13764    a
13765 0:
13766 1:
13767 2:
13768
13769"(?(?=)==)(((((((((?=)))))))))"
13770\= Expect no match
13771    a
13772No match
13773
13774/(a)(b)|(c)/
13775    XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
13776Matched, but too many substrings
13777 0: c
13778 1: <unset>
13779Get substring 1 failed (-55): requested value is not set
13780Get substring 2 failed (-54): requested value is not available
13781Get substring 3 failed (-54): requested value is not available
13782Get substring 4 failed (-49): unknown substring
13783 0L c
13784 1L
13785
13786/x(?=ab\K)/allow_lookaround_bsk
13787    xab\=get=0
13788Start of matched string is beyond its end - displaying from end to start.
13789 0: ab
13790 0G  (0)
13791    xab\=copy=0
13792Start of matched string is beyond its end - displaying from end to start.
13793 0: ab
13794 0C  (0)
13795    xab\=getall
13796Start of matched string is beyond its end - displaying from end to start.
13797 0: ab
13798 0L
13799
13800/(?<A>a)|(?<A>b)/dupnames
13801    a\=ovector=1,copy=A,get=A,get=2
13802Matched, but too many substrings
13803 0: a
13804Copy substring 'A' failed (-54): requested value is not available
13805Get substring 2 failed (-54): requested value is not available
13806Get substring 'A' failed (-54): requested value is not available
13807    a\=ovector=2,copy=A,get=A,get=2
13808 0: a
13809 1: a
13810  C a (1) A (non-unique)
13811Get substring 2 failed (-54): requested value is not available
13812  G a (1) A (non-unique)
13813    b\=ovector=2,copy=A,get=A,get=2
13814Matched, but too many substrings
13815 0: b
13816 1: <unset>
13817Copy substring 'A' failed (-55): requested value is not set
13818Get substring 2 failed (-54): requested value is not available
13819Get substring 'A' failed (-55): requested value is not set
13820
13821/a(b)c(d)/
13822    abc\=ph,copy=0,copy=1,getall
13823Partial match: abc
13824 0C abc (3)
13825Copy substring 1 failed (-2): partial match
13826get substring list failed (-2): partial match
13827
13828/^abc/info
13829Capture group count = 0
13830Compile options: <none>
13831Overall options: anchored
13832First code unit = 'a'
13833Subject length lower bound = 3
13834
13835/^abc/info,no_dotstar_anchor
13836Capture group count = 0
13837Compile options: no_dotstar_anchor
13838Overall options: anchored no_dotstar_anchor
13839First code unit = 'a'
13840Subject length lower bound = 3
13841
13842/.*\d/info,auto_callout
13843Capture group count = 0
13844Options: auto_callout
13845First code unit at start or follows newline
13846Subject length lower bound = 1
13847\= Expect no match
13848    aaa
13849--->aaa
13850 +0 ^       .*
13851 +2 ^  ^    \d
13852 +2 ^ ^     \d
13853 +2 ^^      \d
13854 +2 ^       \d
13855No match
13856
13857/.*\d/info,no_dotstar_anchor,auto_callout
13858Capture group count = 0
13859Options: auto_callout no_dotstar_anchor
13860Subject length lower bound = 1
13861\= Expect no match
13862    aaa
13863--->aaa
13864 +0 ^       .*
13865 +2 ^  ^    \d
13866 +2 ^ ^     \d
13867 +2 ^^      \d
13868 +2 ^       \d
13869 +0  ^      .*
13870 +2  ^ ^    \d
13871 +2  ^^     \d
13872 +2  ^      \d
13873 +0   ^     .*
13874 +2   ^^    \d
13875 +2   ^     \d
13876No match
13877
13878/.*\d/dotall,info
13879Capture group count = 0
13880Compile options: dotall
13881Overall options: anchored dotall
13882Subject length lower bound = 1
13883
13884/.*\d/dotall,no_dotstar_anchor,info
13885Capture group count = 0
13886Options: dotall no_dotstar_anchor
13887Subject length lower bound = 1
13888
13889/(*NO_DOTSTAR_ANCHOR)(?s).*\d/info
13890Capture group count = 0
13891Compile options: <none>
13892Overall options: no_dotstar_anchor
13893Subject length lower bound = 1
13894
13895'^(?:(a)|b)(?(1)A|B)'
13896    aA123\=ovector=1
13897Matched, but too many substrings
13898 0: aA
13899    aA123\=ovector=2
13900 0: aA
13901 1: a
13902
13903'^(?:(?<AA>a)|b)(?(<AA>)A|B)'
13904    aA123\=ovector=1
13905Matched, but too many substrings
13906 0: aA
13907    aA123\=ovector=2
13908 0: aA
13909 1: a
13910
13911'^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'dupnames
13912    aA123\=ovector=1
13913Matched, but too many substrings
13914 0: aA
13915    aA123\=ovector=2
13916Matched, but too many substrings
13917 0: aA
13918 1:
13919    aA123\=ovector=3
13920 0: aA
13921 1:
13922 2: a
13923
13924'^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'dupnames
13925    aa123\=ovector=1
13926Matched, but too many substrings
13927 0: aa
13928    aa123\=ovector=2
13929Matched, but too many substrings
13930 0: aa
13931 1: <unset>
13932    aa123\=ovector=3
13933 0: aa
13934 1: <unset>
13935 2: a
13936
13937/(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
13938
13939/(?<N>(?J)(?<N>))(?-J)\k<N>/
13940
13941# Quantifiers are not allowed on condition assertions, but are otherwise
13942# OK in conditions.
13943
13944/(?(?=0)?)+/
13945Failed: error 109 at offset 7: quantifier does not follow a repeatable item
13946
13947/(?(?=0)(?=00)?00765)/
13948     00765
13949 0: 00765
13950
13951/(?(?=0)(?=00)?00765|(?!3).56)/
13952     00765
13953 0: 00765
13954     456
13955 0: 456
13956\= Expect no match
13957     356
13958No match
13959
13960'^(a)*+(\w)'
13961    g
13962 0: g
13963 1: <unset>
13964 2: g
13965    g\=ovector=1
13966Matched, but too many substrings
13967 0: g
13968
13969'^(?:a)*+(\w)'
13970    g
13971 0: g
13972 1: g
13973    g\=ovector=1
13974Matched, but too many substrings
13975 0: g
13976
13977# These two pattern showeds up compile-time bugs
13978
13979"((?2){0,1999}())?"
13980
13981/((?+1)(\1))/B
13982------------------------------------------------------------------
13983        Bra
13984        CBra 1
13985        Recurse
13986        CBra 2
13987        \1
13988        Ket
13989        Ket
13990        Ket
13991        End
13992------------------------------------------------------------------
13993
13994# Callouts with string arguments
13995
13996/a(?C"/
13997Failed: error 181 at offset 4: missing terminating delimiter for callout with string argument
13998
13999/a(?C"a/
14000Failed: error 181 at offset 4: missing terminating delimiter for callout with string argument
14001
14002/a(?C"a"/
14003Failed: error 139 at offset 7: closing parenthesis for (?C expected
14004
14005/a(?C"a"bcde(?C"b")xyz/
14006Failed: error 139 at offset 7: closing parenthesis for (?C expected
14007
14008/a(?C"a)b""c")/B
14009------------------------------------------------------------------
14010        Bra
14011        a
14012        CalloutStr "a)b"c" 5 13 0
14013        Ket
14014        End
14015------------------------------------------------------------------
14016
14017/ab(?C" any text with spaces ")cde/B
14018------------------------------------------------------------------
14019        Bra
14020        ab
14021        CalloutStr " any text with spaces " 6 30 1
14022        cde
14023        Ket
14024        End
14025------------------------------------------------------------------
14026    abcde
14027Callout (6): " any text with spaces "
14028--->abcde
14029    ^ ^       c
14030 0: abcde
14031    12abcde
14032Callout (6): " any text with spaces "
14033--->12abcde
14034      ^ ^       c
14035 0: abcde
14036
14037/^a(b)c(?C1)def/
14038      abcdef
14039--->abcdef
14040  1 ^  ^       d
14041 0: abcdef
14042 1: b
14043
14044/^a(b)c(?C"AB")def/
14045      abcdef
14046Callout (10): "AB"
14047--->abcdef
14048    ^  ^       d
14049 0: abcdef
14050 1: b
14051
14052/^a(b)c(?C1)def/
14053      abcdef\=callout_capture
14054Callout 1: last capture = 1
14055 1: b
14056--->abcdef
14057    ^  ^       d
14058 0: abcdef
14059 1: b
14060
14061/^a(b)c(?C{AB})def/B
14062------------------------------------------------------------------
14063        Bra
14064        ^
14065        a
14066        CBra 1
14067        b
14068        Ket
14069        c
14070        CalloutStr {AB} 10 14 1
14071        def
14072        Ket
14073        End
14074------------------------------------------------------------------
14075      abcdef\=callout_capture
14076Callout (10): {AB} last capture = 1
14077 1: b
14078--->abcdef
14079    ^  ^       d
14080 0: abcdef
14081 1: b
14082
14083/(?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
14084------------------------------------------------------------------
14085        Bra
14086        CalloutStr `a`b` 4 10 0
14087        CalloutStr 'a'b' 14 20 0
14088        CalloutStr "a"b" 24 30 0
14089        CalloutStr ^a^b^ 34 40 0
14090        CalloutStr %a%b% 44 50 0
14091        CalloutStr #a#b# 54 60 0
14092        CalloutStr $a$b$ 64 70 0
14093        CalloutStr {a}b} 74 80 0
14094        Ket
14095        End
14096------------------------------------------------------------------
14097Callout `a`b`  (
14098Callout 'a'b'  (
14099Callout "a"b"  (
14100Callout ^a^b^  (
14101Callout %a%b%  (
14102Callout #a#b#  (
14103Callout $a$b$  (
14104Callout {a}b}
14105
14106/(?:a(?C`code`)){3}/B
14107------------------------------------------------------------------
14108        Bra
14109        Bra
14110        a
14111        CalloutStr `code` 8 14 4
14112        Ket
14113        Bra
14114        a
14115        CalloutStr `code` 8 14 4
14116        Ket
14117        Bra
14118        a
14119        CalloutStr `code` 8 14 4
14120        Ket
14121        Ket
14122        End
14123------------------------------------------------------------------
14124
14125/^(?(?C25)(?=abc)abcd|xyz)/B,callout_info
14126------------------------------------------------------------------
14127        Bra
14128        ^
14129        Cond
14130        Callout 25 9 3
14131        Assert
14132        abc
14133        Ket
14134        abcd
14135        Alt
14136        xyz
14137        Ket
14138        Ket
14139        End
14140------------------------------------------------------------------
14141Callout 25  (?=
14142    abcdefg
14143--->abcdefg
14144 25 ^           (?=
14145 0: abcd
14146    xyz123
14147--->xyz123
14148 25 ^          (?=
14149 0: xyz
14150
14151/^(?(?C$abc$)(?=abc)abcd|xyz)/B
14152------------------------------------------------------------------
14153        Bra
14154        ^
14155        Cond
14156        CalloutStr $abc$ 7 12 3
14157        Assert
14158        abc
14159        Ket
14160        abcd
14161        Alt
14162        xyz
14163        Ket
14164        Ket
14165        End
14166------------------------------------------------------------------
14167    abcdefg
14168Callout (7): $abc$
14169--->abcdefg
14170    ^           (?=
14171 0: abcd
14172    xyz123
14173Callout (7): $abc$
14174--->xyz123
14175    ^          (?=
14176 0: xyz
14177
14178/^ab(?C'first')cd(?C"second")ef/
14179    abcdefg
14180Callout (7): 'first'
14181--->abcdefg
14182    ^ ^         c
14183Callout (20): "second"
14184--->abcdefg
14185    ^   ^       e
14186 0: abcdef
14187
14188/(?:a(?C`code`)){3}X/
14189    aaaXY
14190Callout (8): `code`
14191--->aaaXY
14192    ^^        ){3}
14193Callout (8): `code`
14194--->aaaXY
14195    ^ ^       ){3}
14196Callout (8): `code`
14197--->aaaXY
14198    ^  ^      ){3}
14199 0: aaaX
14200
14201# Binary zero in callout string
14202#  a  (  ?  C  '  x     z  '  )  b
14203/ 61 28 3f 43 27 78 00 7a 27 29 62/hex,callout_info
14204Callout 'x\x00z'  b
14205    abcdefgh
14206Callout (5): 'x\x00z'
14207--->abcdefgh
14208    ^^           b
14209 0: ab
14210
14211/(?(?!)^)/
14212
14213/(?(?!)a|b)/
14214    bbb
14215 0: b
14216\= Expect no match
14217    aaa
14218No match
14219
14220# JIT gives a different error message for the infinite recursion
14221
14222"(*NO_JIT)((?2)+)((?1)){"
14223    abcd{
14224Failed: error -52: nested recursion at the same subject position
14225
14226# Perl fails to diagnose the absence of an assertion
14227
14228"(?(?<E>.*!.*)?)"
14229Failed: error 128 at offset 2: assertion expected after (?( or (?(?C)
14230
14231"X((?2)()*+){2}+"B
14232------------------------------------------------------------------
14233        Bra
14234        X
14235        Once
14236        CBra 1
14237        Recurse
14238        Braposzero
14239        SCBraPos 2
14240        KetRpos
14241        Ket
14242        CBra 1
14243        Recurse
14244        Braposzero
14245        SCBraPos 2
14246        KetRpos
14247        Ket
14248        Ket
14249        Ket
14250        End
14251------------------------------------------------------------------
14252
14253"X((?2)()*+){2}"B
14254------------------------------------------------------------------
14255        Bra
14256        X
14257        CBra 1
14258        Recurse
14259        Braposzero
14260        SCBraPos 2
14261        KetRpos
14262        Ket
14263        CBra 1
14264        Recurse
14265        Braposzero
14266        SCBraPos 2
14267        KetRpos
14268        Ket
14269        Ket
14270        End
14271------------------------------------------------------------------
14272
14273/(?<=\bABQ(3(?-7)))/
14274Failed: error 115 at offset 15: reference to non-existent subpattern
14275
14276/(?<=\bABQ(3(?+7)))/
14277Failed: error 115 at offset 15: reference to non-existent subpattern
14278
14279";(?<=()((?3))((?2)))"
14280Failed: error 125 at offset 1: lookbehind assertion is not fixed length
14281
14282# Perl loops on this (PCRE2 used to!)
14283
14284/(?<=\Ka)/g,aftertext,allow_lookaround_bsk
14285    aaaaa
14286 0: a
14287 0+ aaaa
14288 0: a
14289 0+ aaa
14290 0: a
14291 0+ aa
14292 0: a
14293 0+ a
14294 0: a
14295 0+
14296
14297/(?<=\Ka)/altglobal,aftertext,allow_lookaround_bsk
14298    aaaaa
14299 0: a
14300 0+ aaaa
14301 0: a
14302 0+ aaa
14303 0: a
14304 0+ aa
14305 0: a
14306 0+ a
14307 0: a
14308 0+
14309
14310/((?2){73}(?2))((?1))/info
14311Capture group count = 2
14312May match empty string
14313Subject length lower bound = 0
14314
14315/abc/
14316\= Expect no match
14317    \[9x!xxx(]{9999}
14318No match
14319
14320/(abc)*/
14321    \[abc]{5}
14322 0: abcabcabcabcabc
14323 1: abc
14324
14325/^/gm
14326    \n\n\n
14327 0:
14328 0:
14329 0:
14330
14331/^/gm,alt_circumflex
14332    \n\n\n
14333 0:
14334 0:
14335 0:
14336 0:
14337
14338/((((((((x))))))))\81/
14339Failed: error 115 at offset 19: reference to non-existent subpattern
14340    xx1
14341
14342/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\80/
14343    xx
14344Matched, but too many substrings
14345 0: xx
14346 1: x
14347 2: x
14348 3: x
14349 4: x
14350 5: x
14351 6: x
14352 7: x
14353 8: x
14354 9: x
1435510: x
1435611: x
1435712: x
1435813: x
1435914: x
14360
14361/\80/
14362Failed: error 115 at offset 2: reference to non-existent subpattern
14363
14364/A\8B\9C/
14365Failed: error 115 at offset 2: reference to non-existent subpattern
14366    A8B9C
14367
14368/(?x:((?'a')) # comment (with parentheses) and | vertical
14369(?-x:#not a comment (?'b')) # this is a comment ()
14370(?'c')) # not a comment (?'d')/info
14371Capture group count = 5
14372Named capture groups:
14373  a   2
14374  b   3
14375  c   4
14376  d   5
14377First code unit = '#'
14378Last code unit = ' '
14379Subject length lower bound = 32
14380
14381/(?|(?'a')(2)(?'b')|(?'a')(?'a')(3))/I,dupnames
14382Capture group count = 3
14383Named capture groups:
14384  a   1
14385  a   2
14386  b   3
14387Options: dupnames
14388Starting code units: 2 3
14389Subject length lower bound = 1
14390    A23B
14391 0: 2
14392 1:
14393 2: 2
14394 3:
14395    B32A
14396 0: 3
14397 1:
14398 2:
14399 3: 3
14400
14401# These are some patterns that used to cause buffer overflows or other errors
14402# while compiling.
14403
14404/.((?2)(?R)|\1|$)()/B
14405------------------------------------------------------------------
14406        Bra
14407        Any
14408        CBra 1
14409        Recurse
14410        Recurse
14411        Alt
14412        \1
14413        Alt
14414        $
14415        Ket
14416        CBra 2
14417        Ket
14418        Ket
14419        End
14420------------------------------------------------------------------
14421
14422/.((?3)(?R)()(?2)|\1|$)()/B
14423------------------------------------------------------------------
14424        Bra
14425        Any
14426        CBra 1
14427        Recurse
14428        Recurse
14429        CBra 2
14430        Ket
14431        Recurse
14432        Alt
14433        \1
14434        Alt
14435        $
14436        Ket
14437        CBra 3
14438        Ket
14439        Ket
14440        End
14441------------------------------------------------------------------
14442
14443/(\9*+(?2);\3++()2|)++{/
14444Failed: error 115 at offset 2: reference to non-existent subpattern
14445
14446/\V\x85\9*+((?2)\3++()2)*:2/
14447Failed: error 115 at offset 7: reference to non-existent subpattern
14448
14449/(((?(R)){0,2}) (?'x'((?'R')((?'R')))))/dupnames
14450
14451/(((?(X)){0,2}) (?'x'((?'X')((?'X')))))/dupnames
14452
14453/(((?(R)){0,2}) (?'x'((?'X')((?'R')))))/
14454
14455"(?J)(?'d'(?'d'\g{d}))"
14456
14457"(?=!((?2)(?))({8(?<=(?1){29}8bbbb\x16\xd\xc6^($(\xa9H4){4}h}?1)B))\x15')"
14458Failed: error 125 at offset 16: lookbehind assertion is not fixed length
14459
14460/A(?'')Z/
14461Failed: error 162 at offset 4: subpattern name expected
14462
14463"(?J:(?|(?'R')(\k'R')|((?'R'))))"
14464
14465/(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
14466Failed: error 161 at offset 17: subpattern number is too big
14467
14468/^(?:(?(1)x|)+)+$()/B
14469------------------------------------------------------------------
14470        Bra
14471        ^
14472        SBra
14473        SCond
14474      1 Cond ref
14475        x
14476        Alt
14477        KetRmax
14478        KetRmax
14479        $
14480        CBra 1
14481        Ket
14482        Ket
14483        End
14484------------------------------------------------------------------
14485
14486/[[:>:]](?<)/
14487Failed: error 162 at offset 10: subpattern name expected
14488
14489/((?x)(*:0))#(?'/
14490Failed: error 162 at offset 15: subpattern name expected
14491
14492/(?C$[$)(?<]/
14493Failed: error 162 at offset 10: subpattern name expected
14494
14495/(?C$)$)(?<]/
14496Failed: error 162 at offset 10: subpattern name expected
14497
14498/(?(R))*+/B
14499------------------------------------------------------------------
14500        Bra
14501        Braposzero
14502        SBraPos
14503        SCond
14504        Cond recurse any
14505        Ket
14506        KetRpos
14507        Ket
14508        End
14509------------------------------------------------------------------
14510    abcd
14511 0:
14512
14513/((?x)(?#))#(?'/
14514Failed: error 162 at offset 14: subpattern name expected
14515
14516/((?x)(?#))#(?'abc')/I
14517Capture group count = 2
14518Named capture groups:
14519  abc   2
14520First code unit = '#'
14521Subject length lower bound = 1
14522
14523/[[:\\](?<[::]/
14524Failed: error 162 at offset 9: subpattern name expected
14525
14526/[[:\\](?'abc')[a:]/I
14527Capture group count = 1
14528Named capture groups:
14529  abc   1
14530Starting code units: : [ \
14531Subject length lower bound = 2
14532
14533"[[[.\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[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
14534Failed: error 106 at offset 353: missing terminating ] for character class
14535
14536/()(?(R)0)*+/B
14537------------------------------------------------------------------
14538        Bra
14539        CBra 1
14540        Ket
14541        Braposzero
14542        SBraPos
14543        SCond
14544        Cond recurse any
14545        0
14546        Ket
14547        KetRpos
14548        Ket
14549        End
14550------------------------------------------------------------------
14551
14552/(?R-:(?</
14553Failed: error 158 at offset 3: (?R (recursive pattern call) must be followed by a closing parenthesis
14554
14555/(?R-:(?<)/
14556Failed: error 158 at offset 3: (?R (recursive pattern call) must be followed by a closing parenthesis
14557
14558/(?(?C{\Q})(?!(?'/
14559Failed: error 162 at offset 16: subpattern name expected
14560
14561/(?(?C{\Q})(?!(?'abc')))/I
14562Capture group count = 1
14563Named capture groups:
14564  abc   1
14565May match empty string
14566Subject length lower bound = 0
14567
14568/(?1){3918}(((((0(\k'R'))))(?J)(?'R'(?'R'\3){99})))/I
14569Capture group count = 8
14570Max back reference = 8
14571Named capture groups:
14572  R   7
14573  R   8
14574Duplicate name status changes
14575Last code unit = '0'
14576Subject length lower bound = 65535
14577
14578/(?|(aaa)|(b))\g{1}/I
14579Capture group count = 1
14580Max back reference = 1
14581Starting code units: a b
14582Subject length lower bound = 1
14583
14584/(?|(aaa)|(b))(?1)/I
14585Capture group count = 1
14586Starting code units: a b
14587Subject length lower bound = 4
14588
14589/(?|(aaa)|(b))/I
14590Capture group count = 1
14591Starting code units: a b
14592Subject length lower bound = 1
14593
14594/(?|(?'a'aaa)|(?'a'b))\k'a'/I
14595Capture group count = 1
14596Max back reference = 1
14597Named capture groups:
14598  a   1
14599Starting code units: a b
14600Subject length lower bound = 1
14601
14602/(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/I,dupnames
14603Capture group count = 2
14604Max back reference = 2
14605Named capture groups:
14606  a   1
14607  a   2
14608Options: dupnames
14609Starting code units: a b
14610Last code unit = 'c'
14611Subject length lower bound = 5
14612
14613/ab{3cd/
14614    ab{3cd
14615 0: ab{3cd
14616
14617/ab{3,cd/
14618    ab{3,cd
14619 0: ab{3,cd
14620
14621/ab{3,4a}cd/
14622    ab{3,4a}cd
14623 0: ab{3,4a}cd
14624
14625/{4,5a}bc/
14626    {4,5a}bc
14627 0: {4,5a}bc
14628
14629/\x0{ab}/
14630    \0{ab}
14631 0: \x00{ab}
14632
14633/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
14634    ababababbbabZXXXX
14635 0: ababababbbabZ
14636 1: ab
14637 2: b
14638
14639/.*?a(*PRUNE)b/
14640    aab
14641 0: ab
14642
14643/.*?a(*PRUNE)b/s
14644    aab
14645 0: ab
14646
14647/^a(*PRUNE)b/s
14648\= Expect no match
14649    aab
14650No match
14651
14652/.*?a(*SKIP)b/
14653    aab
14654 0: ab
14655
14656/(?(8000000000/
14657Failed: error 161 at offset 8: subpattern number is too big
14658
14659/((?(R8000000000)))/
14660Failed: error 161 at offset 9: subpattern number is too big
14661
14662/0(?0)|(1)(*THEN)(*SKIP:0)(*FAIL)/
14663\= Expect no match
14664    01
14665No match
14666
14667/(?(1)()\983040\2)/
14668Failed: error 161 at offset 14: subpattern number is too big
14669
14670/(*LIMIT_MATCH=)abc/
14671Failed: error 160 at offset 14: (*VERB) not recognized or malformed
14672
14673/(*CRLF)(*LIMIT_MATCH=)abc/
14674Failed: error 160 at offset 21: (*VERB) not recognized or malformed
14675
14676/(?:ab)?(?:ab)(?:ab)/
14677    abab
14678 0: abab
14679    ababab
14680 0: ababab
14681\= Expect no match
14682    aba
14683No match
14684
14685/((*MARK:A))++a(*SKIP:B)b/
14686\= Expect no match
14687    aacb
14688No match
14689
14690/(*MARK:a\zb)z/alt_verbnames
14691Failed: error 140 at offset 10: invalid escape sequence in (*VERB) name
14692
14693/(*:ab\t(d\)c)xxx/
14694Failed: error 122 at offset 12: unmatched closing parenthesis
14695
14696/(*:ab\t(d\)c)xxx/alt_verbnames,mark
14697    cxxxz
14698 0: xxx
14699MK: ab\x09(d)c
14700
14701/(*:A\Qxx)x\EB)x/alt_verbnames,mark
14702    x
14703 0: x
14704MK: Axx)xB
14705
14706/(*:A\ExxxB)x/alt_verbnames,mark
14707    x
14708 0: x
14709MK: AxxxB
14710
14711/(*: A \ and #comment
14712     \ B)x/x,alt_verbnames,mark
14713    x
14714 0: x
14715MK: A and B
14716
14717/(*: A \ and #comment
14718     \ B)x/alt_verbnames,mark
14719    x
14720 0: x
14721MK:  A  and #comment\x0a      B
14722
14723/(*: A \ and #comment
14724     \ B)x/x,mark
14725    x
14726 0: x
14727MK:  A \ and #comment\x0a     \ B
14728
14729/(*: A \ and #comment
14730     \ B)x/mark
14731    x
14732 0: x
14733MK:  A \ and #comment\x0a     \ B
14734
14735/(*:A
14736B)x/alt_verbnames,mark
14737    x
14738 0: x
14739MK: A\x0aB
14740
14741/(*:abc\Qpqr)/alt_verbnames
14742Failed: error 160 at offset 12: (*VERB) not recognized or malformed
14743
14744/abc/use_offset_limit
14745    1234abcde\=offset_limit=100
14746 0: abc
14747    1234abcde\=offset_limit=9
14748 0: abc
14749    1234abcde\=offset_limit=4
14750 0: abc
14751    1234abcde\=offset_limit=4,offset=4
14752 0: abc
14753\= Expect no match
14754    1234abcde\=offset_limit=4,offset=5
14755No match
14756    1234abcde\=offset_limit=3
14757No match
14758
14759/(?<=abc)/use_offset_limit
14760    1234abc\=offset_limit=7
14761 0:
14762\= Expect no match
14763    1234abc\=offset_limit=6
14764No match
14765
14766/A/g,replace=-,use_offset_limit
14767    XAXAXAXAXA\=offset_limit=4
14768 2: X-X-XAXAXA
14769
14770/abc/
14771\= Expect error
14772    1234abcde\=offset_limit=4
14773Failed: error -56: offset limit set without PCRE2_USE_OFFSET_LIMIT
14774
14775/^\w/m,use_offset_limit
14776    \n..\naa\=offset_limit=3
14777No match
14778    \n..\naa\=offset_limit=4
14779 0: a
14780
14781/abcd/null_context
14782    abcd\=null_context
14783 0: abcd
14784\= Expect error - not allowed together
14785    abcd\=null_context,find_limits
14786** Not allowed together: find_limits null_context
14787    abcd\=allusedtext,startchar
14788** Not allowed together: allusedtext startchar
14789
14790/abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended
14791    abcd
14792 1: w\x0dx\x82y\xdbz(12\$34$$\x345$)
14793
14794/abcd/replace=w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$),substitute_extended,substitute_literal
14795    >>abcd<<
14796 1: >>w\rx\x82y\o{333}z(\Q12\$34$$\x34\E5$$)<<
14797
14798/abcd/g,replace=\$1$2\,substitute_literal
14799    XabcdYabcdZ
14800 2: X\$1$2\Y\$1$2\Z
14801
14802/a(bc)(DE)/replace=a\u$1\U$1\E$1\l$2\L$2\Eab\Uab\LYZ\EDone,substitute_extended
14803    abcDE
14804 1: aBcBCbcdEdeabAByzDone
14805
14806/abcd/replace=xy\kz,substitute_extended
14807    abcd
14808Failed: error -57 at offset 4 in replacement: bad escape sequence in replacement string
14809
14810/a(?:(b)|(c))/substitute_extended,replace=X${1:+1:-1}X${2:+2:-2}
14811    ab
14812 1: X1X-2
14813    ac
14814 1: X-1X2
14815    ab\=replace=${1:+$1\:$1:$2}
14816 1: b:b
14817    ac\=replace=${1:+$1\:$1:$2}
14818 1: c
14819    >>ac<<\=replace=${1:+$1\:$1:$2},substitute_literal
14820 1: >>${1:+$1\:$1:$2}<<
14821
14822/a(?:(b)|(c))/substitute_extended,replace=X${1:-1:-1}X${2:-2:-2}
14823    ab
14824 1: XbX2:-2
14825    ac
14826 1: X1:-1Xc
14827
14828/(a)/substitute_extended,replace=>${1:+\Q$1:{}$$\E+\U$1}<
14829    a
14830 1: >$1:{}$$+A<
14831
14832/X(b)Y/substitute_extended
14833    XbY\=replace=x${1:+$1\U$1}y
14834 1: xbBY
14835    XbY\=replace=\Ux${1:+$1$1}y
14836 1: XBBY
14837
14838/a/substitute_extended,replace=${*MARK:+a:b}
14839    a
14840Failed: error -58 at offset 7 in replacement: expected closing curly bracket in replacement string
14841
14842/(abcd)/replace=${1:+xy\kz},substitute_extended
14843    abcd
14844Failed: error -57 at offset 8 in replacement: bad escape sequence in replacement string
14845
14846/(abcd)/
14847    abcd\=replace=${1:+xy\kz},substitute_extended
14848Failed: error -57 at offset 8 in replacement: bad escape sequence in replacement string
14849
14850/abcd/substitute_extended,replace=>$1<
14851    abcd
14852Failed: error -49 at offset 3 in replacement: unknown substring
14853
14854/abcd/substitute_extended,replace=>xxx${xyz}<<<
14855    abcd
14856Failed: error -49 at offset 10 in replacement: unknown substring
14857
14858/(?J)(?:(?<A>a)|(?<A>b))/replace=<$A>
14859    [a]
14860 1: [<a>]
14861    [b]
14862 1: [<b>]
14863\= Expect error
14864    (a)\=ovector=1
14865Failed: error -54 at offset 3 in replacement: requested value is not available
14866
14867/(a)|(b)/replace=<$1>
14868\= Expect error
14869    b
14870Failed: error -55 at offset 3 in replacement: requested value is not set
14871
14872/(aa)(BB)/substitute_extended,replace=\U$1\L$2\E$1..\U$1\l$2$1
14873    aaBB
14874 1: AAbbaa..AAbBaa
14875
14876/abcd/replace=wxyz,substitute_matched
14877    abcd
14878 1: wxyz
14879    pqrs
14880 0: pqrs
14881
14882/abcd/g
14883    >abcd1234abcd5678<\=replace=wxyz,substitute_matched
14884 2: >wxyz1234wxyz5678<
14885
14886/^(o(\1{72}{\"{\\{00000059079}\d*){74}}){19}/I
14887Capture group count = 2
14888Max back reference = 1
14889Compile options: <none>
14890Overall options: anchored
14891First code unit = 'o'
14892Last code unit = '}'
14893Subject length lower bound = 65535
14894
14895/((p(?'K/
14896Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator?)
14897
14898/((p(?'K/no_auto_capture
14899Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator?)
14900
14901/abc/replace=A$3123456789Z
14902    abc
14903Failed: error -49 at offset 3 in replacement: unknown substring
14904
14905/(?<!a{65535}a{5})x/I
14906Failed: error 187 at offset 0: lookbehind assertion is too long
14907
14908/(?<!a{65535})x/I
14909Capture group count = 0
14910Max lookbehind = 65535
14911First code unit = 'x'
14912Subject length lower bound = 1
14913
14914/(?=a\K)/replace=z,allow_lookaround_bsk
14915    BaCaD
14916Failed: error -60: match with end before start or start moved backwards is not supported
14917
14918/(?<=\K.)/g,replace=-,allow_lookaround_bsk
14919    ab
14920Failed: error -60: match with end before start or start moved backwards is not supported
14921
14922/(?'abcdefghijklmnopqrstuvwxyzABCDEFG'toolong)/
14923Failed: error 148 at offset 36: subpattern name is too long (maximum 32 code units)
14924
14925/(?'abcdefghijklmnopqrstuvwxyzABCDEF'justright)/
14926
14927# These two use zero-termination
14928/abcd/max_pattern_length=3
14929Failed: error 188 at offset 0: pattern string is longer than the limit set by the application
14930
14931/abc/max_pattern_length=3
14932
14933# These two, being hex, pass the length
14934/abcdefab/hex,max_pattern_length=3
14935Failed: error 188 at offset 0: pattern string is longer than the limit set by the application
14936
14937/abcdef/hex,max_pattern_length=3
14938
14939# These patterns used to take a long time to compile
14940
14941"(.*)
14942((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14943((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14944((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
14945Capture group count = 12
14946May match empty string
14947Options: extended
14948First code unit at start or follows newline
14949Subject length lower bound = 0
14950
14951"(?<=a()
14952((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14953((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14954((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14955a)"xI
14956Capture group count = 12
14957Max lookbehind = 2
14958May match empty string
14959Options: extended
14960Subject length lower bound = 0
14961
14962"(?|()|())(.*)
14963((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14964((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14965((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))"xI
14966Capture group count = 13
14967May match empty string
14968Options: extended
14969Subject length lower bound = 0
14970
14971"(?|()|())(?<=a()
14972((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14973((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14974((?-2)(?-2))((?-2)(?-2))((?-2)(?-2))
14975a)"xI
14976Failed: error 135 at offset 9: lookbehind is too complicated
14977
14978# Test the use of malloc for caching group information when there are more
14979# groups than fit into the on-stack workspace.
14980
14981/\[()]{1024}/I,expand
14982Expanded: ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
14983Capture group count = 1024
14984May match empty string
14985Subject length lower bound = 0
14986
14987# Test minlength capped at 65535
14988
14989/(A{65000})\1{65000}/I
14990Capture group count = 1
14991Max back reference = 1
14992First code unit = 'A'
14993Last code unit = 'A'
14994Subject length lower bound = 65535
14995
14996# Test group scans when numbers are not unique
14997
14998/(?|()+|(a)+)/BI
14999------------------------------------------------------------------
15000        Bra
15001        Bra
15002        SCBra 1
15003        KetRmax
15004        Alt
15005        CBra 1
15006        a
15007        KetRmax
15008        Ket
15009        Ket
15010        End
15011------------------------------------------------------------------
15012Capture group count = 1
15013May match empty string
15014Subject length lower bound = 0
15015
15016/(?|(a)+|()+)/BI
15017------------------------------------------------------------------
15018        Bra
15019        Bra
15020        CBra 1
15021        a
15022        KetRmax
15023        Alt
15024        SCBra 1
15025        KetRmax
15026        Ket
15027        Ket
15028        End
15029------------------------------------------------------------------
15030Capture group count = 1
15031May match empty string
15032Subject length lower bound = 0
15033
15034/(?|()|(a))/BI
15035------------------------------------------------------------------
15036        Bra
15037        Bra
15038        CBra 1
15039        Ket
15040        Alt
15041        CBra 1
15042        a
15043        Ket
15044        Ket
15045        Ket
15046        End
15047------------------------------------------------------------------
15048Capture group count = 1
15049May match empty string
15050Subject length lower bound = 0
15051
15052/(?|(a)|())/BI
15053------------------------------------------------------------------
15054        Bra
15055        Bra
15056        CBra 1
15057        a
15058        Ket
15059        Alt
15060        CBra 1
15061        Ket
15062        Ket
15063        Ket
15064        End
15065------------------------------------------------------------------
15066Capture group count = 1
15067May match empty string
15068Subject length lower bound = 0
15069
15070# Test CRLF handling in empty string substitutions
15071
15072/^$/gm,newline=anycrlf,replace=-
15073    X\r\n\r\nY
15074 1: X\x0d\x0a-\x0d\x0aY
15075
15076/^$/gm,newline=crlf,replace=-
15077    X\r\n\r\nY
15078 1: X\x0d\x0a-\x0d\x0aY
15079
15080/^$/gm,newline=any,replace=-
15081    X\r\n\r\nY
15082 1: X\x0d\x0a-\x0d\x0aY
15083
15084"(*ANYCRLF)(?m)^(.*[^0-9\r\n].*|)$"g,replace=NaN
15085    15\r\nfoo\r\n20\r\nbar\r\nbaz\r\n\r\n20
15086 4: 15\x0d\x0aNaN\x0d\x0a20\x0d\x0aNaN\x0d\x0aNaN\x0d\x0aNaN\x0d\x0a20
15087
15088/a[[:punct:]b]/bincode
15089------------------------------------------------------------------
15090        Bra
15091        a
15092        [!-/:-@[-`b{-~]
15093        Ket
15094        End
15095------------------------------------------------------------------
15096
15097/a[b[:punct:]]/bincode
15098------------------------------------------------------------------
15099        Bra
15100        a
15101        [!-/:-@[-`b{-~]
15102        Ket
15103        End
15104------------------------------------------------------------------
15105
15106/L(?#(|++<!(2)?/B
15107------------------------------------------------------------------
15108        Bra
15109        L?+
15110        Ket
15111        End
15112------------------------------------------------------------------
15113
15114/L(?#(|++<!(2)?/B,no_auto_possess
15115------------------------------------------------------------------
15116        Bra
15117        L?
15118        Ket
15119        End
15120------------------------------------------------------------------
15121
15122/L(?#(|++<!(2)?/B,auto_callout
15123------------------------------------------------------------------
15124        Bra
15125        Callout 255 0 14
15126        L?+
15127        Callout 255 14 0
15128        Ket
15129        End
15130------------------------------------------------------------------
15131
15132/L(?#(|++<!(2)?/B,no_auto_possess,auto_callout
15133------------------------------------------------------------------
15134        Bra
15135        Callout 255 0 14
15136        L?
15137        Callout 255 14 0
15138        Ket
15139        End
15140------------------------------------------------------------------
15141
15142/(A*)\E+/B,auto_callout
15143------------------------------------------------------------------
15144        Bra
15145        Callout 255 0 1
15146        SCBra 1
15147        Callout 255 1 2
15148        A*
15149        Callout 255 3 4
15150        KetRmax
15151        Callout 255 7 0
15152        Ket
15153        End
15154------------------------------------------------------------------
15155
15156/()\Q\E*]/B,auto_callout
15157------------------------------------------------------------------
15158        Bra
15159        Callout 255 0 1
15160        Brazero
15161        SCBra 1
15162        Callout 255 1 6
15163        KetRmax
15164        Callout 255 7 1
15165        ]
15166        Callout 255 8 0
15167        Ket
15168        End
15169------------------------------------------------------------------
15170    a[bc]d
15171--->a[bc]d
15172 +0     ^      (
15173 +1     ^      )\Q\E*
15174 +7     ^      ]
15175 +8     ^^     End of pattern
15176 0: ]
15177 1:
15178
15179/\x8a+f|;T?(*:;.'?`(\xeap ){![^()!y*''C*(?';]{1;(\x08)/B,alt_verbnames,dupnames,extended
15180------------------------------------------------------------------
15181        Bra
15182        \x{8a}++
15183        f
15184        Alt
15185        ;
15186        T?
15187        *MARK ;.'?`(\x{ea}p
15188        {!
15189        [\x00- "-&+-:<->@-BD-xz-\xff] (neg)
15190        {1;
15191        CBra 1
15192        \x08
15193        Ket
15194        Ket
15195        End
15196------------------------------------------------------------------
15197
15198# Tests for NULL characters in comments and verb "names" and callouts
15199
15200# /A#B\x00C\x0aZ/
15201/41 23 42 00 43 0a 5a/Bx,hex
15202------------------------------------------------------------------
15203        Bra
15204        AZ
15205        Ket
15206        End
15207------------------------------------------------------------------
15208
15209# /A+#B\x00C\x0a+/
15210/41 2b 23 42 00 43 0a 2b/Bx,hex
15211------------------------------------------------------------------
15212        Bra
15213        A++
15214        Ket
15215        End
15216------------------------------------------------------------------
15217
15218# /A(*:B\x00W#X\00Y\x0aC)Z/
15219/41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex,alt_verbnames
15220------------------------------------------------------------------
15221        Bra
15222        A
15223        *MARK B\x{0}WC
15224        Z
15225        Ket
15226        End
15227------------------------------------------------------------------
15228
15229# /A(*:B\x00W#X\00Y\x0aC)Z/
15230/41 28 2a 3a 42 00 57 23 58 00 59 0a 43 29 5a/Bx,hex
15231------------------------------------------------------------------
15232        Bra
15233        A
15234        *MARK B\x{0}W#X\x{0}Y\x{a}C
15235        Z
15236        Ket
15237        End
15238------------------------------------------------------------------
15239
15240# /A(?C{X\x00Y})B/
15241/41 28 3f 43 7b 58 00 59 7d 29 42/B,hex
15242------------------------------------------------------------------
15243        Bra
15244        A
15245        CalloutStr {X\x{0}Y} 5 10 1
15246        B
15247        Ket
15248        End
15249------------------------------------------------------------------
15250
15251# /A(?#X\x00Y)B/
15252/41 28 3f 23 7b 00 7d 29 42/B,hex
15253------------------------------------------------------------------
15254        Bra
15255        AB
15256        Ket
15257        End
15258------------------------------------------------------------------
15259
15260# Tests for leading comment in extended patterns
15261
15262/ (?-x):?/extended
15263
15264/(?-x):?/extended
15265
15266/0b 28 3f 2d 78 29 3a/hex,extended
15267
15268/#comment
15269(?-x):?/extended
15270
15271/(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
15272Failed: error 162 at offset 49: subpattern name expected
15273
15274/a|(b)c/replace=>$1<,substitute_unset_empty
15275    cat
15276 1: c><t
15277    xbcom
15278 1: x>b<om
15279
15280/a|(b)c/
15281    cat\=replace=>$1<
15282Failed: error -55 at offset 3 in replacement: requested value is not set
15283    cat\=replace=>$1<,substitute_unset_empty
15284 1: c><t
15285    xbcom\=replace=>$1<,substitute_unset_empty
15286 1: x>b<om
15287
15288/a|(b)c/substitute_extended
15289    cat\=replace=>${2:-xx}<
15290Failed: error -49 at offset 9 in replacement: unknown substring
15291    cat\=replace=>${2:-xx}<,substitute_unknown_unset
15292 1: c>xx<t
15293    cat\=replace=>${X:-xx}<,substitute_unknown_unset
15294 1: c>xx<t
15295
15296/a|(?'X'b)c/replace=>$X<,substitute_unset_empty
15297    cat
15298 1: c><t
15299    xbcom
15300 1: x>b<om
15301
15302/a|(?'X'b)c/replace=>$Y<,substitute_unset_empty
15303    cat
15304Failed: error -49 at offset 3 in replacement: unknown substring
15305    cat\=substitute_unknown_unset
15306 1: c><t
15307    cat\=substitute_unknown_unset,-substitute_unset_empty
15308Failed: error -55 at offset 3 in replacement: requested value is not set
15309
15310/a|(b)c/replace=>$2<,substitute_unset_empty
15311    cat
15312Failed: error -49 at offset 3 in replacement: unknown substring
15313    cat\=substitute_unknown_unset
15314 1: c><t
15315    cat\=substitute_unknown_unset,-substitute_unset_empty
15316Failed: error -55 at offset 3 in replacement: requested value is not set
15317
15318/()()()/use_offset_limit
15319    \=ovector=11000000000
15320** Invalid value in 'ovector=11000000000'
15321    \=callout_fail=11000000000
15322** Invalid value in 'callout_fail=11000000000'
15323    \=callout_fail=1:11000000000
15324** Invalid value in 'callout_fail=1:11000000000'
15325    \=callout_data=11000000000
15326** Invalid value in 'callout_data=11000000000'
15327    \=callout_data=-11000000000
15328** Invalid value in 'callout_data=-11000000000'
15329    \=offset_limit=1100000000000000000000
15330** Invalid value in 'offset_limit=1100000000000000000000'
15331    \=copy=11000000000
15332** Invalid value in 'copy=11000000000'
15333
15334/(*MARK:A\x00b)/mark
15335    abc
15336 0:
15337MK: A\x00b
15338
15339/(*MARK:A\x00b)/mark,alt_verbnames
15340    abc
15341 0:
15342MK: A\x00b
15343
15344/"(*MARK:A" 00 "b)"/mark,hex
15345    abc
15346 0:
15347MK: A\x00b
15348
15349/"(*MARK:A" 00 "b)"/mark,hex,alt_verbnames
15350    abc
15351 0:
15352MK: A\x00b
15353
15354/efg/hex
15355** Unexpected non-hex-digit 'g' at offset 2 in hex pattern: quote missing?
15356
15357/eff/hex
15358** Odd number of digits in hex pattern
15359
15360/effg/hex
15361** Unexpected non-hex-digit 'g' at offset 3 in hex pattern: quote missing?
15362
15363/(?J)(?'a'))(?'a')/
15364Failed: error 122 at offset 10: unmatched closing parenthesis
15365
15366/(?<=((?C)0))/
15367    9010
15368--->9010
15369  0  ^       0
15370  0   ^      0
15371 0:
15372 1: 0
15373\= Expect no match
15374    abc
15375--->abc
15376  0  ^      0
15377  0   ^     0
15378  0    ^    0
15379No match
15380
15381/aaa/
15382\[abc]{10000000000000000000000000000}
15383** Repeat count too large
15384\[a]{3}
15385 0: aaa
15386
15387/\[AB]{6000000000000000000000}/expand
15388** Pattern repeat count too large
15389
15390# Hex uses pattern length, not zero-terminated. This tests for overrunning
15391# the given length of a pattern.
15392
15393/'(*U'/hex
15394Failed: error 160 at offset 3: (*VERB) not recognized or malformed
15395
15396/'(*'/hex
15397Failed: error 109 at offset 1: quantifier does not follow a repeatable item
15398
15399/'('/hex
15400Failed: error 114 at offset 1: missing closing parenthesis
15401
15402//hex
15403
15404# These tests are here because Perl never allows a back reference in a
15405# lookbehind. PCRE2 supports some limited cases.
15406
15407/([ab])...(?<=\1)z/
15408    a11az
15409 0: a11az
15410 1: a
15411    b11bz
15412 0: b11bz
15413 1: b
15414\= Expect no match
15415    b11az
15416No match
15417
15418/(?|([ab]))...(?<=\1)z/
15419Failed: error 125 at offset 13: lookbehind assertion is not fixed length
15420
15421/([ab])(\1)...(?<=\2)z/
15422    aa11az
15423 0: aa11az
15424 1: a
15425 2: a
15426
15427/(a\2)(b\1)(?<=\2)/
15428Failed: error 125 at offset 10: lookbehind assertion is not fixed length
15429
15430/(?<A>[ab])...(?<=\k'A')z/
15431    a11az
15432 0: a11az
15433 1: a
15434    b11bz
15435 0: b11bz
15436 1: b
15437\= Expect no match
15438    b11az
15439No match
15440
15441/(?<A>[ab])...(?<=\k'A')(?<A>)z/dupnames
15442Failed: error 125 at offset 13: lookbehind assertion is not fixed length
15443
15444# Perl does not support \g+n
15445
15446/((\g+1X)?([ab]))+/
15447    aaXbbXa
15448 0: aaXbbXa
15449 1: bXa
15450 2: bX
15451 3: a
15452
15453/ab(?C1)c/auto_callout
15454    abc
15455--->abc
15456 +0 ^       a
15457 +1 ^^      b
15458  1 ^ ^     c
15459 +8 ^  ^    End of pattern
15460 0: abc
15461
15462/'ab(?C1)c'/hex,auto_callout
15463    abc
15464--->abc
15465 +0 ^       a
15466 +1 ^^      b
15467  1 ^ ^     c
15468 +8 ^  ^    End of pattern
15469 0: abc
15470
15471# Perl accepts these, but gives a warning. We can't warn, so give an error.
15472
15473/[a-[:digit:]]+/
15474Failed: error 150 at offset 4: invalid range in character class
15475    a-a9-a
15476
15477/[A-[:digit:]]+/
15478Failed: error 150 at offset 4: invalid range in character class
15479    A-A9-A
15480
15481/[a-\d]+/
15482Failed: error 150 at offset 5: invalid range in character class
15483    a-a9-a
15484
15485/(?<RA>abc)(?(R)xyz)/B
15486------------------------------------------------------------------
15487        Bra
15488        CBra 1
15489        abc
15490        Ket
15491        Cond
15492        Cond recurse any
15493        xyz
15494        Ket
15495        Ket
15496        End
15497------------------------------------------------------------------
15498
15499/(?<R>abc)(?(R)xyz)/B
15500------------------------------------------------------------------
15501        Bra
15502        CBra 1
15503        abc
15504        Ket
15505        Cond
15506      1 Cond ref
15507        xyz
15508        Ket
15509        Ket
15510        End
15511------------------------------------------------------------------
15512
15513/(?=.*[A-Z])/I
15514Capture group count = 0
15515May match empty string
15516Subject length lower bound = 0
15517
15518/()(?<=(?0))/
15519Failed: error 125 at offset 2: lookbehind assertion is not fixed length
15520
15521/(?<!|!(?<!))/
15522
15523/(?<!|!|!||||||(?<!)||(?<!)!|!||(?<!)!|!(?<!)!|!|!|!||||!!|<!)!|!||||!|/
15524
15525/{2,2{2,2/use_length
15526
15527/.>*?\g'0/use_length
15528Failed: error 157 at offset 6: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
15529
15530/.>*?\g'0/
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/{�̈́�̈́�{'{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
15534
15535//
15536\=get=i00000000000000000000000000000000
15537** Group name in 'get' is too long
15538\=get=i2345678901234567890123456789012,get=i1245678901234567890123456789012
15539** Too many characters in named 'get' modifiers
15540
15541"(?(?C))"
15542Failed: error 128 at offset 6: assertion expected after (?( or (?(?C)
15543
15544/(?(?(?(?(?(?))))))/
15545Failed: error 128 at offset 2: assertion expected after (?( or (?(?C)
15546
15547/(?<=(?1))((?s))/anchored
15548
15549/(*:ab)*/
15550Failed: error 109 at offset 6: quantifier does not follow a repeatable item
15551
15552%(*:(:(svvvvvvvvvv:]*[   Z!*;[]*[^[]*!^[+.+{{2,7}'      _\\\\\\\\\\\\\)?.:..    *w////\\\Q\\\\\\\\\\\\\\\T\\\\\+/?/////'+\\\EEE?/////'+/*+/[^K]?]//(w)%never_backslash_c,alt_verbnames,auto_callout
15553
15554/./newline=crlf
15555    \=ph
15556No match
15557
15558/(\x0e00\000000\xc)/replace=\P,substitute_extended
15559    \x0e00\000000\xc
15560Failed: error -57 at offset 2 in replacement: bad escape sequence in replacement string
15561
15562//replace=0
15563    \=offset=7
15564Failed: error -33: bad offset value
15565
15566/(?<=\G.)/g,replace=+
15567    abc
15568 3: a+b+c+
15569
15570".+\QX\E+"B,no_auto_possess
15571------------------------------------------------------------------
15572        Bra
15573        Any+
15574        X+
15575        Ket
15576        End
15577------------------------------------------------------------------
15578
15579".+\QX\E+"B,auto_callout,no_auto_possess
15580------------------------------------------------------------------
15581        Bra
15582        Callout 255 0 4
15583        Any+
15584        Callout 255 4 4
15585        X+
15586        Callout 255 8 0
15587        Ket
15588        End
15589------------------------------------------------------------------
15590
15591# This one is here because Perl gives an 'unmatched )' error which goes away
15592# if one of the \) sequences is removed - which is weird. PCRE finds it too
15593# complicated to find a minimum matching length.
15594
15595"()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
15596Capture group count = 108
15597Max back reference = 22
15598Contains explicit CR or LF match
15599Subject length lower bound = 1
15600
15601# This checks that new code for handling groups that may match an empty string
15602# works on a very large number of alternatives. This pattern used to provoke a
15603# complaint that it was too complicated.
15604
15605/(?:\[A|B|C|D|E|F|G|H|I|J|]{200}Z)/expand
15606
15607# This one used to compile rubbish instead of a compile error, and then
15608# behave unpredictably at match time.
15609
15610/.+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X/
15611Failed: error 128 at offset 63: assertion expected after (?( or (?(?C)
15612    .+(?(?C'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'))?!XXXX.=X
15613
15614/[:[:alnum:]-[[a:lnum:]+/
15615Failed: error 150 at offset 11: invalid range in character class
15616
15617/((?(?C'')\QX\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
15618Failed: error 128 at offset 11: assertion expected after (?( or (?(?C)
15619
15620/((?(?C'')\Q\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
15621
15622/abcd/auto_callout
15623    abcd\=callout_error=255:2
15624--->abcd
15625 +0 ^        a
15626 +1 ^^       b
15627Failed: error -37: callout error code
15628
15629/()(\g+65534)/
15630Failed: error 161 at offset 11: subpattern number is too big
15631
15632/()(\g+65533)/
15633Failed: error 115 at offset 10: reference to non-existent subpattern
15634
15635/�\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
15636Capture group count = 2
15637Max back reference = 2
15638First code unit = \xc1
15639Last code unit = '2'
15640Subject length lower bound = 65535
15641
15642/(a)(b)\2\1\1\1\1/I
15643Capture group count = 2
15644Max back reference = 2
15645First code unit = 'a'
15646Last code unit = 'b'
15647Subject length lower bound = 7
15648
15649/(?<a>a)(?<b>b)\g{b}\g{a}\g{a}\g{a}\g{a}(?<a>xx)(?<b>zz)/I,dupnames
15650Capture group count = 4
15651Max back reference = 4
15652Named capture groups:
15653  a   1
15654  a   3
15655  b   2
15656  b   4
15657Options: dupnames
15658First code unit = 'a'
15659Last code unit = 'z'
15660Subject length lower bound = 11
15661
15662//
15663    \=ovector=7777777777
15664** Invalid value in 'ovector=7777777777'
15665
15666# This is here because Perl matches, even though a COMMIT is encountered
15667# outside of the recursion.
15668
15669/(?1)(A(*COMMIT)|B)D/
15670    BAXBAD
15671No match
15672
15673"(?1){2}(a)"B
15674------------------------------------------------------------------
15675        Bra
15676        Recurse
15677        Recurse
15678        CBra 1
15679        a
15680        Ket
15681        Ket
15682        End
15683------------------------------------------------------------------
15684
15685"(?1){2,4}(a)"B
15686------------------------------------------------------------------
15687        Bra
15688        Recurse
15689        Recurse
15690        Brazero
15691        Bra
15692        Bra
15693        Recurse
15694        Ket
15695        Brazero
15696        Bra
15697        Recurse
15698        Ket
15699        Ket
15700        CBra 1
15701        a
15702        Ket
15703        Ket
15704        End
15705------------------------------------------------------------------
15706
15707# This test differs from Perl for the first subject. Perl ends up with
15708# $1 set to 'B'; PCRE2 has it unset (which I think is right).
15709
15710/^(?:
15711(?:A| (?:B|B(*ACCEPT)) (?<=(.)) D)
15712(Z)
15713)+$/x
15714    AZB
15715 0: AZB
15716 1: <unset>
15717 2: Z
15718    AZBDZ
15719 0: AZBDZ
15720 1: B
15721 2: Z
15722
15723# The first of these, when run by Perl, gives the mark 'aa', which is wrong.
15724
15725'(?>a(*:aa))b|ac' mark
15726    ac
15727 0: ac
15728
15729'(?:a(*:aa))b|ac' mark
15730    ac
15731 0: ac
15732
15733/(R?){65}/
15734    (R?){65}
15735 0:
15736 1:
15737
15738/\[(a)]{60}/expand
15739    aaaa
15740No match
15741
15742/(?<!\1((?U)1((?U))))(*F)/never_backslash_c,alt_bsux,anchored,extended
15743
15744/\g{3/
15745Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
15746
15747/(a(?C1)(b)(c)d)+/
15748  abcdabcd\=callout_capture
15749Callout 1: last capture = 0
15750--->abcdabcd
15751    ^^           (
15752Callout 1: last capture = 1
15753 1: abcd
15754 2: b
15755 3: c
15756--->abcdabcd
15757    ^    ^       (
15758 0: abcdabcd
15759 1: abcd
15760 2: b
15761 3: c
15762
15763# Perl matches this one, but PCRE does not because (*ACCEPT) clears out any
15764# pending backtracks in the recursion.
15765
15766/^ (?(DEFINE) (..(*ACCEPT)|...) ) (?1)$/x
15767\= Expect no match
15768    abc
15769No match
15770
15771# Perl gives no match for this one
15772
15773/(a(*MARK:m)(*ACCEPT)){0}(?1)/mark
15774    abc
15775 0: a
15776MK: m
15777
15778/abc/endanchored
15779    xyzabc
15780 0: abc
15781\= Expect no match
15782    xyzabcdef
15783No match
15784\= Expect error
15785    xyzabc\=ph
15786Failed: error -34: bad option value
15787
15788/abc/
15789    xyzabc\=endanchored
15790 0: abc
15791\= Expect no match
15792    xyzabcdef\=endanchored
15793No match
15794\= Expect error
15795    xyzabc\=ps,endanchored
15796Failed: error -34: bad option value
15797
15798/abc(*ACCEPT)d/endanchored
15799    xyzabc
15800 0: abc
15801\= Expect no match
15802    xyzabcdef
15803No match
15804
15805/abc|bcd/endanchored
15806    xyzabcd
15807 0: bcd
15808\= Expect no match
15809    xyzabcdef
15810No match
15811
15812/a(*ACCEPT)x|aa/endanchored
15813    aaa
15814 0: a
15815
15816# Check auto-anchoring when there is a group that is never obeyed at
15817# the start of a branch.
15818
15819/(?(DEFINE)(a))^bc/I
15820Capture group count = 1
15821Compile options: <none>
15822Overall options: anchored
15823First code unit = 'b'
15824Subject length lower bound = 2
15825
15826/(a){0}.*bc/sI
15827Capture group count = 1
15828Compile options: dotall
15829Overall options: anchored dotall
15830Last code unit = 'c'
15831Subject length lower bound = 2
15832
15833# This should be anchored, as the condition is always false and there is
15834# no alternative branch.
15835
15836/(?(VERSION>=999)yes)^bc/I
15837Capture group count = 0
15838Compile options: <none>
15839Overall options: anchored
15840Subject length lower bound = 2
15841
15842# This should not be anchored.
15843
15844/(?(VERSION>=999)yes|no)^bc/I
15845Capture group count = 0
15846Last code unit = 'c'
15847Subject length lower bound = 4
15848
15849/(*LIMIT_HEAP=0)xxx/I
15850Capture group count = 0
15851Heap limit = 0
15852First code unit = 'x'
15853Last code unit = 'x'
15854Subject length lower bound = 3
15855
15856/\d{0,3}(*:abc)(?C1)xxx/callout_info
15857Callout 1  x
15858
15859# ----------------------------------------------------------------------
15860
15861# These are a whole pile of tests that touch lines of code that are not
15862# used by any other tests (at least when these were created).
15863
15864/^a+?x/i,no_start_optimize,no_auto_possess
15865\= Expect no match
15866    aaa
15867No match
15868
15869/^[^a]{3,}?x/i,no_start_optimize,no_auto_possess
15870\= Expect no match
15871    bbb
15872No match
15873    cc
15874No match
15875
15876/^X\S/no_start_optimize,no_auto_possess
15877\= Expect no match
15878    X
15879No match
15880
15881/^X\W/no_start_optimize,no_auto_possess
15882\= Expect no match
15883    X
15884No match
15885
15886/^X\H/no_start_optimize,no_auto_possess
15887\= Expect no match
15888    X
15889No match
15890
15891/^X\h/no_start_optimize,no_auto_possess
15892\= Expect no match
15893    X
15894No match
15895
15896/^X\V/no_start_optimize,no_auto_possess
15897\= Expect no match
15898    X
15899No match
15900
15901/^X\v/no_start_optimize,no_auto_possess
15902\= Expect no match
15903    X
15904No match
15905
15906/^X\h/no_start_optimize,no_auto_possess
15907\= Expect no match
15908    XY
15909No match
15910
15911/^X\V/no_start_optimize,no_auto_possess
15912\= Expect no match
15913    X\n
15914No match
15915
15916/^X\v/no_start_optimize,no_auto_possess
15917\= Expect no match
15918    XX
15919No match
15920
15921/^X.+?/s,no_start_optimize,no_auto_possess
15922\= Expect no match
15923    X
15924No match
15925
15926/^X\R+?/no_start_optimize,no_auto_possess
15927\= Expect no match
15928    XX
15929No match
15930
15931/^X\H+?/no_start_optimize,no_auto_possess
15932\= Expect no match
15933    X
15934No match
15935
15936/^X\h+?/no_start_optimize,no_auto_possess
15937\= Expect no match
15938    X
15939No match
15940
15941/^X\V+?/no_start_optimize,no_auto_possess
15942\= Expect no match
15943    X
15944No match
15945    X\n
15946No match
15947
15948/^X\D+?/no_start_optimize,no_auto_possess
15949\= Expect no match
15950    X
15951No match
15952    X9
15953No match
15954
15955/^X\S+?/no_start_optimize,no_auto_possess
15956\= Expect no match
15957    X
15958No match
15959    X\n
15960No match
15961
15962/^X\W+?/no_start_optimize,no_auto_possess
15963\= Expect no match
15964    X
15965No match
15966    XX
15967No match
15968
15969/^X.+?Z/no_start_optimize,no_auto_possess
15970\= Expect no match
15971    XY\n
15972No match
15973
15974/(*CRLF)^X.+?Z/no_start_optimize,no_auto_possess
15975\= Expect no match
15976    XY\r\=ps
15977Partial match: XY\x0d
15978
15979/^X\R+?Z/no_start_optimize,no_auto_possess
15980\= Expect no match
15981    X\nX
15982No match
15983    X\n\r\n
15984No match
15985    X\n\rY
15986No match
15987    X\n\nY
15988No match
15989    X\n\x{0c}Y
15990No match
15991
15992/(*BSR_ANYCRLF)^X\R+?Z/no_start_optimize,no_auto_possess
15993\= Expect no match
15994    X\nX
15995No match
15996    X\n\r\n
15997No match
15998    X\n\rY
15999No match
16000    X\n\nY
16001No match
16002    X\n\x{0c}Y
16003No match
16004
16005/^X\H+?Z/no_start_optimize,no_auto_possess
16006\= Expect no match
16007    XY\t
16008No match
16009    XYY
16010No match
16011
16012/^X\h+?Z/no_start_optimize,no_auto_possess
16013\= Expect no match
16014    X\t\t
16015No match
16016    X\tY
16017No match
16018
16019/^X\V+?Z/no_start_optimize,no_auto_possess
16020\= Expect no match
16021    XY\n
16022No match
16023    XYY
16024No match
16025
16026/^X\v+?Z/no_start_optimize,no_auto_possess
16027\= Expect no match
16028    X\n\n
16029No match
16030    X\nY
16031No match
16032
16033/^X\D+?Z/no_start_optimize,no_auto_possess
16034\= Expect no match
16035    XY9
16036No match
16037    XYY
16038No match
16039
16040/^X\d+?Z/no_start_optimize,no_auto_possess
16041\= Expect no match
16042    X99
16043No match
16044    X9Y
16045No match
16046
16047/^X\S+?Z/no_start_optimize,no_auto_possess
16048\= Expect no match
16049    XY\n
16050No match
16051    XYY
16052No match
16053
16054/^X\s+?Z/no_start_optimize,no_auto_possess
16055\= Expect no match
16056    X\n\n
16057No match
16058    X\nY
16059No match
16060
16061/^X\W+?Z/no_start_optimize,no_auto_possess
16062\= Expect no match
16063    X.A
16064No match
16065    X++
16066No match
16067
16068/^X\w+?Z/no_start_optimize,no_auto_possess
16069\= Expect no match
16070    Xa.
16071No match
16072    Xaa
16073No match
16074
16075/^X.{1,3}Z/s,no_start_optimize,no_auto_possess
16076\= Expect no match
16077    Xa.bd
16078No match
16079
16080/^X\h+Z/no_start_optimize,no_auto_possess
16081\= Expect no match
16082    X\t\t
16083No match
16084    X\tY
16085No match
16086
16087/^X\V+Z/no_start_optimize,no_auto_possess
16088\= Expect no match
16089    XY\n
16090No match
16091    XYY
16092No match
16093
16094/^(X(*THEN)Y|AB){0}(?1)/
16095    ABX
16096 0: AB
16097\= Expect no match
16098    XAB
16099No match
16100
16101/^(?!A(?C1)B)C/
16102    ABC\=callout_error=1,no_jit
16103No match
16104
16105/^(?!A(?C1)B)C/no_start_optimize
16106    ABC\=callout_error=1
16107--->ABC
16108  1 ^^      B
16109Failed: error -37: callout error code
16110
16111/^(?(?!A(?C1)B)C)/
16112    ABC\=callout_error=1
16113--->ABC
16114  1 ^^      B
16115Failed: error -37: callout error code
16116
16117# ----------------------------------------------------------------------
16118
16119/[a b c]/BxxI
16120------------------------------------------------------------------
16121        Bra
16122        [a-c]
16123        Ket
16124        End
16125------------------------------------------------------------------
16126Capture group count = 0
16127Options: extended_more
16128Starting code units: a b c
16129Subject length lower bound = 1
16130
16131/[a b c]/BxxxI
16132------------------------------------------------------------------
16133        Bra
16134        [a-c]
16135        Ket
16136        End
16137------------------------------------------------------------------
16138Capture group count = 0
16139Options: extended extended_more
16140Starting code units: a b c
16141Subject length lower bound = 1
16142
16143/[a b c]/B,extended_more
16144------------------------------------------------------------------
16145        Bra
16146        [a-c]
16147        Ket
16148        End
16149------------------------------------------------------------------
16150
16151/[ a b c ]/B,extended_more
16152------------------------------------------------------------------
16153        Bra
16154        [a-c]
16155        Ket
16156        End
16157------------------------------------------------------------------
16158
16159/[a b](?xx: [ 12 ] (?-xx:[ 34 ]) )y z/B
16160------------------------------------------------------------------
16161        Bra
16162        [ ab]
16163        Bra
16164        [12]
16165        Bra
16166        [ 34]
16167        Ket
16168        Ket
16169        y z
16170        Ket
16171        End
16172------------------------------------------------------------------
16173
16174# Unsetting /x also unsets /xx
16175
16176/[a b](?xx: [ 12 ] (?-x:[ 34 ]) )y z/B
16177------------------------------------------------------------------
16178        Bra
16179        [ ab]
16180        Bra
16181        [12]
16182        Bra
16183        [ 34]
16184        Ket
16185        Ket
16186        y z
16187        Ket
16188        End
16189------------------------------------------------------------------
16190
16191/(a)(?-n:(b))(c)/nB
16192------------------------------------------------------------------
16193        Bra
16194        Bra
16195        a
16196        Ket
16197        Bra
16198        CBra 1
16199        b
16200        Ket
16201        Ket
16202        Bra
16203        c
16204        Ket
16205        Ket
16206        End
16207------------------------------------------------------------------
16208
16209# ----------------------------------------------------------------------
16210# These test the dangerous PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL option.
16211
16212/\j\x{z}\o{82}\L\uabcd\u\U\g{\g/B,\bad_escape_is_literal
16213** Unrecognized modifier '\' in '\bad_escape_is_literal'
16214
16215/\N{\c/IB,bad_escape_is_literal
16216------------------------------------------------------------------
16217        Bra
16218        N{c
16219        Ket
16220        End
16221------------------------------------------------------------------
16222Capture group count = 0
16223Extra options: bad_escape_is_literal
16224First code unit = 'N'
16225Last code unit = 'c'
16226Subject length lower bound = 3
16227
16228/[\j\x{z}\o\gAb\g]/B,bad_escape_is_literal
16229------------------------------------------------------------------
16230        Bra
16231        [Abgjoxz{}]
16232        Ket
16233        End
16234------------------------------------------------------------------
16235
16236/[Q-\N]/B,bad_escape_is_literal
16237Failed: error 150 at offset 5: invalid range in character class
16238
16239/[\s-_]/bad_escape_is_literal
16240Failed: error 150 at offset 3: invalid range in character class
16241
16242/[_-\s]/bad_escape_is_literal
16243Failed: error 150 at offset 5: invalid range in character class
16244
16245/[\B\R\X]/B
16246Failed: error 107 at offset 2: escape sequence is invalid in character class
16247
16248/[\B\R\X]/B,bad_escape_is_literal
16249Failed: error 107 at offset 2: escape sequence is invalid in character class
16250
16251/[A-\BP-\RV-\X]/B
16252Failed: error 107 at offset 4: escape sequence is invalid in character class
16253
16254/[A-\BP-\RV-\X]/B,bad_escape_is_literal
16255Failed: error 107 at offset 4: escape sequence is invalid in character class
16256
16257# ----------------------------------------------------------------------
16258
16259/a\b(c/literal
16260    a\\b(c
16261 0: a\b(c
16262
16263/a\b(c/literal,caseless
16264    a\\b(c
16265 0: a\b(c
16266    a\\B(c
16267 0: a\B(c
16268
16269/a\b(c/literal,firstline
16270    XYYa\\b(c
16271 0: a\b(c
16272\= Expect no match
16273    X\na\\b(c
16274No match
16275
16276/a\b?c/literal,use_offset_limit
16277    XXXXa\\b?c\=offset_limit=4
16278 0: a\b?c
16279\= Expect no match
16280    XXXXa\\b?c\=offset_limit=3
16281No match
16282
16283/a\b(c/literal,anchored,endanchored
16284    a\\b(c
16285 0: a\b(c
16286\= Expect no match
16287    Xa\\b(c
16288No match
16289    a\\b(cX
16290No match
16291    Xa\\b(cX
16292No match
16293
16294//literal,extended
16295Failed: error 192 at offset 0: invalid option bits with PCRE2_LITERAL
16296
16297/a\b(c/literal,auto_callout,no_start_optimize
16298    XXXXa\\b(c
16299--->XXXXa\b(c
16300 +0 ^             a
16301 +0  ^            a
16302 +0   ^           a
16303 +0    ^          a
16304 +0     ^         a
16305 +1     ^^        \
16306 +2     ^ ^       b
16307 +3     ^  ^      (
16308 +4     ^   ^     c
16309 +5     ^    ^    End of pattern
16310 0: a\b(c
16311
16312/a\b(c/literal,auto_callout
16313    XXXXa\\b(c
16314--->XXXXa\b(c
16315 +0     ^         a
16316 +1     ^^        \
16317 +2     ^ ^       b
16318 +3     ^  ^      (
16319 +4     ^   ^     c
16320 +5     ^    ^    End of pattern
16321 0: a\b(c
16322
16323/(*CR)abc/literal
16324    (*CR)abc
16325 0: (*CR)abc
16326
16327/cat|dog/I,match_word
16328Capture group count = 0
16329Max lookbehind = 1
16330Extra options: match_word
16331Starting code units: c d
16332Subject length lower bound = 3
16333    the cat sat
16334 0: cat
16335\= Expect no match
16336    caterpillar
16337No match
16338    snowcat
16339No match
16340    syndicate
16341No match
16342
16343/(cat)|dog/I,match_line,literal
16344Capture group count = 0
16345Compile options: literal
16346Overall options: anchored literal
16347Extra options: match_line
16348First code unit = '('
16349Subject length lower bound = 9
16350    (cat)|dog
16351 0: (cat)|dog
16352\= Expect no match
16353    the cat sat
16354No match
16355    caterpillar
16356No match
16357    snowcat
16358No match
16359    syndicate
16360No match
16361
16362/a whole line/match_line,multiline
16363    Rhubarb \na whole line\n custard
16364 0: a whole line
16365\= Expect no match
16366    Not a whole line
16367No match
16368
16369# Perl gets this wrong, failing to capture 'b' in group 1.
16370
16371/^(b+|a){1,2}?bc/
16372    bbc
16373 0: bbc
16374 1: b
16375
16376# And again here, for the "babc" subject string.
16377
16378/^(b*|ba){1,2}?bc/
16379    babc
16380 0: babc
16381 1: ba
16382    bbabc
16383 0: bbabc
16384 1: ba
16385    bababc
16386 0: bababc
16387 1: ba
16388\= Expect no match
16389    bababbc
16390No match
16391    babababc
16392No match
16393
16394/[[:digit:]-a]/
16395Failed: error 150 at offset 10: invalid range in character class
16396
16397/[[:digit:]-[:print:]]/
16398Failed: error 150 at offset 10: invalid range in character class
16399
16400/[\d-a]/
16401Failed: error 150 at offset 3: invalid range in character class
16402
16403/[\H-z]/
16404Failed: error 150 at offset 3: invalid range in character class
16405
16406/[\d-[:print:]]/
16407Failed: error 150 at offset 3: invalid range in character class
16408
16409# Perl gets the second of these wrong, giving no match.
16410
16411"(?<=(a))\1?b"I
16412Capture group count = 1
16413Max back reference = 1
16414Max lookbehind = 1
16415Last code unit = 'b'
16416Subject length lower bound = 1
16417    ab
16418 0: b
16419 1: a
16420    aaab
16421 0: ab
16422 1: a
16423
16424"(?=(a))\1?b"I
16425Capture group count = 1
16426Max back reference = 1
16427First code unit = 'a'
16428Last code unit = 'b'
16429Subject length lower bound = 2
16430    ab
16431 0: ab
16432 1: a
16433    aaab
16434 0: ab
16435 1: a
16436
16437# JIT does not support callout_extra
16438
16439/(*NO_JIT)(a+)b/auto_callout,no_start_optimize,no_auto_possess
16440\= Expect no match
16441    aac\=callout_extra
16442New match attempt
16443--->aac
16444 +9 ^       (
16445+10 ^       a+
16446+12 ^ ^     )
16447+13 ^ ^     b
16448Backtrack
16449--->aac
16450+12 ^^      )
16451+13 ^^      b
16452Backtrack
16453No other matching paths
16454New match attempt
16455--->aac
16456 +9  ^      (
16457+10  ^      a+
16458+12  ^^     )
16459+13  ^^     b
16460Backtrack
16461No other matching paths
16462New match attempt
16463--->aac
16464 +9   ^     (
16465+10   ^     a+
16466Backtrack
16467No other matching paths
16468New match attempt
16469--->aac
16470 +9    ^    (
16471+10    ^    a+
16472No match
16473
16474/(*NO_JIT)a+(?C'XXX')b/no_start_optimize,no_auto_possess
16475\= Expect no match
16476    aac\=callout_extra
16477New match attempt
16478Callout (15): 'XXX'
16479--->aac
16480    ^ ^     b
16481Backtrack
16482Callout (15): 'XXX'
16483--->aac
16484    ^^      b
16485Backtrack
16486No other matching paths
16487New match attempt
16488Callout (15): 'XXX'
16489--->aac
16490     ^^     b
16491No match
16492
16493/\n/firstline
16494    xyz\nabc
16495 0: \x0a
16496
16497/\nabc/firstline
16498    xyz\nabc
16499 0: \x0aabc
16500
16501/\x{0a}abc/firstline,newline=crlf
16502\= Expect no match
16503    xyz\r\nabc
16504No match
16505
16506/[abc]/firstline
16507\= Expect no match
16508    \na
16509No match
16510
16511# These tests are matched in test 1 as they are Perl compatible. Here we are
16512# looking at what does and does not get auto-possessified.
16513
16514/(?(DEFINE)(?<optional_a>a?))^(?&optional_a)a$/B
16515------------------------------------------------------------------
16516        Bra
16517        Cond
16518        Cond false
16519        CBra 1
16520        a?
16521        Ket
16522        Ket
16523        ^
16524        Recurse
16525        a
16526        $
16527        Ket
16528        End
16529------------------------------------------------------------------
16530
16531/(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/B
16532------------------------------------------------------------------
16533        Bra
16534        Cond
16535        Cond false
16536        CBra 1
16537        a?
16538        Ket
16539        X
16540        Ket
16541        ^
16542        Recurse
16543        a
16544        $
16545        Ket
16546        End
16547------------------------------------------------------------------
16548
16549/^(a?)b(?1)a/B
16550------------------------------------------------------------------
16551        Bra
16552        ^
16553        CBra 1
16554        a?
16555        Ket
16556        b
16557        Recurse
16558        a
16559        Ket
16560        End
16561------------------------------------------------------------------
16562
16563/^(a?)+b(?1)a/B
16564------------------------------------------------------------------
16565        Bra
16566        ^
16567        SCBra 1
16568        a?
16569        KetRmax
16570        b
16571        Recurse
16572        a
16573        Ket
16574        End
16575------------------------------------------------------------------
16576
16577/^(a?)++b(?1)a/B
16578------------------------------------------------------------------
16579        Bra
16580        ^
16581        SCBraPos 1
16582        a?
16583        KetRpos
16584        b
16585        Recurse
16586        a
16587        Ket
16588        End
16589------------------------------------------------------------------
16590
16591/^(a?)+b/B
16592------------------------------------------------------------------
16593        Bra
16594        ^
16595        SCBra 1
16596        a?
16597        KetRmax
16598        b
16599        Ket
16600        End
16601------------------------------------------------------------------
16602
16603/(?=a+)a(a+)++b/B
16604------------------------------------------------------------------
16605        Bra
16606        Assert
16607        a++
16608        Ket
16609        a
16610        CBraPos 1
16611        a++
16612        KetRpos
16613        b
16614        Ket
16615        End
16616------------------------------------------------------------------
16617
16618/(?<=(?=.){4,5}x)/B
16619------------------------------------------------------------------
16620        Bra
16621        Assert back
16622        Reverse
16623        Assert
16624        Any
16625        Ket
16626        Assert
16627        Any
16628        Ket
16629        Assert
16630        Any
16631        Ket
16632        Assert
16633        Any
16634        Ket
16635        Brazero
16636        Assert
16637        Any
16638        Ket
16639        x
16640        Ket
16641        Ket
16642        End
16643------------------------------------------------------------------
16644
16645# Perl behaves differently with these when optimization is turned off
16646
16647/a(*PRUNE:X)bc|qq/mark,no_start_optimize
16648\= Expect no match
16649    axy
16650No match, mark = X
16651
16652/a(*THEN:X)bc|qq/mark,no_start_optimize
16653\= Expect no match
16654    axy
16655No match, mark = X
16656
16657/(?^x-i)AB/
16658Failed: error 194 at offset 4: invalid hyphen in option setting
16659
16660/(?^-i)AB/
16661Failed: error 194 at offset 3: invalid hyphen in option setting
16662
16663/(?x-i-i)/
16664Failed: error 194 at offset 5: invalid hyphen in option setting
16665
16666/(?(?=^))b/I
16667Capture group count = 0
16668Last code unit = 'b'
16669Subject length lower bound = 1
16670    abc
16671 0: b
16672
16673/(?(?=^)|)b/I
16674Capture group count = 0
16675First code unit = 'b'
16676Subject length lower bound = 1
16677    abc
16678 0: b
16679
16680/(?(?=^)|^)b/I
16681Capture group count = 0
16682Compile options: <none>
16683Overall options: anchored
16684First code unit = 'b'
16685Subject length lower bound = 1
16686    bbc
16687 0: b
16688\= Expect no match
16689    abc
16690No match
16691
16692/(?(1)^|^())/I
16693Capture group count = 1
16694Max back reference = 1
16695May match empty string
16696Compile options: <none>
16697Overall options: anchored
16698Subject length lower bound = 0
16699
16700/(?(1)^())b/I
16701Capture group count = 1
16702Max back reference = 1
16703Last code unit = 'b'
16704Subject length lower bound = 1
16705
16706/(?(1)^())+b/I,aftertext
16707Capture group count = 1
16708Max back reference = 1
16709Last code unit = 'b'
16710Subject length lower bound = 1
16711    abc
16712 0: b
16713 0+ c
16714
16715/(?(1)^()|^)+b/I,aftertext
16716Capture group count = 1
16717Max back reference = 1
16718Compile options: <none>
16719Overall options: anchored
16720First code unit = 'b'
16721Subject length lower bound = 1
16722    bbc
16723 0: b
16724 0+ bc
16725\= Expect no match
16726    abc
16727No match
16728
16729/(?(1)^()|^)*b/I,aftertext
16730Capture group count = 1
16731Max back reference = 1
16732First code unit = 'b'
16733Subject length lower bound = 1
16734    bbc
16735 0: b
16736 0+ bc
16737    abc
16738 0: b
16739 0+ c
16740    xbc
16741 0: b
16742 0+ c
16743
16744/(?(1)^())+b/I,aftertext
16745Capture group count = 1
16746Max back reference = 1
16747Last code unit = 'b'
16748Subject length lower bound = 1
16749    abc
16750 0: b
16751 0+ c
16752
16753/(?(1)^a()|^a)+b/I,aftertext
16754Capture group count = 1
16755Max back reference = 1
16756Compile options: <none>
16757Overall options: anchored
16758First code unit = 'a'
16759Last code unit = 'b'
16760Subject length lower bound = 2
16761    abc
16762 0: ab
16763 0+ c
16764\= Expect no match
16765    bbc
16766No match
16767
16768/(?(1)^|^(a))+b/I,aftertext
16769Capture group count = 1
16770Max back reference = 1
16771Compile options: <none>
16772Overall options: anchored
16773Last code unit = 'b'
16774Subject length lower bound = 1
16775    abc
16776 0: ab
16777 0+ c
16778 1: a
16779\= Expect no match
16780    bbc
16781No match
16782
16783/(?(1)^a()|^a)*b/I,aftertext
16784Capture group count = 1
16785Max back reference = 1
16786Last code unit = 'b'
16787Subject length lower bound = 1
16788    abc
16789 0: ab
16790 0+ c
16791    bbc
16792 0: b
16793 0+ bc
16794    xbc
16795 0: b
16796 0+ c
16797
16798/a(b)c|xyz/g,allvector,replace=<$0>
16799    abcdefabcpqr\=ovector=4
16800 2: <abc>def<abc>pqr
16801 0: 6 9
16802 1: 7 8
16803 2: <unchanged>
16804 3: <unchanged>
16805    abxyz\=ovector=4
16806 1: ab<xyz>
16807 0: 2 5
16808 1: <unset>
16809 2: <unchanged>
16810 3: <unchanged>
16811    abcdefxyz\=ovector=4
16812 2: <abc>def<xyz>
16813 0: 6 9
16814 1: <unset>
16815 2: <unchanged>
16816 3: <unchanged>
16817
16818/a(b)c|xyz/allvector
16819    abcdef\=ovector=4
16820 0: abc
16821 1: b
16822 2: <unchanged>
16823 3: <unchanged>
16824    abxyz\=ovector=4
16825 0: xyz
16826 1: <unset>
16827 2: <unchanged>
16828 3: <unchanged>
16829
16830/a(b)c|xyz/g,replace=<$0>,substitute_callout
16831    abcdefabcpqr
16832 1(2) Old 0 3 "abc" New 0 5 "<abc>"
16833 2(2) Old 6 9 "abc" New 8 13 "<abc>"
16834 2: <abc>def<abc>pqr
16835    abxyzpqrabcxyz
16836 1(1) Old 2 5 "xyz" New 2 7 "<xyz>"
16837 2(2) Old 8 11 "abc" New 10 15 "<abc>"
16838 3(1) Old 11 14 "xyz" New 15 20 "<xyz>"
16839 3: ab<xyz>pqr<abc><xyz>
16840    12abc34xyz99abc55\=substitute_stop=2
16841 1(2) Old 2 5 "abc" New 2 7 "<abc>"
16842 2(1) Old 7 10 "xyz" New 9 14 "<xyz> STOPPED"
16843 2: 12<abc>34xyz99abc55
16844    12abc34xyz99abc55\=substitute_skip=1
16845 1(2) Old 2 5 "abc" New 2 7 "<abc> SKIPPED"
16846 2(1) Old 7 10 "xyz" New 7 12 "<xyz>"
16847 3(2) Old 12 15 "abc" New 14 19 "<abc>"
16848 3: 12abc34<xyz>99<abc>55
16849    12abc34xyz99abc55\=substitute_skip=2
16850 1(2) Old 2 5 "abc" New 2 7 "<abc>"
16851 2(1) Old 7 10 "xyz" New 9 14 "<xyz> SKIPPED"
16852 3(2) Old 12 15 "abc" New 14 19 "<abc>"
16853 3: 12<abc>34xyz99<abc>55
16854
16855/a(b)c|xyz/g,replace=<$0>
16856    abcdefabcpqr
16857 2: <abc>def<abc>pqr
16858    abxyzpqrabcxyz
16859 3: ab<xyz>pqr<abc><xyz>
16860    12abc34xyz\=substitute_stop=2
16861 1(2) Old 2 5 "abc" New 2 7 "<abc>"
16862 2(1) Old 7 10 "xyz" New 9 14 "<xyz> STOPPED"
16863 2: 12<abc>34xyz
16864    12abc34xyz\=substitute_skip=1
16865 1(2) Old 2 5 "abc" New 2 7 "<abc> SKIPPED"
16866 2(1) Old 7 10 "xyz" New 7 12 "<xyz>"
16867 2: 12abc34<xyz>
16868
16869/a(b)c|xyz/replace=<$0>
16870    abcdefabcpqr
16871 1: <abc>defabcpqr
16872    12abc34xyz\=substitute_skip=1
16873 1(2) Old 2 5 "abc" New 2 7 "<abc> SKIPPED"
16874 1: 12abc34xyz
16875    12abc34xyz\=substitute_stop=1
16876 1(2) Old 2 5 "abc" New 2 7 "<abc> STOPPED"
16877 1: 12abc34xyz
16878
16879/abc\rdef/
16880    abc\ndef
16881No match
16882
16883/abc\rdef\x{0d}xyz/escaped_cr_is_lf
16884    abc\ndef\rxyz
16885 0: abc\x0adef\x0dxyz
16886\= Expect no match
16887    abc\ndef\nxyz
16888No match
16889
16890/(?(*ACCEPT)xxx)/
16891Failed: error 128 at offset 2: assertion expected after (?( or (?(?C)
16892
16893/(?(*atomic:xx)xxx)/
16894Failed: error 128 at offset 10: assertion expected after (?( or (?(?C)
16895
16896/(?(*script_run:xxx)zzz)/
16897Failed: error 128 at offset 14: assertion expected after (?( or (?(?C)
16898
16899/foobar/
16900    the foobar thing\=copy_matched_subject
16901 0: foobar
16902    the foobar thing\=copy_matched_subject,zero_terminate
16903 0: foobar
16904
16905/foobar/g
16906    the foobar thing foobar again\=copy_matched_subject
16907 0: foobar
16908 0: foobar
16909
16910/(*:XX)^abc/I
16911Capture group count = 0
16912Compile options: <none>
16913Overall options: anchored
16914First code unit = 'a'
16915Subject length lower bound = 3
16916
16917/(*COMMIT:XX)^abc/I
16918Capture group count = 0
16919Compile options: <none>
16920Overall options: anchored
16921First code unit = 'a'
16922Subject length lower bound = 3
16923
16924/(*ACCEPT:XX)^abc/I
16925Capture group count = 0
16926May match empty string
16927Subject length lower bound = 0
16928
16929/abc/replace=xyz
16930    abc\=null_context
16931 1: xyz
16932
16933/abc/replace=xyz,substitute_callout
16934    abc
16935 1(1) Old 0 3 "abc" New 0 3 "xyz"
16936 1: xyz
16937\= Expect error message
16938    abc\=null_context
16939** Replacement callouts are not supported with null_context.
16940
16941/\[()]{65535}()/expand
16942Failed: error 197 at offset 131071: too many capturing groups (maximum 65535)
16943
16944/\[()]{65535}(?<A>)/expand
16945Failed: error 197 at offset 131075: too many capturing groups (maximum 65535)
16946
16947/a(?:(*ACCEPT))??bc/
16948    abc
16949 0: abc
16950    axy
16951 0: a
16952
16953/a(*ACCEPT)??bc/
16954    abc
16955 0: abc
16956    axy
16957 0: a
16958
16959/a(*ACCEPT:XX)??bc/mark
16960    abc
16961 0: abc
16962    axy
16963 0: a
16964MK: XX
16965
16966/(*:\)?/
16967Failed: error 109 at offset 5: quantifier does not follow a repeatable item
16968
16969/(*:\Q \E){5}/alt_verbnames
16970Failed: error 109 at offset 11: quantifier does not follow a repeatable item
16971
16972/(?=abc)/I
16973Capture group count = 0
16974May match empty string
16975First code unit = 'a'
16976Last code unit = 'c'
16977Subject length lower bound = 2
16978
16979/(?|(X)|(XY))\1abc/I
16980Capture group count = 1
16981Max back reference = 1
16982First code unit = 'X'
16983Last code unit = 'c'
16984Subject length lower bound = 4
16985
16986/(?|(a)|(bcde))(c)\2/I
16987Capture group count = 2
16988Max back reference = 2
16989Starting code units: a b
16990Last code unit = 'c'
16991Subject length lower bound = 3
16992
16993/(?|(a)|(bcde))(c)\1/I
16994Capture group count = 2
16995Max back reference = 1
16996Starting code units: a b
16997Last code unit = 'c'
16998Subject length lower bound = 2
16999
17000/(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'B'(?'A')/I,dupnames
17001Capture group count = 3
17002Max back reference = 2
17003Named capture groups:
17004  A   1
17005  A   3
17006  B   2
17007Options: dupnames
17008Starting code units: a b
17009Last code unit = 'c'
17010Subject length lower bound = 3
17011
17012/(?|(?'A'a)|(?'A'bcde))(?'B'c)\k'A'(?'A')/I,dupnames
17013Capture group count = 3
17014Max back reference = 3
17015Named capture groups:
17016  A   1
17017  A   3
17018  B   2
17019Options: dupnames
17020Starting code units: a b
17021Last code unit = 'c'
17022Subject length lower bound = 2
17023
17024/((a|)+)+Z/I
17025Capture group count = 2
17026Starting code units: Z a
17027Last code unit = 'Z'
17028Subject length lower bound = 1
17029
17030/((?=a))[abcd]/I
17031Capture group count = 1
17032First code unit = 'a'
17033Subject length lower bound = 1
17034
17035/A(?:(*ACCEPT))?B/info
17036Capture group count = 0
17037First code unit = 'A'
17038Subject length lower bound = 1
17039
17040/(A(*ACCEPT)??B)C/
17041    ABC
17042 0: ABC
17043 1: AB
17044    AXY
17045 0: A
17046 1: A
17047
17048/(?<=(?<=a)b)c.*/I
17049Capture group count = 0
17050Max lookbehind = 1
17051First code unit = 'c'
17052Subject length lower bound = 1
17053    abc\=ph
17054Partial match: c
17055\= Expect no match
17056    xbc\=ph
17057No match
17058
17059/(?<=ab)c.*/I
17060Capture group count = 0
17061Max lookbehind = 2
17062First code unit = 'c'
17063Subject length lower bound = 1
17064    abc\=ph
17065Partial match: c
17066\= Expect no match
17067    xbc\=ph
17068No match
17069
17070/(?<=a(?<=a|a)c)/I
17071Capture group count = 0
17072Max lookbehind = 2
17073May match empty string
17074Subject length lower bound = 0
17075
17076/(?<=a(?<=a|ba)c)/I
17077Capture group count = 0
17078Max lookbehind = 2
17079May match empty string
17080Subject length lower bound = 0
17081
17082/(?<=(?<=a)b)(?<!abcd)/I
17083Capture group count = 0
17084Max lookbehind = 4
17085May match empty string
17086Subject length lower bound = 0
17087
17088/(?<=(?<=a)b)(?<!abcd)(?<=(?<=a)bcde)/I
17089Capture group count = 0
17090Max lookbehind = 4
17091May match empty string
17092Subject length lower bound = 0
17093
17094# Addition overflow
17095/( {32742} {42})(?<!\1{65481})/
17096Failed: error 187 at offset 15: lookbehind assertion is too long
17097
17098# Multiplication overflow
17099/(X{65535})(?<=\1{32770})/
17100Failed: error 187 at offset 10: lookbehind assertion is too long
17101
17102# ---- Non-atomic assertion tests ----
17103
17104# Expect error: not allowed as a condition
17105/(?(*napla:xx)bc)/
17106Failed: error 198 at offset 9: atomic assertion expected after (?( or (?(?C)
17107
17108/\A(*pla:.*\b(\w++))(?>.*?\b\1\b){3}/
17109    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
17110No match
17111
17112/\A(*napla:.*\b(\w++))(?>.*?\b\1\b){3}/
17113    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
17114 0: word1 word3 word1 word2 word3 word2 word2 word1 word3
17115 1: word3
17116
17117/\A(?*.*\b(\w++))(?>.*?\b\1\b){3}/
17118    word1 word3 word1 word2 word3 word2 word2 word1 word3 word4
17119 0: word1 word3 word1 word2 word3 word2 word2 word1 word3
17120 1: word3
17121
17122/(*plb:(.)..|(.)...)(\1|\2)/
17123    abcdb\=offset=4
17124 0: b
17125 1: b
17126 2: <unset>
17127 3: b
17128    abcda\=offset=4
17129No match
17130
17131/(*naplb:(.)..|(.)...)(\1|\2)/
17132    abcdb\=offset=4
17133 0: b
17134 1: b
17135 2: <unset>
17136 3: b
17137    abcda\=offset=4
17138 0: a
17139 1: <unset>
17140 2: a
17141 3: a
17142
17143/(?<*(.)..|(.)...)(\1|\2)/
17144    abcdb\=offset=4
17145 0: b
17146 1: b
17147 2: <unset>
17148 3: b
17149    abcda\=offset=4
17150 0: a
17151 1: <unset>
17152 2: a
17153 3: a
17154
17155/(*non_atomic_positive_lookahead:ab)/B
17156------------------------------------------------------------------
17157        Bra
17158        Non-atomic assert
17159        ab
17160        Ket
17161        Ket
17162        End
17163------------------------------------------------------------------
17164
17165/(*non_atomic_positive_lookbehind:ab)/B
17166------------------------------------------------------------------
17167        Bra
17168        Non-atomic assert back
17169        Reverse
17170        ab
17171        Ket
17172        Ket
17173        End
17174------------------------------------------------------------------
17175
17176/(*pla:ab+)/B
17177------------------------------------------------------------------
17178        Bra
17179        Assert
17180        a
17181        b++
17182        Ket
17183        Ket
17184        End
17185------------------------------------------------------------------
17186
17187/(*napla:ab+)/B
17188------------------------------------------------------------------
17189        Bra
17190        Non-atomic assert
17191        a
17192        b+
17193        Ket
17194        Ket
17195        End
17196------------------------------------------------------------------
17197
17198/(*napla:)+/
17199
17200/(*naplb:)+/
17201
17202/(*napla:^x|^y)/I
17203Capture group count = 0
17204May match empty string
17205Compile options: <none>
17206Overall options: anchored
17207Starting code units: x y
17208Subject length lower bound = 1
17209
17210/(*napla:abc|abd)/I
17211Capture group count = 0
17212May match empty string
17213First code unit = 'a'
17214Subject length lower bound = 1
17215
17216/(*napla:a|(.)(*ACCEPT)zz)\1../
17217    abcd
17218 0: abc
17219 1: a
17220
17221/(*napla:a(*ACCEPT)zz|(.))\1../
17222    abcd
17223 0: bcd
17224 1: b
17225
17226/(*napla:a|(*COMMIT)(.))\1\1/
17227    aabc
17228 0: aa
17229 1: a
17230\= Expect no match
17231    abbc
17232No match
17233
17234/(*napla:a|(.))\1\1/
17235    aabc
17236 0: aa
17237 1: a
17238    abbc
17239 0: bb
17240 1: b
17241
17242# ----
17243
17244# Expect error (recursion => not fixed length)
17245/(\2)((?=(?<=\1)))/
17246Failed: error 125 at offset 8: lookbehind assertion is not fixed length
17247
17248/c*+(?<=[bc])/
17249    abc\=ph
17250Partial match: c
17251    ab\=ph
17252Partial match:
17253    abc\=ps
17254 0: c
17255    ab\=ps
17256 0:
17257
17258/c++(?<=[bc])/
17259    abc\=ph
17260Partial match: c
17261    ab\=ph
17262Partial match:
17263
17264/(?<=(?=.(?<=x)))/
17265    abx
17266 0:
17267    ab\=ph
17268Partial match:
17269    bxyz
17270 0:
17271    xyz
17272 0:
17273
17274/\z/
17275   abc\=ph
17276Partial match:
17277   abc\=ps
17278 0:
17279
17280/\Z/
17281   abc\=ph
17282Partial match:
17283   abc\=ps
17284 0:
17285   abc\n\=ph
17286Partial match: \x0a
17287   abc\n\=ps
17288 0:
17289
17290/(?![ab]).*/
17291    ab\=ph
17292Partial match:
17293
17294/c*+/
17295    ab\=ph,offset=2
17296Partial match:
17297
17298/\A\s*(a|(?:[^`]{28500}){4})/I
17299Capture group count = 1
17300Max lookbehind = 1
17301Compile options: <none>
17302Overall options: anchored
17303Subject length lower bound = 1
17304    a
17305 0: a
17306 1: a
17307
17308/\A\s*((?:[^`]{28500}){4})/I
17309Capture group count = 1
17310Max lookbehind = 1
17311Compile options: <none>
17312Overall options: anchored
17313Subject length lower bound = 65535
17314
17315/\A\s*((?:[^`]{28500}){4}|a)/I
17316Capture group count = 1
17317Max lookbehind = 1
17318Compile options: <none>
17319Overall options: anchored
17320Subject length lower bound = 1
17321    a
17322 0: a
17323 1: a
17324
17325/(?<A>a)(?(<A>)b)((?<=b).*)/B
17326------------------------------------------------------------------
17327        Bra
17328        CBra 1
17329        a
17330        Ket
17331        Cond
17332      1 Cond ref
17333        b
17334        Ket
17335        CBra 2
17336        Assert back
17337        Reverse
17338        b
17339        Ket
17340        Any*+
17341        Ket
17342        Ket
17343        End
17344------------------------------------------------------------------
17345
17346/(?(1)b)((?<=b).*)/B
17347------------------------------------------------------------------
17348        Bra
17349        Cond
17350      1 Cond ref
17351        b
17352        Ket
17353        CBra 1
17354        Assert back
17355        Reverse
17356        b
17357        Ket
17358        Any*+
17359        Ket
17360        Ket
17361        End
17362------------------------------------------------------------------
17363
17364/(?(R1)b)((?<=b).*)/B
17365------------------------------------------------------------------
17366        Bra
17367        Cond
17368        Cond recurse 1
17369        b
17370        Ket
17371        CBra 1
17372        Assert back
17373        Reverse
17374        b
17375        Ket
17376        Any*+
17377        Ket
17378        Ket
17379        End
17380------------------------------------------------------------------
17381
17382/(?(DEFINE)b)((?<=b).*)/B
17383------------------------------------------------------------------
17384        Bra
17385        Cond
17386        Cond false
17387        b
17388        Ket
17389        CBra 1
17390        Assert back
17391        Reverse
17392        b
17393        Ket
17394        Any*+
17395        Ket
17396        Ket
17397        End
17398------------------------------------------------------------------
17399
17400/(?(VERSION=10.3)b)((?<=b).*)/B
17401------------------------------------------------------------------
17402        Bra
17403        Cond
17404        Cond false
17405        b
17406        Ket
17407        CBra 1
17408        Assert back
17409        Reverse
17410        b
17411        Ket
17412        Any*+
17413        Ket
17414        Ket
17415        End
17416------------------------------------------------------------------
17417
17418/[aA]b[cC]/IB
17419------------------------------------------------------------------
17420        Bra
17421     /i a
17422        b
17423     /i c
17424        Ket
17425        End
17426------------------------------------------------------------------
17427Capture group count = 0
17428First code unit = 'a' (caseless)
17429Last code unit = 'c' (caseless)
17430Subject length lower bound = 3
17431
17432/[cc]abcd/I
17433Capture group count = 0
17434First code unit = 'c'
17435Last code unit = 'd'
17436Subject length lower bound = 5
17437
17438/[Cc]abcd/I
17439Capture group count = 0
17440First code unit = 'C' (caseless)
17441Last code unit = 'd'
17442Subject length lower bound = 5
17443
17444/[c]abcd/I
17445Capture group count = 0
17446First code unit = 'c'
17447Last code unit = 'd'
17448Subject length lower bound = 5
17449
17450/(?:c|C)abcd/I
17451Capture group count = 0
17452First code unit = 'C' (caseless)
17453Last code unit = 'd'
17454Subject length lower bound = 5
17455
17456/(a)?a/I
17457Capture group count = 1
17458Starting code units: a
17459Last code unit = 'a'
17460Subject length lower bound = 1
17461    manm
17462 0: a
17463
17464/^(?|(\*)(*napla:\S*_(\2?+.+))|(\w)(?=\S*_(\2?+\1)))+_\2$/
17465    *abc_12345abc
17466 0: *abc_12345abc
17467 1: c
17468 2: 12345abc
17469
17470/^(?|(\*)(*napla:\S*_(\3?+.+))|(\w)(?=\S*_((\2?+\1))))+_\2$/
17471    *abc_12345abc
17472 0: *abc_12345abc
17473 1: c
17474 2: 12345abc
17475 3: 12345abc
17476
17477/^((\1+)(?C)|\d)+133X$/
17478    111133X\=callout_capture
17479Callout 0: last capture = 2
17480 1: 1
17481 2: 111
17482--->111133X
17483    ^   ^       |
17484Callout 0: last capture = 2
17485 1: 3
17486 2: 3
17487--->111133X
17488    ^     ^     |
17489Callout 0: last capture = 2
17490 1: 1
17491 2: 11
17492--->111133X
17493    ^  ^        |
17494Callout 0: last capture = 2
17495 1: 3
17496 2: 3
17497--->111133X
17498    ^     ^     |
17499 0: 111133X
17500 1: 11
17501 2: 11
17502
17503/abc/replace=xyz,substitute_replacement_only
17504    123abc456
17505 1: xyz
17506
17507/a(?<ONE>b)c(?<TWO>d)e/g,replace=X$ONE+${TWO}Z,substitute_replacement_only
17508    "abcde-abcde-"
17509 2: Xb+dZXb+dZ
17510
17511/a(b)c|xyz/g,replace=<$0>,substitute_callout,substitute_replacement_only
17512    abcdefabcpqr
17513 1(2) Old 0 3 "abc" New 0 5 "<abc>"
17514 2(2) Old 6 9 "abc" New 5 10 "<abc>"
17515 2: <abc><abc>
17516    abxyzpqrabcxyz
17517 1(1) Old 2 5 "xyz" New 0 5 "<xyz>"
17518 2(2) Old 8 11 "abc" New 5 10 "<abc>"
17519 3(1) Old 11 14 "xyz" New 10 15 "<xyz>"
17520 3: <xyz><abc><xyz>
17521    12abc34xyz99abc55\=substitute_stop=2
17522 1(2) Old 2 5 "abc" New 0 5 "<abc>"
17523 2(1) Old 7 10 "xyz" New 5 10 "<xyz> STOPPED"
17524 2: <abc>
17525    12abc34xyz99abc55\=substitute_skip=1
17526 1(2) Old 2 5 "abc" New 0 5 "<abc> SKIPPED"
17527 2(1) Old 7 10 "xyz" New 0 5 "<xyz>"
17528 3(2) Old 12 15 "abc" New 5 10 "<abc>"
17529 3: <xyz><abc>
17530    12abc34xyz99abc55\=substitute_skip=2
17531 1(2) Old 2 5 "abc" New 0 5 "<abc>"
17532 2(1) Old 7 10 "xyz" New 5 10 "<xyz> SKIPPED"
17533 3(2) Old 12 15 "abc" New 5 10 "<abc>"
17534 3: <abc><abc>
17535
17536/a(..)d/replace=>$1<,substitute_matched
17537    xyzabcdxyzabcdxyz
17538 1: xyz>bc<xyzabcdxyz
17539    xyzabcdxyzabcdxyz\=ovector=2
17540 1: xyz>bc<xyzabcdxyz
17541\= Expect error
17542    xyzabcdxyzabcdxyz\=ovector=1
17543Failed: error -54 at offset 3 in replacement: requested value is not available
17544
17545/a(..)d/g,replace=>$1<,substitute_matched
17546    xyzabcdxyzabcdxyz
17547 2: xyz>bc<xyz>bc<xyz
17548    xyzabcdxyzabcdxyz\=ovector=2
17549 2: xyz>bc<xyz>bc<xyz
17550\= Expect error
17551    xyzabcdxyzabcdxyz\=ovector=1
17552Failed: error -54 at offset 3 in replacement: requested value is not available
17553    xyzabcdxyzabcdxyz\=ovector=1,substitute_unset_empty
17554Failed: error -54 at offset 3 in replacement: requested value is not available
17555
17556/55|a(..)d/g,replace=>$1<,substitute_matched
17557    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
17558 3: xyz><>bc<xyz>bc<xyz
17559\= Expect error
17560    xyz55abcdxyzabcdxyz\=ovector=2
17561Failed: error -55 at offset 3 in replacement: requested value is not set
17562
17563/55|a(..)d/replace=>$1<,substitute_matched
17564    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
17565 1: xyz><abcdxyzabcdxyz
17566
17567/55|a(..)d/replace=>$1<
17568    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
17569 1: xyz><abcdxyzabcdxyz
17570
17571/55|a(..)d/g,replace=>$1<
17572    xyz55abcdxyzabcdxyz\=ovector=2,substitute_unset_empty
17573 3: xyz><>bc<xyz>bc<xyz
17574
17575/abc/replace=,caseless
17576    XabcY
17577 0: abc
17578    XABCY
17579 0: ABC
17580
17581/abc/replace=[4],caseless
17582    XabcY
17583 1: XY
17584    XABCY
17585 1: XY
17586
17587/abc/replace=*,caseless
17588    XabcY
17589 1: X*Y
17590    XABCY
17591 1: X*Y
17592    XabcY\=replace=
17593 0: abc
17594
17595# Expect non-fixed-length error
17596
17597"(?<=X(?(DEFINE)(.*))(?1))."
17598Failed: error 125 at offset 0: lookbehind assertion is not fixed length
17599
17600/\sxxx\s/tables=1
17601\= Expect no match
17602    AB\x{85}xxx\x{a0}XYZ
17603No match
17604
17605/\sxxx\s/tables=2
17606    AB\x{85}xxx\x{a0}XYZ
17607 0: \x85xxx\xa0
17608
17609/^\w+/tables=2
17610    École
17611 0: \xc3
17612
17613/^\w+/tables=3
17614** 'Tables = 3' is invalid: binary tables have not been loaded
17615    École
17616
17617#loadtables ./testbtables
17618
17619/^\w+/tables=3
17620    École
17621 0: \xc3
17622
17623/"(*MARK:>" 00 "<).."/hex,mark,no_start_optimize
17624    AB
17625 0: AB
17626MK: >\x00<
17627    A\=ph
17628Partial match, mark=>\x00<: A
17629\= Expect no match
17630    A
17631No match, mark = >\x00<
17632
17633/"(*MARK:>" 00 "<).(?C1)."/hex,mark,no_start_optimize
17634    AB
17635--->AB
17636  1 ^^     .
17637Latest Mark: >\x00<
17638 0: AB
17639MK: >\x00<
17640
17641/(?(VERSION=0.0/
17642Failed: error 179 at offset 14: syntax error or number too big in (?(VERSION condition
17643
17644# Perl has made \K in lookarounds an error. PCRE2 now rejects as well, unless
17645# explicitly authorized.
17646
17647/(?=a\Kb)ab/
17648Failed: error 199 at offset 10: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)
17649
17650/(?=a\Kb)ab/allow_lookaround_bsk
17651    ab
17652 0: b
17653
17654/(?!a\Kb)ac/
17655Failed: error 199 at offset 10: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)
17656
17657/(?!a\Kb)ac/allow_lookaround_bsk
17658    ac
17659 0: ac
17660
17661/^abc(?<=b\Kc)d/
17662Failed: error 199 at offset 14: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)
17663
17664/^abc(?<=b\Kc)d/allow_lookaround_bsk
17665    abcd
17666 0: cd
17667
17668/^abc(?<!b\Kq)d/
17669Failed: error 199 at offset 14: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)
17670
17671/^abc(?<!b\Kq)d/,allow_lookaround_bsk
17672    abcd
17673 0: abcd
17674
17675# ---------
17676
17677# Tests for zero-length NULL to be treated as an empty string.
17678
17679//
17680    \=null_subject
17681 0:
17682\= Expect error
17683    abc\=null_subject
17684Failed: error -51: NULL argument passed with non-zero length
17685
17686//replace=[20]
17687    abc\=null_replacement
17688 1: abc
17689    \=null_subject
17690 1:
17691    \=null_replacement
17692 1:
17693
17694/X*/g,replace=xy
17695\= Expect error
17696    >X<\=null_replacement
17697Failed: error -51: NULL argument passed with non-zero length
17698
17699/X+/replace=[20]
17700    >XX<\=null_replacement
17701 1: ><
17702
17703# ---------
17704
17705/[Aa]{2}/BI
17706------------------------------------------------------------------
17707        Bra
17708     /i A{2}
17709        Ket
17710        End
17711------------------------------------------------------------------
17712Capture group count = 0
17713First code unit = 'A' (caseless)
17714Last code unit = 'A' (caseless)
17715Subject length lower bound = 2
17716    aabcd
17717 0: aa
17718
17719/A{2}/iBI
17720------------------------------------------------------------------
17721        Bra
17722     /i A{2}
17723        Ket
17724        End
17725------------------------------------------------------------------
17726Capture group count = 0
17727Options: caseless
17728First code unit = 'A' (caseless)
17729Last code unit = 'A' (caseless)
17730Subject length lower bound = 2
17731    aabcd
17732 0: aa
17733
17734/[Aa]{2,3}/BI
17735------------------------------------------------------------------
17736        Bra
17737     /i A{2}
17738     /i A?+
17739        Ket
17740        End
17741------------------------------------------------------------------
17742Capture group count = 0
17743First code unit = 'A' (caseless)
17744Last code unit = 'A' (caseless)
17745Subject length lower bound = 2
17746    aabcd
17747 0: aa
17748
17749--
17750    \[X]{-10}
17751** Zero or negative repeat not allowed
17752
17753# Check imposition of maximum by match_data_create().
17754
17755/abcd/
17756    abcd\=ovector=65536
17757 0: abcd
17758
17759# End of testinput2
17760Error -70: PCRE2_ERROR_BADDATA (unknown error number)
17761Error -62: bad serialized data
17762Error -2: partial match
17763Error -1: no match
17764Error 0: PCRE2_ERROR_BADDATA (unknown error number)
17765Error 100: no error
17766Error 101: \ at end of pattern
17767Error 191: PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is not allowed in UTF-16 mode
17768Error 200: PCRE2_ERROR_BADDATA (unknown error number)
17769