1/-- This set of tests is for features that are compatible with all versions of
2    Perl >= 5.10, in non-UTF-8 mode. It should run clean for the 8-bit, 16-bit,
3    and 32-bit PCRE libraries. --/
4
5< forbid 89?=ABCDEFfGILMNPTUWXZ<
6
7/the quick brown fox/
8    the quick brown fox
9 0: the quick brown fox
10    The quick brown FOX
11No match
12    What do you know about the quick brown fox?
13 0: the quick brown fox
14    What do you know about THE QUICK BROWN FOX?
15No match
16
17/The quick brown fox/i
18    the quick brown fox
19 0: the quick brown fox
20    The quick brown FOX
21 0: The quick brown FOX
22    What do you know about the quick brown fox?
23 0: the quick brown fox
24    What do you know about THE QUICK BROWN FOX?
25 0: THE QUICK BROWN FOX
26
27/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
28    abcd\t\n\r\f\a\e9;\$\\?caxyz
29 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz
30
31/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
32    abxyzpqrrrabbxyyyypqAzz
33 0: abxyzpqrrrabbxyyyypqAzz
34    abxyzpqrrrabbxyyyypqAzz
35 0: abxyzpqrrrabbxyyyypqAzz
36    aabxyzpqrrrabbxyyyypqAzz
37 0: aabxyzpqrrrabbxyyyypqAzz
38    aaabxyzpqrrrabbxyyyypqAzz
39 0: aaabxyzpqrrrabbxyyyypqAzz
40    aaaabxyzpqrrrabbxyyyypqAzz
41 0: aaaabxyzpqrrrabbxyyyypqAzz
42    abcxyzpqrrrabbxyyyypqAzz
43 0: abcxyzpqrrrabbxyyyypqAzz
44    aabcxyzpqrrrabbxyyyypqAzz
45 0: aabcxyzpqrrrabbxyyyypqAzz
46    aaabcxyzpqrrrabbxyyyypAzz
47 0: aaabcxyzpqrrrabbxyyyypAzz
48    aaabcxyzpqrrrabbxyyyypqAzz
49 0: aaabcxyzpqrrrabbxyyyypqAzz
50    aaabcxyzpqrrrabbxyyyypqqAzz
51 0: aaabcxyzpqrrrabbxyyyypqqAzz
52    aaabcxyzpqrrrabbxyyyypqqqAzz
53 0: aaabcxyzpqrrrabbxyyyypqqqAzz
54    aaabcxyzpqrrrabbxyyyypqqqqAzz
55 0: aaabcxyzpqrrrabbxyyyypqqqqAzz
56    aaabcxyzpqrrrabbxyyyypqqqqqAzz
57 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz
58    aaabcxyzpqrrrabbxyyyypqqqqqqAzz
59 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz
60    aaaabcxyzpqrrrabbxyyyypqAzz
61 0: aaaabcxyzpqrrrabbxyyyypqAzz
62    abxyzzpqrrrabbxyyyypqAzz
63 0: abxyzzpqrrrabbxyyyypqAzz
64    aabxyzzzpqrrrabbxyyyypqAzz
65 0: aabxyzzzpqrrrabbxyyyypqAzz
66    aaabxyzzzzpqrrrabbxyyyypqAzz
67 0: aaabxyzzzzpqrrrabbxyyyypqAzz
68    aaaabxyzzzzpqrrrabbxyyyypqAzz
69 0: aaaabxyzzzzpqrrrabbxyyyypqAzz
70    abcxyzzpqrrrabbxyyyypqAzz
71 0: abcxyzzpqrrrabbxyyyypqAzz
72    aabcxyzzzpqrrrabbxyyyypqAzz
73 0: aabcxyzzzpqrrrabbxyyyypqAzz
74    aaabcxyzzzzpqrrrabbxyyyypqAzz
75 0: aaabcxyzzzzpqrrrabbxyyyypqAzz
76    aaaabcxyzzzzpqrrrabbxyyyypqAzz
77 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz
78    aaaabcxyzzzzpqrrrabbbxyyyypqAzz
79 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz
80    aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
81 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
82    aaabcxyzpqrrrabbxyyyypABzz
83 0: aaabcxyzpqrrrabbxyyyypABzz
84    aaabcxyzpqrrrabbxyyyypABBzz
85 0: aaabcxyzpqrrrabbxyyyypABBzz
86    >>>aaabxyzpqrrrabbxyyyypqAzz
87 0: aaabxyzpqrrrabbxyyyypqAzz
88    >aaaabxyzpqrrrabbxyyyypqAzz
89 0: aaaabxyzpqrrrabbxyyyypqAzz
90    >>>>abcxyzpqrrrabbxyyyypqAzz
91 0: abcxyzpqrrrabbxyyyypqAzz
92    *** Failers
93No match
94    abxyzpqrrabbxyyyypqAzz
95No match
96    abxyzpqrrrrabbxyyyypqAzz
97No match
98    abxyzpqrrrabxyyyypqAzz
99No match
100    aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
101No match
102    aaaabcxyzzzzpqrrrabbbxyyypqAzz
103No match
104    aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
105No match
106
107/^(abc){1,2}zz/
108    abczz
109 0: abczz
110 1: abc
111    abcabczz
112 0: abcabczz
113 1: abc
114    *** Failers
115No match
116    zz
117No match
118    abcabcabczz
119No match
120    >>abczz
121No match
122
123/^(b+?|a){1,2}?c/
124    bc
125 0: bc
126 1: b
127    bbc
128 0: bbc
129 1: b
130    bbbc
131 0: bbbc
132 1: bb
133    bac
134 0: bac
135 1: a
136    bbac
137 0: bbac
138 1: a
139    aac
140 0: aac
141 1: a
142    abbbbbbbbbbbc
143 0: abbbbbbbbbbbc
144 1: bbbbbbbbbbb
145    bbbbbbbbbbbac
146 0: bbbbbbbbbbbac
147 1: a
148    *** Failers
149No match
150    aaac
151No match
152    abbbbbbbbbbbac
153No match
154
155/^(b+|a){1,2}c/
156    bc
157 0: bc
158 1: b
159    bbc
160 0: bbc
161 1: bb
162    bbbc
163 0: bbbc
164 1: bbb
165    bac
166 0: bac
167 1: a
168    bbac
169 0: bbac
170 1: a
171    aac
172 0: aac
173 1: a
174    abbbbbbbbbbbc
175 0: abbbbbbbbbbbc
176 1: bbbbbbbbbbb
177    bbbbbbbbbbbac
178 0: bbbbbbbbbbbac
179 1: a
180    *** Failers
181No match
182    aaac
183No match
184    abbbbbbbbbbbac
185No match
186
187/^(b+|a){1,2}?bc/
188    bbc
189 0: bbc
190 1: b
191
192/^(b*|ba){1,2}?bc/
193    babc
194 0: babc
195 1: ba
196    bbabc
197 0: bbabc
198 1: ba
199    bababc
200 0: bababc
201 1: ba
202    *** Failers
203No match
204    bababbc
205No match
206    babababc
207No match
208
209/^(ba|b*){1,2}?bc/
210    babc
211 0: babc
212 1: ba
213    bbabc
214 0: bbabc
215 1: ba
216    bababc
217 0: bababc
218 1: ba
219    *** Failers
220No match
221    bababbc
222No match
223    babababc
224No match
225
226/^\ca\cA\c[;\c:/
227    \x01\x01\e;z
228 0: \x01\x01\x1b;z
229
230/^[ab\]cde]/
231    athing
232 0: a
233    bthing
234 0: b
235    ]thing
236 0: ]
237    cthing
238 0: c
239    dthing
240 0: d
241    ething
242 0: e
243    *** Failers
244No match
245    fthing
246No match
247    [thing
248No match
249    \\thing
250No match
251
252/^[]cde]/
253    ]thing
254 0: ]
255    cthing
256 0: c
257    dthing
258 0: d
259    ething
260 0: e
261    *** Failers
262No match
263    athing
264No match
265    fthing
266No match
267
268/^[^ab\]cde]/
269    fthing
270 0: f
271    [thing
272 0: [
273    \\thing
274 0: \
275    *** Failers
276 0: *
277    athing
278No match
279    bthing
280No match
281    ]thing
282No match
283    cthing
284No match
285    dthing
286No match
287    ething
288No match
289
290/^[^]cde]/
291    athing
292 0: a
293    fthing
294 0: f
295    *** Failers
296 0: *
297    ]thing
298No match
299    cthing
300No match
301    dthing
302No match
303    ething
304No match
305
306/^\�/
307308 0: \x81
309
310/^�/
311312 0: \xff
313
314/^[0-9]+$/
315    0
316 0: 0
317    1
318 0: 1
319    2
320 0: 2
321    3
322 0: 3
323    4
324 0: 4
325    5
326 0: 5
327    6
328 0: 6
329    7
330 0: 7
331    8
332 0: 8
333    9
334 0: 9
335    10
336 0: 10
337    100
338 0: 100
339    *** Failers
340No match
341    abc
342No match
343
344/^.*nter/
345    enter
346 0: enter
347    inter
348 0: inter
349    uponter
350 0: uponter
351
352/^xxx[0-9]+$/
353    xxx0
354 0: xxx0
355    xxx1234
356 0: xxx1234
357    *** Failers
358No match
359    xxx
360No match
361
362/^.+[0-9][0-9][0-9]$/
363    x123
364 0: x123
365    xx123
366 0: xx123
367    123456
368 0: 123456
369    *** Failers
370No match
371    123
372No match
373    x1234
374 0: x1234
375
376/^.+?[0-9][0-9][0-9]$/
377    x123
378 0: x123
379    xx123
380 0: xx123
381    123456
382 0: 123456
383    *** Failers
384No match
385    123
386No match
387    x1234
388 0: x1234
389
390/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
391    abc!pqr=apquxz.ixr.zzz.ac.uk
392 0: abc!pqr=apquxz.ixr.zzz.ac.uk
393 1: abc
394 2: pqr
395    *** Failers
396No match
397    !pqr=apquxz.ixr.zzz.ac.uk
398No match
399    abc!=apquxz.ixr.zzz.ac.uk
400No match
401    abc!pqr=apquxz:ixr.zzz.ac.uk
402No match
403    abc!pqr=apquxz.ixr.zzz.ac.ukk
404No match
405
406/:/
407    Well, we need a colon: somewhere
408 0: :
409    *** Fail if we don't
410No match
411
412/([\da-f:]+)$/i
413    0abc
414 0: 0abc
415 1: 0abc
416    abc
417 0: abc
418 1: abc
419    fed
420 0: fed
421 1: fed
422    E
423 0: E
424 1: E
425    ::
426 0: ::
427 1: ::
428    5f03:12C0::932e
429 0: 5f03:12C0::932e
430 1: 5f03:12C0::932e
431    fed def
432 0: def
433 1: def
434    Any old stuff
435 0: ff
436 1: ff
437    *** Failers
438No match
439    0zzz
440No match
441    gzzz
442No match
443    fed\x20
444No match
445    Any old rubbish
446No match
447
448/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
449    .1.2.3
450 0: .1.2.3
451 1: 1
452 2: 2
453 3: 3
454    A.12.123.0
455 0: A.12.123.0
456 1: 12
457 2: 123
458 3: 0
459    *** Failers
460No match
461    .1.2.3333
462No match
463    1.2.3
464No match
465    1234.2.3
466No match
467
468/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
469    1 IN SOA non-sp1 non-sp2(
470 0: 1 IN SOA non-sp1 non-sp2(
471 1: 1
472 2: non-sp1
473 3: non-sp2
474    1    IN    SOA    non-sp1    non-sp2   (
475 0: 1    IN    SOA    non-sp1    non-sp2   (
476 1: 1
477 2: non-sp1
478 3: non-sp2
479    *** Failers
480No match
481    1IN SOA non-sp1 non-sp2(
482No match
483
484/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
485    a.
486 0: a.
487    Z.
488 0: Z.
489    2.
490 0: 2.
491    ab-c.pq-r.
492 0: ab-c.pq-r.
493 1: .pq-r
494    sxk.zzz.ac.uk.
495 0: sxk.zzz.ac.uk.
496 1: .uk
497    x-.y-.
498 0: x-.y-.
499 1: .y-
500    *** Failers
501No match
502    -abc.peq.
503No match
504
505/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
506    *.a
507 0: *.a
508    *.b0-a
509 0: *.b0-a
510 1: 0-a
511    *.c3-b.c
512 0: *.c3-b.c
513 1: 3-b
514 2: .c
515    *.c-a.b-c
516 0: *.c-a.b-c
517 1: -a
518 2: .b-c
519 3: -c
520    *** Failers
521No match
522    *.0
523No match
524    *.a-
525No match
526    *.a-b.c-
527No match
528    *.c-a.0-c
529No match
530
531/^(?=ab(de))(abd)(e)/
532    abde
533 0: abde
534 1: de
535 2: abd
536 3: e
537
538/^(?!(ab)de|x)(abd)(f)/
539    abdf
540 0: abdf
541 1: <unset>
542 2: abd
543 3: f
544
545/^(?=(ab(cd)))(ab)/
546    abcd
547 0: ab
548 1: abcd
549 2: cd
550 3: ab
551
552/^[\da-f](\.[\da-f])*$/i
553    a.b.c.d
554 0: a.b.c.d
555 1: .d
556    A.B.C.D
557 0: A.B.C.D
558 1: .D
559    a.b.c.1.2.3.C
560 0: a.b.c.1.2.3.C
561 1: .C
562
563/^\".*\"\s*(;.*)?$/
564    \"1234\"
565 0: "1234"
566    \"abcd\" ;
567 0: "abcd" ;
568 1: ;
569    \"\" ; rhubarb
570 0: "" ; rhubarb
571 1: ; rhubarb
572    *** Failers
573No match
574    \"1234\" : things
575No match
576
577/^$/
578    \
579 0:
580    *** Failers
581No match
582
583/   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/x
584    ab c
585 0: ab c
586    *** Failers
587No match
588    abc
589No match
590    ab cde
591No match
592
593/(?x)   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/
594    ab c
595 0: ab c
596    *** Failers
597No match
598    abc
599No match
600    ab cde
601No match
602
603/^   a\ b[c ]d       $/x
604    a bcd
605 0: a bcd
606    a b d
607 0: a b d
608    *** Failers
609No match
610    abcd
611No match
612    ab d
613No match
614
615/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
616    abcdefhijklm
617 0: abcdefhijklm
618 1: abc
619 2: bc
620 3: c
621 4: def
622 5: ef
623 6: f
624 7: hij
625 8: ij
626 9: j
62710: klm
62811: lm
62912: m
630
631/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
632    abcdefhijklm
633 0: abcdefhijklm
634 1: bc
635 2: c
636 3: ef
637 4: f
638 5: ij
639 6: j
640 7: lm
641 8: m
642
643/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
644    a+ Z0+\x08\n\x1d\x12
645 0: a+ Z0+\x08\x0a\x1d\x12
646
647/^[.^$|()*+?{,}]+/
648    .^\$(*+)|{?,?}
649 0: .^$(*+)|{?,?}
650
651/^a*\w/
652    z
653 0: z
654    az
655 0: az
656    aaaz
657 0: aaaz
658    a
659 0: a
660    aa
661 0: aa
662    aaaa
663 0: aaaa
664    a+
665 0: a
666    aa+
667 0: aa
668
669/^a*?\w/
670    z
671 0: z
672    az
673 0: a
674    aaaz
675 0: a
676    a
677 0: a
678    aa
679 0: a
680    aaaa
681 0: a
682    a+
683 0: a
684    aa+
685 0: a
686
687/^a+\w/
688    az
689 0: az
690    aaaz
691 0: aaaz
692    aa
693 0: aa
694    aaaa
695 0: aaaa
696    aa+
697 0: aa
698
699/^a+?\w/
700    az
701 0: az
702    aaaz
703 0: aa
704    aa
705 0: aa
706    aaaa
707 0: aa
708    aa+
709 0: aa
710
711/^\d{8}\w{2,}/
712    1234567890
713 0: 1234567890
714    12345678ab
715 0: 12345678ab
716    12345678__
717 0: 12345678__
718    *** Failers
719No match
720    1234567
721No match
722
723/^[aeiou\d]{4,5}$/
724    uoie
725 0: uoie
726    1234
727 0: 1234
728    12345
729 0: 12345
730    aaaaa
731 0: aaaaa
732    *** Failers
733No match
734    123456
735No match
736
737/^[aeiou\d]{4,5}?/
738    uoie
739 0: uoie
740    1234
741 0: 1234
742    12345
743 0: 1234
744    aaaaa
745 0: aaaa
746    123456
747 0: 1234
748
749/\A(abc|def)=(\1){2,3}\Z/
750    abc=abcabc
751 0: abc=abcabc
752 1: abc
753 2: abc
754    def=defdefdef
755 0: def=defdefdef
756 1: def
757 2: def
758    *** Failers
759No match
760    abc=defdef
761No match
762
763/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
764    abcdefghijkcda2
765 0: abcdefghijkcda2
766 1: a
767 2: b
768 3: c
769 4: d
770 5: e
771 6: f
772 7: g
773 8: h
774 9: i
77510: j
77611: k
77712: cd
778    abcdefghijkkkkcda2
779 0: abcdefghijkkkkcda2
780 1: a
781 2: b
782 3: c
783 4: d
784 5: e
785 6: f
786 7: g
787 8: h
788 9: i
78910: j
79011: k
79112: cd
792
793/(cat(a(ract|tonic)|erpillar)) \1()2(3)/
794    cataract cataract23
795 0: cataract cataract23
796 1: cataract
797 2: aract
798 3: ract
799 4:
800 5: 3
801    catatonic catatonic23
802 0: catatonic catatonic23
803 1: catatonic
804 2: atonic
805 3: tonic
806 4:
807 5: 3
808    caterpillar caterpillar23
809 0: caterpillar caterpillar23
810 1: caterpillar
811 2: erpillar
812 3: <unset>
813 4:
814 5: 3
815
816
817/^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]/
818    From abcd  Mon Sep 01 12:33:02 1997
819 0: From abcd  Mon Sep 01 12:33
820 1: abcd
821
822/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
823    From abcd  Mon Sep 01 12:33:02 1997
824 0: From abcd  Mon Sep 01 12:33
825 1: Sep
826    From abcd  Mon Sep  1 12:33:02 1997
827 0: From abcd  Mon Sep  1 12:33
828 1: Sep
829    *** Failers
830No match
831    From abcd  Sep 01 12:33:02 1997
832No match
833
834/^12.34/s
835    12\n34
836 0: 12\x0a34
837    12\r34
838 0: 12\x0d34
839
840/\w+(?=\t)/
841    the quick brown\t fox
842 0: brown
843
844/foo(?!bar)(.*)/
845    foobar is foolish see?
846 0: foolish see?
847 1: lish see?
848
849/(?:(?!foo)...|^.{0,2})bar(.*)/
850    foobar crowbar etc
851 0: rowbar etc
852 1:  etc
853    barrel
854 0: barrel
855 1: rel
856    2barrel
857 0: 2barrel
858 1: rel
859    A barrel
860 0: A barrel
861 1: rel
862
863/^(\D*)(?=\d)(?!123)/
864    abc456
865 0: abc
866 1: abc
867    *** Failers
868No match
869    abc123
870No match
871
872/^1234(?# test newlines
873  inside)/
874    1234
875 0: 1234
876
877/^1234 #comment in extended re
878  /x
879    1234
880 0: 1234
881
882/#rhubarb
883  abcd/x
884    abcd
885 0: abcd
886
887/^abcd#rhubarb/x
888    abcd
889 0: abcd
890
891/^(a)\1{2,3}(.)/
892    aaab
893 0: aaab
894 1: a
895 2: b
896    aaaab
897 0: aaaab
898 1: a
899 2: b
900    aaaaab
901 0: aaaaa
902 1: a
903 2: a
904    aaaaaab
905 0: aaaaa
906 1: a
907 2: a
908
909/(?!^)abc/
910    the abc
911 0: abc
912    *** Failers
913No match
914    abc
915No match
916
917/(?=^)abc/
918    abc
919 0: abc
920    *** Failers
921No match
922    the abc
923No match
924
925/^[ab]{1,3}(ab*|b)/
926    aabbbbb
927 0: aabb
928 1: b
929
930/^[ab]{1,3}?(ab*|b)/
931    aabbbbb
932 0: aabbbbb
933 1: abbbbb
934
935/^[ab]{1,3}?(ab*?|b)/
936    aabbbbb
937 0: aa
938 1: a
939
940/^[ab]{1,3}(ab*?|b)/
941    aabbbbb
942 0: aabb
943 1: b
944
945/  (?: [\040\t] |  \(
946(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
947\)  )*                          # optional leading comment
948(?:    (?:
949[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
950(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
951|
952" (?:                      # opening quote...
953[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
954|                     #    or
955\\ [^\x80-\xff]           #   Escaped something (something != CR)
956)* "  # closing quote
957)                    # initial word
958(?:  (?: [\040\t] |  \(
959(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
960\)  )*  \.  (?: [\040\t] |  \(
961(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
962\)  )*   (?:
963[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
964(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
965|
966" (?:                      # opening quote...
967[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
968|                     #    or
969\\ [^\x80-\xff]           #   Escaped something (something != CR)
970)* "  # closing quote
971)  )* # further okay, if led by a period
972(?: [\040\t] |  \(
973(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
974\)  )*  @  (?: [\040\t] |  \(
975(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
976\)  )*    (?:
977[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
978(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
979|   \[                         # [
980(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
981\]                        #           ]
982)                           # initial subdomain
983(?:                                  #
984(?: [\040\t] |  \(
985(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
986\)  )*  \.                        # if led by a period...
987(?: [\040\t] |  \(
988(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
989\)  )*   (?:
990[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
991(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
992|   \[                         # [
993(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
994\]                        #           ]
995)                     #   ...further okay
996)*
997# address
998|                     #  or
999(?:
1000[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1001(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1002|
1003" (?:                      # opening quote...
1004[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1005|                     #    or
1006\\ [^\x80-\xff]           #   Escaped something (something != CR)
1007)* "  # closing quote
1008)             # one word, optionally followed by....
1009(?:
1010[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]  |  # atom and space parts, or...
1011\(
1012(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1013\)       |  # comments, or...
1014
1015" (?:                      # opening quote...
1016[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1017|                     #    or
1018\\ [^\x80-\xff]           #   Escaped something (something != CR)
1019)* "  # closing quote
1020# quoted strings
1021)*
1022<  (?: [\040\t] |  \(
1023(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1024\)  )*                     # leading <
1025(?:  @  (?: [\040\t] |  \(
1026(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1027\)  )*    (?:
1028[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1029(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1030|   \[                         # [
1031(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1032\]                        #           ]
1033)                           # initial subdomain
1034(?:                                  #
1035(?: [\040\t] |  \(
1036(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1037\)  )*  \.                        # if led by a period...
1038(?: [\040\t] |  \(
1039(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1040\)  )*   (?:
1041[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1042(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1043|   \[                         # [
1044(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1045\]                        #           ]
1046)                     #   ...further okay
1047)*
1048
1049(?:  (?: [\040\t] |  \(
1050(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1051\)  )*  ,  (?: [\040\t] |  \(
1052(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1053\)  )*  @  (?: [\040\t] |  \(
1054(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1055\)  )*    (?:
1056[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1057(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1058|   \[                         # [
1059(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1060\]                        #           ]
1061)                           # initial subdomain
1062(?:                                  #
1063(?: [\040\t] |  \(
1064(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1065\)  )*  \.                        # if led by a period...
1066(?: [\040\t] |  \(
1067(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1068\)  )*   (?:
1069[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1070(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1071|   \[                         # [
1072(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1073\]                        #           ]
1074)                     #   ...further okay
1075)*
1076)* # further okay, if led by comma
1077:                                # closing colon
1078(?: [\040\t] |  \(
1079(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1080\)  )*  )? #       optional route
1081(?:
1082[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1083(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1084|
1085" (?:                      # opening quote...
1086[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1087|                     #    or
1088\\ [^\x80-\xff]           #   Escaped something (something != CR)
1089)* "  # closing quote
1090)                    # initial word
1091(?:  (?: [\040\t] |  \(
1092(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1093\)  )*  \.  (?: [\040\t] |  \(
1094(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1095\)  )*   (?:
1096[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1097(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1098|
1099" (?:                      # opening quote...
1100[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1101|                     #    or
1102\\ [^\x80-\xff]           #   Escaped something (something != CR)
1103)* "  # closing quote
1104)  )* # further okay, if led by a period
1105(?: [\040\t] |  \(
1106(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1107\)  )*  @  (?: [\040\t] |  \(
1108(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1109\)  )*    (?:
1110[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1111(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1112|   \[                         # [
1113(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1114\]                        #           ]
1115)                           # initial subdomain
1116(?:                                  #
1117(?: [\040\t] |  \(
1118(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1119\)  )*  \.                        # if led by a period...
1120(?: [\040\t] |  \(
1121(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1122\)  )*   (?:
1123[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1124(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1125|   \[                         # [
1126(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1127\]                        #           ]
1128)                     #   ...further okay
1129)*
1130#       address spec
1131(?: [\040\t] |  \(
1132(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1133\)  )*  > #                  trailing >
1134# name and address
1135)  (?: [\040\t] |  \(
1136(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1137\)  )*                       # optional trailing comment
1138/x
1139    Alan Other <user\@dom.ain>
1140 0: Alan Other <user@dom.ain>
1141    <user\@dom.ain>
1142 0: user@dom.ain
1143    user\@dom.ain
1144 0: user@dom.ain
1145    \"A. Other\" <user.1234\@dom.ain> (a comment)
1146 0: "A. Other" <user.1234@dom.ain> (a comment)
1147    A. Other <user.1234\@dom.ain> (a comment)
1148 0:  Other <user.1234@dom.ain> (a comment)
1149    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
1150 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
1151    A missing angle <user\@some.where
1152 0: user@some.where
1153    *** Failers
1154No match
1155    The quick brown fox
1156No match
1157
1158/[\040\t]*                    # Nab whitespace.
1159(?:
1160\(                              #  (
1161[^\\\x80-\xff\n\015()] *                             #     normal*
1162(?:                                 #       (
1163(?:  \\ [^\x80-\xff]  |
1164\(                            #  (
1165[^\\\x80-\xff\n\015()] *                            #     normal*
1166(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1167\)                           #                       )
1168)    #         special
1169[^\\\x80-\xff\n\015()] *                         #         normal*
1170)*                                  #            )*
1171\)                             #                )
1172[\040\t]* )*    # If comment found, allow more spaces.
1173# optional leading comment
1174(?:
1175(?:
1176[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1177(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1178# Atom
1179|                       #  or
1180"                                     # "
1181[^\\\x80-\xff\n\015"] *                            #   normal
1182(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1183"                                     #        "
1184# Quoted string
1185)
1186[\040\t]*                    # Nab whitespace.
1187(?:
1188\(                              #  (
1189[^\\\x80-\xff\n\015()] *                             #     normal*
1190(?:                                 #       (
1191(?:  \\ [^\x80-\xff]  |
1192\(                            #  (
1193[^\\\x80-\xff\n\015()] *                            #     normal*
1194(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1195\)                           #                       )
1196)    #         special
1197[^\\\x80-\xff\n\015()] *                         #         normal*
1198)*                                  #            )*
1199\)                             #                )
1200[\040\t]* )*    # If comment found, allow more spaces.
1201(?:
1202\.
1203[\040\t]*                    # Nab whitespace.
1204(?:
1205\(                              #  (
1206[^\\\x80-\xff\n\015()] *                             #     normal*
1207(?:                                 #       (
1208(?:  \\ [^\x80-\xff]  |
1209\(                            #  (
1210[^\\\x80-\xff\n\015()] *                            #     normal*
1211(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1212\)                           #                       )
1213)    #         special
1214[^\\\x80-\xff\n\015()] *                         #         normal*
1215)*                                  #            )*
1216\)                             #                )
1217[\040\t]* )*    # If comment found, allow more spaces.
1218(?:
1219[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1220(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1221# Atom
1222|                       #  or
1223"                                     # "
1224[^\\\x80-\xff\n\015"] *                            #   normal
1225(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1226"                                     #        "
1227# Quoted string
1228)
1229[\040\t]*                    # Nab whitespace.
1230(?:
1231\(                              #  (
1232[^\\\x80-\xff\n\015()] *                             #     normal*
1233(?:                                 #       (
1234(?:  \\ [^\x80-\xff]  |
1235\(                            #  (
1236[^\\\x80-\xff\n\015()] *                            #     normal*
1237(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1238\)                           #                       )
1239)    #         special
1240[^\\\x80-\xff\n\015()] *                         #         normal*
1241)*                                  #            )*
1242\)                             #                )
1243[\040\t]* )*    # If comment found, allow more spaces.
1244# additional words
1245)*
1246@
1247[\040\t]*                    # Nab whitespace.
1248(?:
1249\(                              #  (
1250[^\\\x80-\xff\n\015()] *                             #     normal*
1251(?:                                 #       (
1252(?:  \\ [^\x80-\xff]  |
1253\(                            #  (
1254[^\\\x80-\xff\n\015()] *                            #     normal*
1255(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1256\)                           #                       )
1257)    #         special
1258[^\\\x80-\xff\n\015()] *                         #         normal*
1259)*                                  #            )*
1260\)                             #                )
1261[\040\t]* )*    # If comment found, allow more spaces.
1262(?:
1263[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1264(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1265|
1266\[                            # [
1267(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1268\]                           #           ]
1269)
1270[\040\t]*                    # Nab whitespace.
1271(?:
1272\(                              #  (
1273[^\\\x80-\xff\n\015()] *                             #     normal*
1274(?:                                 #       (
1275(?:  \\ [^\x80-\xff]  |
1276\(                            #  (
1277[^\\\x80-\xff\n\015()] *                            #     normal*
1278(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1279\)                           #                       )
1280)    #         special
1281[^\\\x80-\xff\n\015()] *                         #         normal*
1282)*                                  #            )*
1283\)                             #                )
1284[\040\t]* )*    # If comment found, allow more spaces.
1285# optional trailing comments
1286(?:
1287\.
1288[\040\t]*                    # Nab whitespace.
1289(?:
1290\(                              #  (
1291[^\\\x80-\xff\n\015()] *                             #     normal*
1292(?:                                 #       (
1293(?:  \\ [^\x80-\xff]  |
1294\(                            #  (
1295[^\\\x80-\xff\n\015()] *                            #     normal*
1296(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1297\)                           #                       )
1298)    #         special
1299[^\\\x80-\xff\n\015()] *                         #         normal*
1300)*                                  #            )*
1301\)                             #                )
1302[\040\t]* )*    # If comment found, allow more spaces.
1303(?:
1304[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1305(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1306|
1307\[                            # [
1308(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1309\]                           #           ]
1310)
1311[\040\t]*                    # Nab whitespace.
1312(?:
1313\(                              #  (
1314[^\\\x80-\xff\n\015()] *                             #     normal*
1315(?:                                 #       (
1316(?:  \\ [^\x80-\xff]  |
1317\(                            #  (
1318[^\\\x80-\xff\n\015()] *                            #     normal*
1319(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1320\)                           #                       )
1321)    #         special
1322[^\\\x80-\xff\n\015()] *                         #         normal*
1323)*                                  #            )*
1324\)                             #                )
1325[\040\t]* )*    # If comment found, allow more spaces.
1326# optional trailing comments
1327)*
1328# address
1329|                             #  or
1330(?:
1331[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1332(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1333# Atom
1334|                       #  or
1335"                                     # "
1336[^\\\x80-\xff\n\015"] *                            #   normal
1337(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1338"                                     #        "
1339# Quoted string
1340)
1341# leading word
1342[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *               # "normal" atoms and or spaces
1343(?:
1344(?:
1345\(                              #  (
1346[^\\\x80-\xff\n\015()] *                             #     normal*
1347(?:                                 #       (
1348(?:  \\ [^\x80-\xff]  |
1349\(                            #  (
1350[^\\\x80-\xff\n\015()] *                            #     normal*
1351(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1352\)                           #                       )
1353)    #         special
1354[^\\\x80-\xff\n\015()] *                         #         normal*
1355)*                                  #            )*
1356\)                             #                )
1357|
1358"                                     # "
1359[^\\\x80-\xff\n\015"] *                            #   normal
1360(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1361"                                     #        "
1362) # "special" comment or quoted string
1363[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *            #  more "normal"
1364)*
1365<
1366[\040\t]*                    # Nab whitespace.
1367(?:
1368\(                              #  (
1369[^\\\x80-\xff\n\015()] *                             #     normal*
1370(?:                                 #       (
1371(?:  \\ [^\x80-\xff]  |
1372\(                            #  (
1373[^\\\x80-\xff\n\015()] *                            #     normal*
1374(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1375\)                           #                       )
1376)    #         special
1377[^\\\x80-\xff\n\015()] *                         #         normal*
1378)*                                  #            )*
1379\)                             #                )
1380[\040\t]* )*    # If comment found, allow more spaces.
1381# <
1382(?:
1383@
1384[\040\t]*                    # Nab whitespace.
1385(?:
1386\(                              #  (
1387[^\\\x80-\xff\n\015()] *                             #     normal*
1388(?:                                 #       (
1389(?:  \\ [^\x80-\xff]  |
1390\(                            #  (
1391[^\\\x80-\xff\n\015()] *                            #     normal*
1392(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1393\)                           #                       )
1394)    #         special
1395[^\\\x80-\xff\n\015()] *                         #         normal*
1396)*                                  #            )*
1397\)                             #                )
1398[\040\t]* )*    # If comment found, allow more spaces.
1399(?:
1400[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1401(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1402|
1403\[                            # [
1404(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1405\]                           #           ]
1406)
1407[\040\t]*                    # Nab whitespace.
1408(?:
1409\(                              #  (
1410[^\\\x80-\xff\n\015()] *                             #     normal*
1411(?:                                 #       (
1412(?:  \\ [^\x80-\xff]  |
1413\(                            #  (
1414[^\\\x80-\xff\n\015()] *                            #     normal*
1415(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1416\)                           #                       )
1417)    #         special
1418[^\\\x80-\xff\n\015()] *                         #         normal*
1419)*                                  #            )*
1420\)                             #                )
1421[\040\t]* )*    # If comment found, allow more spaces.
1422# optional trailing comments
1423(?:
1424\.
1425[\040\t]*                    # Nab whitespace.
1426(?:
1427\(                              #  (
1428[^\\\x80-\xff\n\015()] *                             #     normal*
1429(?:                                 #       (
1430(?:  \\ [^\x80-\xff]  |
1431\(                            #  (
1432[^\\\x80-\xff\n\015()] *                            #     normal*
1433(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1434\)                           #                       )
1435)    #         special
1436[^\\\x80-\xff\n\015()] *                         #         normal*
1437)*                                  #            )*
1438\)                             #                )
1439[\040\t]* )*    # If comment found, allow more spaces.
1440(?:
1441[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1442(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1443|
1444\[                            # [
1445(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1446\]                           #           ]
1447)
1448[\040\t]*                    # Nab whitespace.
1449(?:
1450\(                              #  (
1451[^\\\x80-\xff\n\015()] *                             #     normal*
1452(?:                                 #       (
1453(?:  \\ [^\x80-\xff]  |
1454\(                            #  (
1455[^\\\x80-\xff\n\015()] *                            #     normal*
1456(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1457\)                           #                       )
1458)    #         special
1459[^\\\x80-\xff\n\015()] *                         #         normal*
1460)*                                  #            )*
1461\)                             #                )
1462[\040\t]* )*    # If comment found, allow more spaces.
1463# optional trailing comments
1464)*
1465(?: ,
1466[\040\t]*                    # Nab whitespace.
1467(?:
1468\(                              #  (
1469[^\\\x80-\xff\n\015()] *                             #     normal*
1470(?:                                 #       (
1471(?:  \\ [^\x80-\xff]  |
1472\(                            #  (
1473[^\\\x80-\xff\n\015()] *                            #     normal*
1474(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1475\)                           #                       )
1476)    #         special
1477[^\\\x80-\xff\n\015()] *                         #         normal*
1478)*                                  #            )*
1479\)                             #                )
1480[\040\t]* )*    # If comment found, allow more spaces.
1481@
1482[\040\t]*                    # Nab whitespace.
1483(?:
1484\(                              #  (
1485[^\\\x80-\xff\n\015()] *                             #     normal*
1486(?:                                 #       (
1487(?:  \\ [^\x80-\xff]  |
1488\(                            #  (
1489[^\\\x80-\xff\n\015()] *                            #     normal*
1490(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1491\)                           #                       )
1492)    #         special
1493[^\\\x80-\xff\n\015()] *                         #         normal*
1494)*                                  #            )*
1495\)                             #                )
1496[\040\t]* )*    # If comment found, allow more spaces.
1497(?:
1498[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1499(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1500|
1501\[                            # [
1502(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1503\]                           #           ]
1504)
1505[\040\t]*                    # Nab whitespace.
1506(?:
1507\(                              #  (
1508[^\\\x80-\xff\n\015()] *                             #     normal*
1509(?:                                 #       (
1510(?:  \\ [^\x80-\xff]  |
1511\(                            #  (
1512[^\\\x80-\xff\n\015()] *                            #     normal*
1513(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1514\)                           #                       )
1515)    #         special
1516[^\\\x80-\xff\n\015()] *                         #         normal*
1517)*                                  #            )*
1518\)                             #                )
1519[\040\t]* )*    # If comment found, allow more spaces.
1520# optional trailing comments
1521(?:
1522\.
1523[\040\t]*                    # Nab whitespace.
1524(?:
1525\(                              #  (
1526[^\\\x80-\xff\n\015()] *                             #     normal*
1527(?:                                 #       (
1528(?:  \\ [^\x80-\xff]  |
1529\(                            #  (
1530[^\\\x80-\xff\n\015()] *                            #     normal*
1531(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1532\)                           #                       )
1533)    #         special
1534[^\\\x80-\xff\n\015()] *                         #         normal*
1535)*                                  #            )*
1536\)                             #                )
1537[\040\t]* )*    # If comment found, allow more spaces.
1538(?:
1539[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1540(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1541|
1542\[                            # [
1543(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1544\]                           #           ]
1545)
1546[\040\t]*                    # Nab whitespace.
1547(?:
1548\(                              #  (
1549[^\\\x80-\xff\n\015()] *                             #     normal*
1550(?:                                 #       (
1551(?:  \\ [^\x80-\xff]  |
1552\(                            #  (
1553[^\\\x80-\xff\n\015()] *                            #     normal*
1554(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1555\)                           #                       )
1556)    #         special
1557[^\\\x80-\xff\n\015()] *                         #         normal*
1558)*                                  #            )*
1559\)                             #                )
1560[\040\t]* )*    # If comment found, allow more spaces.
1561# optional trailing comments
1562)*
1563)*  # additional domains
1564:
1565[\040\t]*                    # Nab whitespace.
1566(?:
1567\(                              #  (
1568[^\\\x80-\xff\n\015()] *                             #     normal*
1569(?:                                 #       (
1570(?:  \\ [^\x80-\xff]  |
1571\(                            #  (
1572[^\\\x80-\xff\n\015()] *                            #     normal*
1573(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1574\)                           #                       )
1575)    #         special
1576[^\\\x80-\xff\n\015()] *                         #         normal*
1577)*                                  #            )*
1578\)                             #                )
1579[\040\t]* )*    # If comment found, allow more spaces.
1580# optional trailing comments
1581)?     #       optional route
1582(?:
1583[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1584(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1585# Atom
1586|                       #  or
1587"                                     # "
1588[^\\\x80-\xff\n\015"] *                            #   normal
1589(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1590"                                     #        "
1591# Quoted string
1592)
1593[\040\t]*                    # Nab whitespace.
1594(?:
1595\(                              #  (
1596[^\\\x80-\xff\n\015()] *                             #     normal*
1597(?:                                 #       (
1598(?:  \\ [^\x80-\xff]  |
1599\(                            #  (
1600[^\\\x80-\xff\n\015()] *                            #     normal*
1601(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1602\)                           #                       )
1603)    #         special
1604[^\\\x80-\xff\n\015()] *                         #         normal*
1605)*                                  #            )*
1606\)                             #                )
1607[\040\t]* )*    # If comment found, allow more spaces.
1608(?:
1609\.
1610[\040\t]*                    # Nab whitespace.
1611(?:
1612\(                              #  (
1613[^\\\x80-\xff\n\015()] *                             #     normal*
1614(?:                                 #       (
1615(?:  \\ [^\x80-\xff]  |
1616\(                            #  (
1617[^\\\x80-\xff\n\015()] *                            #     normal*
1618(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1619\)                           #                       )
1620)    #         special
1621[^\\\x80-\xff\n\015()] *                         #         normal*
1622)*                                  #            )*
1623\)                             #                )
1624[\040\t]* )*    # If comment found, allow more spaces.
1625(?:
1626[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1627(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1628# Atom
1629|                       #  or
1630"                                     # "
1631[^\\\x80-\xff\n\015"] *                            #   normal
1632(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1633"                                     #        "
1634# Quoted string
1635)
1636[\040\t]*                    # Nab whitespace.
1637(?:
1638\(                              #  (
1639[^\\\x80-\xff\n\015()] *                             #     normal*
1640(?:                                 #       (
1641(?:  \\ [^\x80-\xff]  |
1642\(                            #  (
1643[^\\\x80-\xff\n\015()] *                            #     normal*
1644(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1645\)                           #                       )
1646)    #         special
1647[^\\\x80-\xff\n\015()] *                         #         normal*
1648)*                                  #            )*
1649\)                             #                )
1650[\040\t]* )*    # If comment found, allow more spaces.
1651# additional words
1652)*
1653@
1654[\040\t]*                    # Nab whitespace.
1655(?:
1656\(                              #  (
1657[^\\\x80-\xff\n\015()] *                             #     normal*
1658(?:                                 #       (
1659(?:  \\ [^\x80-\xff]  |
1660\(                            #  (
1661[^\\\x80-\xff\n\015()] *                            #     normal*
1662(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1663\)                           #                       )
1664)    #         special
1665[^\\\x80-\xff\n\015()] *                         #         normal*
1666)*                                  #            )*
1667\)                             #                )
1668[\040\t]* )*    # If comment found, allow more spaces.
1669(?:
1670[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1671(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1672|
1673\[                            # [
1674(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1675\]                           #           ]
1676)
1677[\040\t]*                    # Nab whitespace.
1678(?:
1679\(                              #  (
1680[^\\\x80-\xff\n\015()] *                             #     normal*
1681(?:                                 #       (
1682(?:  \\ [^\x80-\xff]  |
1683\(                            #  (
1684[^\\\x80-\xff\n\015()] *                            #     normal*
1685(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1686\)                           #                       )
1687)    #         special
1688[^\\\x80-\xff\n\015()] *                         #         normal*
1689)*                                  #            )*
1690\)                             #                )
1691[\040\t]* )*    # If comment found, allow more spaces.
1692# optional trailing comments
1693(?:
1694\.
1695[\040\t]*                    # Nab whitespace.
1696(?:
1697\(                              #  (
1698[^\\\x80-\xff\n\015()] *                             #     normal*
1699(?:                                 #       (
1700(?:  \\ [^\x80-\xff]  |
1701\(                            #  (
1702[^\\\x80-\xff\n\015()] *                            #     normal*
1703(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1704\)                           #                       )
1705)    #         special
1706[^\\\x80-\xff\n\015()] *                         #         normal*
1707)*                                  #            )*
1708\)                             #                )
1709[\040\t]* )*    # If comment found, allow more spaces.
1710(?:
1711[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1712(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1713|
1714\[                            # [
1715(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1716\]                           #           ]
1717)
1718[\040\t]*                    # Nab whitespace.
1719(?:
1720\(                              #  (
1721[^\\\x80-\xff\n\015()] *                             #     normal*
1722(?:                                 #       (
1723(?:  \\ [^\x80-\xff]  |
1724\(                            #  (
1725[^\\\x80-\xff\n\015()] *                            #     normal*
1726(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1727\)                           #                       )
1728)    #         special
1729[^\\\x80-\xff\n\015()] *                         #         normal*
1730)*                                  #            )*
1731\)                             #                )
1732[\040\t]* )*    # If comment found, allow more spaces.
1733# optional trailing comments
1734)*
1735#       address spec
1736>                    #                 >
1737# name and address
1738)
1739/x
1740    Alan Other <user\@dom.ain>
1741 0: Alan Other <user@dom.ain>
1742    <user\@dom.ain>
1743 0: user@dom.ain
1744    user\@dom.ain
1745 0: user@dom.ain
1746    \"A. Other\" <user.1234\@dom.ain> (a comment)
1747 0: "A. Other" <user.1234@dom.ain>
1748    A. Other <user.1234\@dom.ain> (a comment)
1749 0:  Other <user.1234@dom.ain>
1750    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
1751 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
1752    A missing angle <user\@some.where
1753 0: user@some.where
1754    *** Failers
1755No match
1756    The quick brown fox
1757No match
1758
1759/abc\0def\00pqr\000xyz\0000AB/
1760    abc\0def\00pqr\000xyz\0000AB
1761 0: abc\x00def\x00pqr\x00xyz\x000AB
1762    abc456 abc\0def\00pqr\000xyz\0000ABCDE
1763 0: abc\x00def\x00pqr\x00xyz\x000AB
1764
1765/abc\x0def\x00pqr\x000xyz\x0000AB/
1766    abc\x0def\x00pqr\x000xyz\x0000AB
1767 0: abc\x0def\x00pqr\x000xyz\x0000AB
1768    abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
1769 0: abc\x0def\x00pqr\x000xyz\x0000AB
1770
1771/^[\000-\037]/
1772    \0A
1773 0: \x00
1774    \01B
1775 0: \x01
1776    \037C
1777 0: \x1f
1778
1779/\0*/
1780    \0\0\0\0
1781 0: \x00\x00\x00\x00
1782
1783/A\x0{2,3}Z/
1784    The A\x0\x0Z
1785 0: A\x00\x00Z
1786    An A\0\x0\0Z
1787 0: A\x00\x00\x00Z
1788    *** Failers
1789No match
1790    A\0Z
1791No match
1792    A\0\x0\0\x0Z
1793No match
1794
1795/^(cow|)\1(bell)/
1796    cowcowbell
1797 0: cowcowbell
1798 1: cow
1799 2: bell
1800    bell
1801 0: bell
1802 1:
1803 2: bell
1804    *** Failers
1805No match
1806    cowbell
1807No match
1808
1809/^\s/
1810    \040abc
1811 0:
1812    \x0cabc
1813 0: \x0c
1814    \nabc
1815 0: \x0a
1816    \rabc
1817 0: \x0d
1818    \tabc
1819 0: \x09
1820    *** Failers
1821No match
1822    abc
1823No match
1824
1825/^a	b
1826      c/x
1827    abc
1828 0: abc
1829
1830/^(a|)\1*b/
1831    ab
1832 0: ab
1833 1: a
1834    aaaab
1835 0: aaaab
1836 1: a
1837    b
1838 0: b
1839 1:
1840    *** Failers
1841No match
1842    acb
1843No match
1844
1845/^(a|)\1+b/
1846    aab
1847 0: aab
1848 1: a
1849    aaaab
1850 0: aaaab
1851 1: a
1852    b
1853 0: b
1854 1:
1855    *** Failers
1856No match
1857    ab
1858No match
1859
1860/^(a|)\1?b/
1861    ab
1862 0: ab
1863 1: a
1864    aab
1865 0: aab
1866 1: a
1867    b
1868 0: b
1869 1:
1870    *** Failers
1871No match
1872    acb
1873No match
1874
1875/^(a|)\1{2}b/
1876    aaab
1877 0: aaab
1878 1: a
1879    b
1880 0: b
1881 1:
1882    *** Failers
1883No match
1884    ab
1885No match
1886    aab
1887No match
1888    aaaab
1889No match
1890
1891/^(a|)\1{2,3}b/
1892    aaab
1893 0: aaab
1894 1: a
1895    aaaab
1896 0: aaaab
1897 1: a
1898    b
1899 0: b
1900 1:
1901    *** Failers
1902No match
1903    ab
1904No match
1905    aab
1906No match
1907    aaaaab
1908No match
1909
1910/ab{1,3}bc/
1911    abbbbc
1912 0: abbbbc
1913    abbbc
1914 0: abbbc
1915    abbc
1916 0: abbc
1917    *** Failers
1918No match
1919    abc
1920No match
1921    abbbbbc
1922No match
1923
1924/([^.]*)\.([^:]*):[T ]+(.*)/
1925    track1.title:TBlah blah blah
1926 0: track1.title:TBlah blah blah
1927 1: track1
1928 2: title
1929 3: Blah blah blah
1930
1931/([^.]*)\.([^:]*):[T ]+(.*)/i
1932    track1.title:TBlah blah blah
1933 0: track1.title:TBlah blah blah
1934 1: track1
1935 2: title
1936 3: Blah blah blah
1937
1938/([^.]*)\.([^:]*):[t ]+(.*)/i
1939    track1.title:TBlah blah blah
1940 0: track1.title:TBlah blah blah
1941 1: track1
1942 2: title
1943 3: Blah blah blah
1944
1945/^[W-c]+$/
1946    WXY_^abc
1947 0: WXY_^abc
1948    *** Failers
1949No match
1950    wxy
1951No match
1952
1953/^[W-c]+$/i
1954    WXY_^abc
1955 0: WXY_^abc
1956    wxy_^ABC
1957 0: wxy_^ABC
1958
1959/^[\x3f-\x5F]+$/i
1960    WXY_^abc
1961 0: WXY_^abc
1962    wxy_^ABC
1963 0: wxy_^ABC
1964
1965/^abc$/m
1966    abc
1967 0: abc
1968    qqq\nabc
1969 0: abc
1970    abc\nzzz
1971 0: abc
1972    qqq\nabc\nzzz
1973 0: abc
1974
1975/^abc$/
1976    abc
1977 0: abc
1978    *** Failers
1979No match
1980    qqq\nabc
1981No match
1982    abc\nzzz
1983No match
1984    qqq\nabc\nzzz
1985No match
1986
1987/\Aabc\Z/m
1988    abc
1989 0: abc
1990    abc\n
1991 0: abc
1992    *** Failers
1993No match
1994    qqq\nabc
1995No match
1996    abc\nzzz
1997No match
1998    qqq\nabc\nzzz
1999No match
2000
2001/\A(.)*\Z/s
2002    abc\ndef
2003 0: abc\x0adef
2004 1: f
2005
2006/\A(.)*\Z/m
2007    *** Failers
2008 0: *** Failers
2009 1: s
2010    abc\ndef
2011No match
2012
2013/(?:b)|(?::+)/
2014    b::c
2015 0: b
2016    c::b
2017 0: ::
2018
2019/[-az]+/
2020    az-
2021 0: az-
2022    *** Failers
2023 0: a
2024    b
2025No match
2026
2027/[az-]+/
2028    za-
2029 0: za-
2030    *** Failers
2031 0: a
2032    b
2033No match
2034
2035/[a\-z]+/
2036    a-z
2037 0: a-z
2038    *** Failers
2039 0: a
2040    b
2041No match
2042
2043/[a-z]+/
2044    abcdxyz
2045 0: abcdxyz
2046
2047/[\d-]+/
2048    12-34
2049 0: 12-34
2050    *** Failers
2051No match
2052    aaa
2053No match
2054
2055/[\d-z]+/
2056    12-34z
2057 0: 12-34z
2058    *** Failers
2059No match
2060    aaa
2061No match
2062
2063/\x5c/
2064    \\
2065 0: \
2066
2067/\x20Z/
2068    the Zoo
2069 0:  Z
2070    *** Failers
2071No match
2072    Zulu
2073No match
2074
2075/(abc)\1/i
2076    abcabc
2077 0: abcabc
2078 1: abc
2079    ABCabc
2080 0: ABCabc
2081 1: ABC
2082    abcABC
2083 0: abcABC
2084 1: abc
2085
2086/ab{3cd/
2087    ab{3cd
2088 0: ab{3cd
2089
2090/ab{3,cd/
2091    ab{3,cd
2092 0: ab{3,cd
2093
2094/ab{3,4a}cd/
2095    ab{3,4a}cd
2096 0: ab{3,4a}cd
2097
2098/{4,5a}bc/
2099    {4,5a}bc
2100 0: {4,5a}bc
2101
2102/abc$/
2103    abc
2104 0: abc
2105    abc\n
2106 0: abc
2107    *** Failers
2108No match
2109    abc\ndef
2110No match
2111
2112/(abc)\123/
2113    abc\x53
2114 0: abcS
2115 1: abc
2116
2117/(abc)\223/
2118    abc\x93
2119 0: abc\x93
2120 1: abc
2121
2122/(abc)\323/
2123    abc\xd3
2124 0: abc\xd3
2125 1: abc
2126
2127/(abc)\100/
2128    abc\x40
2129 0: abc@
2130 1: abc
2131    abc\100
2132 0: abc@
2133 1: abc
2134
2135/(abc)\1000/
2136    abc\x400
2137 0: abc@0
2138 1: abc
2139    abc\x40\x30
2140 0: abc@0
2141 1: abc
2142    abc\1000
2143 0: abc@0
2144 1: abc
2145    abc\100\x30
2146 0: abc@0
2147 1: abc
2148    abc\100\060
2149 0: abc@0
2150 1: abc
2151    abc\100\60
2152 0: abc@0
2153 1: abc
2154
2155/^A\8B\9C$/
2156    A8B9C
2157 0: A8B9C
2158    *** Failers
2159No match
2160    A\08B\09C
2161No match
2162
2163/^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/
2164    ABCDEFGHIHI
2165 0: ABCDEFGHIHI
2166 1: A
2167 2: B
2168 3: C
2169 4: D
2170 5: E
2171 6: F
2172 7: G
2173 8: H
2174 9: I
2175
2176/^[A\8B\9C]+$/
2177    A8B9C
2178 0: A8B9C
2179    *** Failers
2180No match
2181    A8B9C\x00
2182No match
2183
2184/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
2185    abcdefghijkllS
2186 0: abcdefghijkllS
2187 1: a
2188 2: b
2189 3: c
2190 4: d
2191 5: e
2192 6: f
2193 7: g
2194 8: h
2195 9: i
219610: j
219711: k
219812: l
2199
2200/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
2201    abcdefghijk\12S
2202 0: abcdefghijk\x0aS
2203 1: a
2204 2: b
2205 3: c
2206 4: d
2207 5: e
2208 6: f
2209 7: g
2210 8: h
2211 9: i
221210: j
221311: k
2214
2215/ab\idef/
2216    abidef
2217 0: abidef
2218
2219/a{0}bc/
2220    bc
2221 0: bc
2222
2223/(a|(bc)){0,0}?xyz/
2224    xyz
2225 0: xyz
2226
2227/abc[\10]de/
2228    abc\010de
2229 0: abc\x08de
2230
2231/abc[\1]de/
2232    abc\1de
2233 0: abc\x01de
2234
2235/(abc)[\1]de/
2236    abc\1de
2237 0: abc\x01de
2238 1: abc
2239
2240/(?s)a.b/
2241    a\nb
2242 0: a\x0ab
2243
2244/^([^a])([^\b])([^c]*)([^d]{3,4})/
2245    baNOTccccd
2246 0: baNOTcccc
2247 1: b
2248 2: a
2249 3: NOT
2250 4: cccc
2251    baNOTcccd
2252 0: baNOTccc
2253 1: b
2254 2: a
2255 3: NOT
2256 4: ccc
2257    baNOTccd
2258 0: baNOTcc
2259 1: b
2260 2: a
2261 3: NO
2262 4: Tcc
2263    bacccd
2264 0: baccc
2265 1: b
2266 2: a
2267 3:
2268 4: ccc
2269    *** Failers
2270 0: *** Failers
2271 1: *
2272 2: *
2273 3: * Fail
2274 4: ers
2275    anything
2276No match
2277    b\bc
2278No match
2279    baccd
2280No match
2281
2282/[^a]/
2283    Abc
2284 0: A
2285
2286/[^a]/i
2287    Abc
2288 0: b
2289
2290/[^a]+/
2291    AAAaAbc
2292 0: AAA
2293
2294/[^a]+/i
2295    AAAaAbc
2296 0: bc
2297
2298/[^a]+/
2299    bbb\nccc
2300 0: bbb\x0accc
2301
2302/[^k]$/
2303    abc
2304 0: c
2305    *** Failers
2306 0: s
2307    abk
2308No match
2309
2310/[^k]{2,3}$/
2311    abc
2312 0: abc
2313    kbc
2314 0: bc
2315    kabc
2316 0: abc
2317    *** Failers
2318 0: ers
2319    abk
2320No match
2321    akb
2322No match
2323    akk
2324No match
2325
2326/^\d{8,}\@.+[^k]$/
2327    12345678\@a.b.c.d
2328 0: 12345678@a.b.c.d
2329    123456789\@x.y.z
2330 0: 123456789@x.y.z
2331    *** Failers
2332No match
2333    12345678\@x.y.uk
2334No match
2335    1234567\@a.b.c.d
2336No match
2337
2338/(a)\1{8,}/
2339    aaaaaaaaa
2340 0: aaaaaaaaa
2341 1: a
2342    aaaaaaaaaa
2343 0: aaaaaaaaaa
2344 1: a
2345    *** Failers
2346No match
2347    aaaaaaa
2348No match
2349
2350/[^a]/
2351    aaaabcd
2352 0: b
2353    aaAabcd
2354 0: A
2355
2356/[^a]/i
2357    aaaabcd
2358 0: b
2359    aaAabcd
2360 0: b
2361
2362/[^az]/
2363    aaaabcd
2364 0: b
2365    aaAabcd
2366 0: A
2367
2368/[^az]/i
2369    aaaabcd
2370 0: b
2371    aaAabcd
2372 0: b
2373
2374/\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
2375 \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
2376 0: \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff
2377
2378/P[^*]TAIRE[^*]{1,6}?LL/
2379    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2380 0: PSTAIREISLL
2381
2382/P[^*]TAIRE[^*]{1,}?LL/
2383    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2384 0: PSTAIREISLL
2385
2386/(\.\d\d[1-9]?)\d+/
2387    1.230003938
2388 0: .230003938
2389 1: .23
2390    1.875000282
2391 0: .875000282
2392 1: .875
2393    1.235
2394 0: .235
2395 1: .23
2396
2397/(\.\d\d((?=0)|\d(?=\d)))/
2398    1.230003938
2399 0: .23
2400 1: .23
2401 2:
2402    1.875000282
2403 0: .875
2404 1: .875
2405 2: 5
2406    *** Failers
2407No match
2408    1.235
2409No match
2410
2411/a(?)b/
2412    ab
2413 0: ab
2414
2415/\b(foo)\s+(\w+)/i
2416    Food is on the foo table
2417 0: foo table
2418 1: foo
2419 2: table
2420
2421/foo(.*)bar/
2422    The food is under the bar in the barn.
2423 0: food is under the bar in the bar
2424 1: d is under the bar in the
2425
2426/foo(.*?)bar/
2427    The food is under the bar in the barn.
2428 0: food is under the bar
2429 1: d is under the
2430
2431/(.*)(\d*)/
2432    I have 2 numbers: 53147
2433 0: I have 2 numbers: 53147
2434 1: I have 2 numbers: 53147
2435 2:
2436
2437/(.*)(\d+)/
2438    I have 2 numbers: 53147
2439 0: I have 2 numbers: 53147
2440 1: I have 2 numbers: 5314
2441 2: 7
2442
2443/(.*?)(\d*)/
2444    I have 2 numbers: 53147
2445 0:
2446 1:
2447 2:
2448
2449/(.*?)(\d+)/
2450    I have 2 numbers: 53147
2451 0: I have 2
2452 1: I have
2453 2: 2
2454
2455/(.*)(\d+)$/
2456    I have 2 numbers: 53147
2457 0: I have 2 numbers: 53147
2458 1: I have 2 numbers: 5314
2459 2: 7
2460
2461/(.*?)(\d+)$/
2462    I have 2 numbers: 53147
2463 0: I have 2 numbers: 53147
2464 1: I have 2 numbers:
2465 2: 53147
2466
2467/(.*)\b(\d+)$/
2468    I have 2 numbers: 53147
2469 0: I have 2 numbers: 53147
2470 1: I have 2 numbers:
2471 2: 53147
2472
2473/(.*\D)(\d+)$/
2474    I have 2 numbers: 53147
2475 0: I have 2 numbers: 53147
2476 1: I have 2 numbers:
2477 2: 53147
2478
2479/^\D*(?!123)/
2480    ABC123
2481 0: AB
2482
2483/^(\D*)(?=\d)(?!123)/
2484    ABC445
2485 0: ABC
2486 1: ABC
2487    *** Failers
2488No match
2489    ABC123
2490No match
2491
2492/^[W-]46]/
2493    W46]789
2494 0: W46]
2495    -46]789
2496 0: -46]
2497    *** Failers
2498No match
2499    Wall
2500No match
2501    Zebra
2502No match
2503    42
2504No match
2505    [abcd]
2506No match
2507    ]abcd[
2508No match
2509
2510/^[W-\]46]/
2511    W46]789
2512 0: W
2513    Wall
2514 0: W
2515    Zebra
2516 0: Z
2517    Xylophone
2518 0: X
2519    42
2520 0: 4
2521    [abcd]
2522 0: [
2523    ]abcd[
2524 0: ]
2525    \\backslash
2526 0: \
2527    *** Failers
2528No match
2529    -46]789
2530No match
2531    well
2532No match
2533
2534/\d\d\/\d\d\/\d\d\d\d/
2535    01/01/2000
2536 0: 01/01/2000
2537
2538/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
2539  word cat dog elephant mussel cow horse canary baboon snake shark otherword
2540 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
2541  word cat dog elephant mussel cow horse canary baboon snake shark
2542No match
2543
2544/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
2545  word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
2546No match
2547
2548/^(a){0,0}/
2549    bcd
2550 0:
2551    abc
2552 0:
2553    aab
2554 0:
2555
2556/^(a){0,1}/
2557    bcd
2558 0:
2559    abc
2560 0: a
2561 1: a
2562    aab
2563 0: a
2564 1: a
2565
2566/^(a){0,2}/
2567    bcd
2568 0:
2569    abc
2570 0: a
2571 1: a
2572    aab
2573 0: aa
2574 1: a
2575
2576/^(a){0,3}/
2577    bcd
2578 0:
2579    abc
2580 0: a
2581 1: a
2582    aab
2583 0: aa
2584 1: a
2585    aaa
2586 0: aaa
2587 1: a
2588
2589/^(a){0,}/
2590    bcd
2591 0:
2592    abc
2593 0: a
2594 1: a
2595    aab
2596 0: aa
2597 1: a
2598    aaa
2599 0: aaa
2600 1: a
2601    aaaaaaaa
2602 0: aaaaaaaa
2603 1: a
2604
2605/^(a){1,1}/
2606    bcd
2607No match
2608    abc
2609 0: a
2610 1: a
2611    aab
2612 0: a
2613 1: a
2614
2615/^(a){1,2}/
2616    bcd
2617No match
2618    abc
2619 0: a
2620 1: a
2621    aab
2622 0: aa
2623 1: a
2624
2625/^(a){1,3}/
2626    bcd
2627No match
2628    abc
2629 0: a
2630 1: a
2631    aab
2632 0: aa
2633 1: a
2634    aaa
2635 0: aaa
2636 1: a
2637
2638/^(a){1,}/
2639    bcd
2640No match
2641    abc
2642 0: a
2643 1: a
2644    aab
2645 0: aa
2646 1: a
2647    aaa
2648 0: aaa
2649 1: a
2650    aaaaaaaa
2651 0: aaaaaaaa
2652 1: a
2653
2654/.*\.gif/
2655    borfle\nbib.gif\nno
2656 0: bib.gif
2657
2658/.{0,}\.gif/
2659    borfle\nbib.gif\nno
2660 0: bib.gif
2661
2662/.*\.gif/m
2663    borfle\nbib.gif\nno
2664 0: bib.gif
2665
2666/.*\.gif/s
2667    borfle\nbib.gif\nno
2668 0: borfle\x0abib.gif
2669
2670/.*\.gif/ms
2671    borfle\nbib.gif\nno
2672 0: borfle\x0abib.gif
2673
2674/.*$/
2675    borfle\nbib.gif\nno
2676 0: no
2677
2678/.*$/m
2679    borfle\nbib.gif\nno
2680 0: borfle
2681
2682/.*$/s
2683    borfle\nbib.gif\nno
2684 0: borfle\x0abib.gif\x0ano
2685
2686/.*$/ms
2687    borfle\nbib.gif\nno
2688 0: borfle\x0abib.gif\x0ano
2689
2690/.*$/
2691    borfle\nbib.gif\nno\n
2692 0: no
2693
2694/.*$/m
2695    borfle\nbib.gif\nno\n
2696 0: borfle
2697
2698/.*$/s
2699    borfle\nbib.gif\nno\n
2700 0: borfle\x0abib.gif\x0ano\x0a
2701
2702/.*$/ms
2703    borfle\nbib.gif\nno\n
2704 0: borfle\x0abib.gif\x0ano\x0a
2705
2706/(.*X|^B)/
2707    abcde\n1234Xyz
2708 0: 1234X
2709 1: 1234X
2710    BarFoo
2711 0: B
2712 1: B
2713    *** Failers
2714No match
2715    abcde\nBar
2716No match
2717
2718/(.*X|^B)/m
2719    abcde\n1234Xyz
2720 0: 1234X
2721 1: 1234X
2722    BarFoo
2723 0: B
2724 1: B
2725    abcde\nBar
2726 0: B
2727 1: B
2728
2729/(.*X|^B)/s
2730    abcde\n1234Xyz
2731 0: abcde\x0a1234X
2732 1: abcde\x0a1234X
2733    BarFoo
2734 0: B
2735 1: B
2736    *** Failers
2737No match
2738    abcde\nBar
2739No match
2740
2741/(.*X|^B)/ms
2742    abcde\n1234Xyz
2743 0: abcde\x0a1234X
2744 1: abcde\x0a1234X
2745    BarFoo
2746 0: B
2747 1: B
2748    abcde\nBar
2749 0: B
2750 1: B
2751
2752/(?s)(.*X|^B)/
2753    abcde\n1234Xyz
2754 0: abcde\x0a1234X
2755 1: abcde\x0a1234X
2756    BarFoo
2757 0: B
2758 1: B
2759    *** Failers
2760No match
2761    abcde\nBar
2762No match
2763
2764/(?s:.*X|^B)/
2765    abcde\n1234Xyz
2766 0: abcde\x0a1234X
2767    BarFoo
2768 0: B
2769    *** Failers
2770No match
2771    abcde\nBar
2772No match
2773
2774/^.*B/
2775    **** Failers
2776No match
2777    abc\nB
2778No match
2779
2780/(?s)^.*B/
2781    abc\nB
2782 0: abc\x0aB
2783
2784/(?m)^.*B/
2785    abc\nB
2786 0: B
2787
2788/(?ms)^.*B/
2789    abc\nB
2790 0: abc\x0aB
2791
2792/(?ms)^B/
2793    abc\nB
2794 0: B
2795
2796/(?s)B$/
2797    B\n
2798 0: B
2799
2800/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
2801    123456654321
2802 0: 123456654321
2803
2804/^\d\d\d\d\d\d\d\d\d\d\d\d/
2805    123456654321
2806 0: 123456654321
2807
2808/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
2809    123456654321
2810 0: 123456654321
2811
2812/^[abc]{12}/
2813    abcabcabcabc
2814 0: abcabcabcabc
2815
2816/^[a-c]{12}/
2817    abcabcabcabc
2818 0: abcabcabcabc
2819
2820/^(a|b|c){12}/
2821    abcabcabcabc
2822 0: abcabcabcabc
2823 1: c
2824
2825/^[abcdefghijklmnopqrstuvwxy0123456789]/
2826    n
2827 0: n
2828    *** Failers
2829No match
2830    z
2831No match
2832
2833/abcde{0,0}/
2834    abcd
2835 0: abcd
2836    *** Failers
2837No match
2838    abce
2839No match
2840
2841/ab[cd]{0,0}e/
2842    abe
2843 0: abe
2844    *** Failers
2845No match
2846    abcde
2847No match
2848
2849/ab(c){0,0}d/
2850    abd
2851 0: abd
2852    *** Failers
2853No match
2854    abcd
2855No match
2856
2857/a(b*)/
2858    a
2859 0: a
2860 1:
2861    ab
2862 0: ab
2863 1: b
2864    abbbb
2865 0: abbbb
2866 1: bbbb
2867    *** Failers
2868 0: a
2869 1:
2870    bbbbb
2871No match
2872
2873/ab\d{0}e/
2874    abe
2875 0: abe
2876    *** Failers
2877No match
2878    ab1e
2879No match
2880
2881/"([^\\"]+|\\.)*"/
2882    the \"quick\" brown fox
2883 0: "quick"
2884 1: quick
2885    \"the \\\"quick\\\" brown fox\"
2886 0: "the \"quick\" brown fox"
2887 1:  brown fox
2888
2889/.*?/g+
2890    abc
2891 0:
2892 0+ abc
2893 0: a
2894 0+ bc
2895 0:
2896 0+ bc
2897 0: b
2898 0+ c
2899 0:
2900 0+ c
2901 0: c
2902 0+
2903 0:
2904 0+
2905
2906/\b/g+
2907    abc
2908 0:
2909 0+ abc
2910 0:
2911 0+
2912
2913/\b/+g
2914    abc
2915 0:
2916 0+ abc
2917 0:
2918 0+
2919
2920//g
2921    abc
2922 0:
2923 0:
2924 0:
2925 0:
2926
2927/<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>/is
2928  <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
2929 0: <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
2930 1:  BGCOLOR='#DBE9E9'
2931 2:  align=left valign=top
2932 3: 43.
2933 4: <a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)
2934 5:
2935 6:
2936 7: <unset>
2937 8:  align=left valign=top
2938 9: Lega lstaff.com
293910:  align=left valign=top
294011: CA - Statewide
2941
2942/a[^a]b/
2943    acb
2944 0: acb
2945    a\nb
2946 0: a\x0ab
2947
2948/a.b/
2949    acb
2950 0: acb
2951    *** Failers
2952No match
2953    a\nb
2954No match
2955
2956/a[^a]b/s
2957    acb
2958 0: acb
2959    a\nb
2960 0: a\x0ab
2961
2962/a.b/s
2963    acb
2964 0: acb
2965    a\nb
2966 0: a\x0ab
2967
2968/^(b+?|a){1,2}?c/
2969    bac
2970 0: bac
2971 1: a
2972    bbac
2973 0: bbac
2974 1: a
2975    bbbac
2976 0: bbbac
2977 1: a
2978    bbbbac
2979 0: bbbbac
2980 1: a
2981    bbbbbac
2982 0: bbbbbac
2983 1: a
2984
2985/^(b+|a){1,2}?c/
2986    bac
2987 0: bac
2988 1: a
2989    bbac
2990 0: bbac
2991 1: a
2992    bbbac
2993 0: bbbac
2994 1: a
2995    bbbbac
2996 0: bbbbac
2997 1: a
2998    bbbbbac
2999 0: bbbbbac
3000 1: a
3001
3002/(?!\A)x/m
3003    x\nb\n
3004No match
3005    a\bx\n
3006 0: x
3007
3008/\x0{ab}/
3009    \0{ab}
3010 0: \x00{ab}
3011
3012/(A|B)*?CD/
3013    CD
3014 0: CD
3015
3016/(A|B)*CD/
3017    CD
3018 0: CD
3019
3020/(AB)*?\1/
3021    ABABAB
3022 0: ABAB
3023 1: AB
3024
3025/(AB)*\1/
3026    ABABAB
3027 0: ABABAB
3028 1: AB
3029
3030/(?<!bar)foo/
3031    foo
3032 0: foo
3033    catfood
3034 0: foo
3035    arfootle
3036 0: foo
3037    rfoosh
3038 0: foo
3039    *** Failers
3040No match
3041    barfoo
3042No match
3043    towbarfoo
3044No match
3045
3046/\w{3}(?<!bar)foo/
3047    catfood
3048 0: catfoo
3049    *** Failers
3050No match
3051    foo
3052No match
3053    barfoo
3054No match
3055    towbarfoo
3056No match
3057
3058/(?<=(foo)a)bar/
3059    fooabar
3060 0: bar
3061 1: foo
3062    *** Failers
3063No match
3064    bar
3065No match
3066    foobbar
3067No match
3068
3069/\Aabc\z/m
3070    abc
3071 0: abc
3072    *** Failers
3073No match
3074    abc\n
3075No match
3076    qqq\nabc
3077No match
3078    abc\nzzz
3079No match
3080    qqq\nabc\nzzz
3081No match
3082
3083"(?>.*/)foo"
3084    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
3085No match
3086
3087"(?>.*/)foo"
3088    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
3089 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
3090
3091/(?>(\.\d\d[1-9]?))\d+/
3092    1.230003938
3093 0: .230003938
3094 1: .23
3095    1.875000282
3096 0: .875000282
3097 1: .875
3098    *** Failers
3099No match
3100    1.235
3101No match
3102
3103/^((?>\w+)|(?>\s+))*$/
3104    now is the time for all good men to come to the aid of the party
3105 0: now is the time for all good men to come to the aid of the party
3106 1: party
3107    *** Failers
3108No match
3109    this is not a line with only words and spaces!
3110No match
3111
3112/(\d+)(\w)/
3113    12345a
3114 0: 12345a
3115 1: 12345
3116 2: a
3117    12345+
3118 0: 12345
3119 1: 1234
3120 2: 5
3121
3122/((?>\d+))(\w)/
3123    12345a
3124 0: 12345a
3125 1: 12345
3126 2: a
3127    *** Failers
3128No match
3129    12345+
3130No match
3131
3132/(?>a+)b/
3133    aaab
3134 0: aaab
3135
3136/((?>a+)b)/
3137    aaab
3138 0: aaab
3139 1: aaab
3140
3141/(?>(a+))b/
3142    aaab
3143 0: aaab
3144 1: aaa
3145
3146/(?>b)+/
3147    aaabbbccc
3148 0: bbb
3149
3150/(?>a+|b+|c+)*c/
3151    aaabbbbccccd
3152 0: aaabbbbc
3153
3154/((?>[^()]+)|\([^()]*\))+/
3155    ((abc(ade)ufh()()x
3156 0: abc(ade)ufh()()x
3157 1: x
3158
3159/\(((?>[^()]+)|\([^()]+\))+\)/
3160    (abc)
3161 0: (abc)
3162 1: abc
3163    (abc(def)xyz)
3164 0: (abc(def)xyz)
3165 1: xyz
3166    *** Failers
3167No match
3168    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3169No match
3170
3171/a(?-i)b/i
3172    ab
3173 0: ab
3174    Ab
3175 0: Ab
3176    *** Failers
3177No match
3178    aB
3179No match
3180    AB
3181No match
3182
3183/(a (?x)b c)d e/
3184    a bcd e
3185 0: a bcd e
3186 1: a bc
3187    *** Failers
3188No match
3189    a b cd e
3190No match
3191    abcd e
3192No match
3193    a bcde
3194No match
3195
3196/(a b(?x)c d (?-x)e f)/
3197    a bcde f
3198 0: a bcde f
3199 1: a bcde f
3200    *** Failers
3201No match
3202    abcdef
3203No match
3204
3205/(a(?i)b)c/
3206    abc
3207 0: abc
3208 1: ab
3209    aBc
3210 0: aBc
3211 1: aB
3212    *** Failers
3213No match
3214    abC
3215No match
3216    aBC
3217No match
3218    Abc
3219No match
3220    ABc
3221No match
3222    ABC
3223No match
3224    AbC
3225No match
3226
3227/a(?i:b)c/
3228    abc
3229 0: abc
3230    aBc
3231 0: aBc
3232    *** Failers
3233No match
3234    ABC
3235No match
3236    abC
3237No match
3238    aBC
3239No match
3240
3241/a(?i:b)*c/
3242    aBc
3243 0: aBc
3244    aBBc
3245 0: aBBc
3246    *** Failers
3247No match
3248    aBC
3249No match
3250    aBBC
3251No match
3252
3253/a(?=b(?i)c)\w\wd/
3254    abcd
3255 0: abcd
3256    abCd
3257 0: abCd
3258    *** Failers
3259No match
3260    aBCd
3261No match
3262    abcD
3263No match
3264
3265/(?s-i:more.*than).*million/i
3266    more than million
3267 0: more than million
3268    more than MILLION
3269 0: more than MILLION
3270    more \n than Million
3271 0: more \x0a than Million
3272    *** Failers
3273No match
3274    MORE THAN MILLION
3275No match
3276    more \n than \n million
3277No match
3278
3279/(?:(?s-i)more.*than).*million/i
3280    more than million
3281 0: more than million
3282    more than MILLION
3283 0: more than MILLION
3284    more \n than Million
3285 0: more \x0a than Million
3286    *** Failers
3287No match
3288    MORE THAN MILLION
3289No match
3290    more \n than \n million
3291No match
3292
3293/(?>a(?i)b+)+c/
3294    abc
3295 0: abc
3296    aBbc
3297 0: aBbc
3298    aBBc
3299 0: aBBc
3300    *** Failers
3301No match
3302    Abc
3303No match
3304    abAb
3305No match
3306    abbC
3307No match
3308
3309/(?=a(?i)b)\w\wc/
3310    abc
3311 0: abc
3312    aBc
3313 0: aBc
3314    *** Failers
3315No match
3316    Ab
3317No match
3318    abC
3319No match
3320    aBC
3321No match
3322
3323/(?<=a(?i)b)(\w\w)c/
3324    abxxc
3325 0: xxc
3326 1: xx
3327    aBxxc
3328 0: xxc
3329 1: xx
3330    *** Failers
3331No match
3332    Abxxc
3333No match
3334    ABxxc
3335No match
3336    abxxC
3337No match
3338
3339/(?:(a)|b)(?(1)A|B)/
3340    aA
3341 0: aA
3342 1: a
3343    bB
3344 0: bB
3345    *** Failers
3346No match
3347    aB
3348No match
3349    bA
3350No match
3351
3352/^(a)?(?(1)a|b)+$/
3353    aa
3354 0: aa
3355 1: a
3356    b
3357 0: b
3358    bb
3359 0: bb
3360    *** Failers
3361No match
3362    ab
3363No match
3364
3365/^(?(?=abc)\w{3}:|\d\d)$/
3366    abc:
3367 0: abc:
3368    12
3369 0: 12
3370    *** Failers
3371No match
3372    123
3373No match
3374    xyz
3375No match
3376
3377/^(?(?!abc)\d\d|\w{3}:)$/
3378    abc:
3379 0: abc:
3380    12
3381 0: 12
3382    *** Failers
3383No match
3384    123
3385No match
3386    xyz
3387No match
3388
3389/(?(?<=foo)bar|cat)/
3390    foobar
3391 0: bar
3392    cat
3393 0: cat
3394    fcat
3395 0: cat
3396    focat
3397 0: cat
3398    *** Failers
3399No match
3400    foocat
3401No match
3402
3403/(?(?<!foo)cat|bar)/
3404    foobar
3405 0: bar
3406    cat
3407 0: cat
3408    fcat
3409 0: cat
3410    focat
3411 0: cat
3412    *** Failers
3413No match
3414    foocat
3415No match
3416
3417/( \( )? [^()]+ (?(1) \) |) /x
3418    abcd
3419 0: abcd
3420    (abcd)
3421 0: (abcd)
3422 1: (
3423    the quick (abcd) fox
3424 0: the quick
3425    (abcd
3426 0: abcd
3427
3428/( \( )? [^()]+ (?(1) \) ) /x
3429    abcd
3430 0: abcd
3431    (abcd)
3432 0: (abcd)
3433 1: (
3434    the quick (abcd) fox
3435 0: the quick
3436    (abcd
3437 0: abcd
3438
3439/^(?(2)a|(1)(2))+$/
3440    12
3441 0: 12
3442 1: 1
3443 2: 2
3444    12a
3445 0: 12a
3446 1: 1
3447 2: 2
3448    12aa
3449 0: 12aa
3450 1: 1
3451 2: 2
3452    *** Failers
3453No match
3454    1234
3455No match
3456
3457/((?i)blah)\s+\1/
3458    blah blah
3459 0: blah blah
3460 1: blah
3461    BLAH BLAH
3462 0: BLAH BLAH
3463 1: BLAH
3464    Blah Blah
3465 0: Blah Blah
3466 1: Blah
3467    blaH blaH
3468 0: blaH blaH
3469 1: blaH
3470    *** Failers
3471No match
3472    blah BLAH
3473No match
3474    Blah blah
3475No match
3476    blaH blah
3477No match
3478
3479/((?i)blah)\s+(?i:\1)/
3480    blah blah
3481 0: blah blah
3482 1: blah
3483    BLAH BLAH
3484 0: BLAH BLAH
3485 1: BLAH
3486    Blah Blah
3487 0: Blah Blah
3488 1: Blah
3489    blaH blaH
3490 0: blaH blaH
3491 1: blaH
3492    blah BLAH
3493 0: blah BLAH
3494 1: blah
3495    Blah blah
3496 0: Blah blah
3497 1: Blah
3498    blaH blah
3499 0: blaH blah
3500 1: blaH
3501
3502/(?>a*)*/
3503    a
3504 0: a
3505    aa
3506 0: aa
3507    aaaa
3508 0: aaaa
3509
3510/(abc|)+/
3511    abc
3512 0: abc
3513 1:
3514    abcabc
3515 0: abcabc
3516 1:
3517    abcabcabc
3518 0: abcabcabc
3519 1:
3520    xyz
3521 0:
3522 1:
3523
3524/([a]*)*/
3525    a
3526 0: a
3527 1:
3528    aaaaa
3529 0: aaaaa
3530 1:
3531
3532/([ab]*)*/
3533    a
3534 0: a
3535 1:
3536    b
3537 0: b
3538 1:
3539    ababab
3540 0: ababab
3541 1:
3542    aaaabcde
3543 0: aaaab
3544 1:
3545    bbbb
3546 0: bbbb
3547 1:
3548
3549/([^a]*)*/
3550    b
3551 0: b
3552 1:
3553    bbbb
3554 0: bbbb
3555 1:
3556    aaa
3557 0:
3558 1:
3559
3560/([^ab]*)*/
3561    cccc
3562 0: cccc
3563 1:
3564    abab
3565 0:
3566 1:
3567
3568/([a]*?)*/
3569    a
3570 0:
3571 1:
3572    aaaa
3573 0:
3574 1:
3575
3576/([ab]*?)*/
3577    a
3578 0:
3579 1:
3580    b
3581 0:
3582 1:
3583    abab
3584 0:
3585 1:
3586    baba
3587 0:
3588 1:
3589
3590/([^a]*?)*/
3591    b
3592 0:
3593 1:
3594    bbbb
3595 0:
3596 1:
3597    aaa
3598 0:
3599 1:
3600
3601/([^ab]*?)*/
3602    c
3603 0:
3604 1:
3605    cccc
3606 0:
3607 1:
3608    baba
3609 0:
3610 1:
3611
3612/(?>a*)*/
3613    a
3614 0: a
3615    aaabcde
3616 0: aaa
3617
3618/((?>a*))*/
3619    aaaaa
3620 0: aaaaa
3621 1:
3622    aabbaa
3623 0: aa
3624 1:
3625
3626/((?>a*?))*/
3627    aaaaa
3628 0:
3629 1:
3630    aabbaa
3631 0:
3632 1:
3633
3634/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
3635    12-sep-98
3636 0: 12-sep-98
3637    12-09-98
3638 0: 12-09-98
3639    *** Failers
3640No match
3641    sep-12-98
3642No match
3643
3644/(?<=(foo))bar\1/
3645    foobarfoo
3646 0: barfoo
3647 1: foo
3648    foobarfootling
3649 0: barfoo
3650 1: foo
3651    *** Failers
3652No match
3653    foobar
3654No match
3655    barfoo
3656No match
3657
3658/(?i:saturday|sunday)/
3659    saturday
3660 0: saturday
3661    sunday
3662 0: sunday
3663    Saturday
3664 0: Saturday
3665    Sunday
3666 0: Sunday
3667    SATURDAY
3668 0: SATURDAY
3669    SUNDAY
3670 0: SUNDAY
3671    SunDay
3672 0: SunDay
3673
3674/(a(?i)bc|BB)x/
3675    abcx
3676 0: abcx
3677 1: abc
3678    aBCx
3679 0: aBCx
3680 1: aBC
3681    bbx
3682 0: bbx
3683 1: bb
3684    BBx
3685 0: BBx
3686 1: BB
3687    *** Failers
3688No match
3689    abcX
3690No match
3691    aBCX
3692No match
3693    bbX
3694No match
3695    BBX
3696No match
3697
3698/^([ab](?i)[cd]|[ef])/
3699    ac
3700 0: ac
3701 1: ac
3702    aC
3703 0: aC
3704 1: aC
3705    bD
3706 0: bD
3707 1: bD
3708    elephant
3709 0: e
3710 1: e
3711    Europe
3712 0: E
3713 1: E
3714    frog
3715 0: f
3716 1: f
3717    France
3718 0: F
3719 1: F
3720    *** Failers
3721No match
3722    Africa
3723No match
3724
3725/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
3726    ab
3727 0: ab
3728 1: ab
3729    aBd
3730 0: aBd
3731 1: aBd
3732    xy
3733 0: xy
3734 1: xy
3735    xY
3736 0: xY
3737 1: xY
3738    zebra
3739 0: z
3740 1: z
3741    Zambesi
3742 0: Z
3743 1: Z
3744    *** Failers
3745No match
3746    aCD
3747No match
3748    XY
3749No match
3750
3751/(?<=foo\n)^bar/m
3752    foo\nbar
3753 0: bar
3754    *** Failers
3755No match
3756    bar
3757No match
3758    baz\nbar
3759No match
3760
3761/(?<=(?<!foo)bar)baz/
3762    barbaz
3763 0: baz
3764    barbarbaz
3765 0: baz
3766    koobarbaz
3767 0: baz
3768    *** Failers
3769No match
3770    baz
3771No match
3772    foobarbaz
3773No match
3774
3775/The cases of aaaa and aaaaaa are missed out below because Perl does things/
3776/differently. We know that odd, and maybe incorrect, things happen with/
3777No match
3778/recursive references in Perl, as far as 5.11.3 - see some stuff in test #2./
3779No match
3780
3781/^(a\1?){4}$/
3782    a
3783No match
3784    aa
3785No match
3786    aaa
3787No match
3788    aaaaa
3789 0: aaaaa
3790 1: a
3791    aaaaaaa
3792 0: aaaaaaa
3793 1: a
3794    aaaaaaaa
3795No match
3796    aaaaaaaaa
3797No match
3798    aaaaaaaaaa
3799 0: aaaaaaaaaa
3800 1: aaaa
3801    aaaaaaaaaaa
3802No match
3803    aaaaaaaaaaaa
3804No match
3805    aaaaaaaaaaaaa
3806No match
3807    aaaaaaaaaaaaaa
3808No match
3809    aaaaaaaaaaaaaaa
3810No match
3811    aaaaaaaaaaaaaaaa
3812No match
3813
3814/^(a\1?)(a\1?)(a\2?)(a\3?)$/
3815    a
3816No match
3817    aa
3818No match
3819    aaa
3820No match
3821    aaaa
3822 0: aaaa
3823 1: a
3824 2: a
3825 3: a
3826 4: a
3827    aaaaa
3828 0: aaaaa
3829 1: a
3830 2: aa
3831 3: a
3832 4: a
3833    aaaaaa
3834 0: aaaaaa
3835 1: a
3836 2: aa
3837 3: a
3838 4: aa
3839    aaaaaaa
3840 0: aaaaaaa
3841 1: a
3842 2: aa
3843 3: aaa
3844 4: a
3845    aaaaaaaa
3846No match
3847    aaaaaaaaa
3848No match
3849    aaaaaaaaaa
3850 0: aaaaaaaaaa
3851 1: a
3852 2: aa
3853 3: aaa
3854 4: aaaa
3855    aaaaaaaaaaa
3856No match
3857    aaaaaaaaaaaa
3858No match
3859    aaaaaaaaaaaaa
3860No match
3861    aaaaaaaaaaaaaa
3862No match
3863    aaaaaaaaaaaaaaa
3864No match
3865    aaaaaaaaaaaaaaaa
3866No match
3867
3868/The following tests are taken from the Perl 5.005 test suite; some of them/
3869/are compatible with 5.004, but I'd rather not have to sort them out./
3870No match
3871
3872/abc/
3873    abc
3874 0: abc
3875    xabcy
3876 0: abc
3877    ababc
3878 0: abc
3879    *** Failers
3880No match
3881    xbc
3882No match
3883    axc
3884No match
3885    abx
3886No match
3887
3888/ab*c/
3889    abc
3890 0: abc
3891
3892/ab*bc/
3893    abc
3894 0: abc
3895    abbc
3896 0: abbc
3897    abbbbc
3898 0: abbbbc
3899
3900/.{1}/
3901    abbbbc
3902 0: a
3903
3904/.{3,4}/
3905    abbbbc
3906 0: abbb
3907
3908/ab{0,}bc/
3909    abbbbc
3910 0: abbbbc
3911
3912/ab+bc/
3913    abbc
3914 0: abbc
3915    *** Failers
3916No match
3917    abc
3918No match
3919    abq
3920No match
3921
3922/ab{1,}bc/
3923
3924/ab+bc/
3925    abbbbc
3926 0: abbbbc
3927
3928/ab{1,}bc/
3929    abbbbc
3930 0: abbbbc
3931
3932/ab{1,3}bc/
3933    abbbbc
3934 0: abbbbc
3935
3936/ab{3,4}bc/
3937    abbbbc
3938 0: abbbbc
3939
3940/ab{4,5}bc/
3941    *** Failers
3942No match
3943    abq
3944No match
3945    abbbbc
3946No match
3947
3948/ab?bc/
3949    abbc
3950 0: abbc
3951    abc
3952 0: abc
3953
3954/ab{0,1}bc/
3955    abc
3956 0: abc
3957
3958/ab?bc/
3959
3960/ab?c/
3961    abc
3962 0: abc
3963
3964/ab{0,1}c/
3965    abc
3966 0: abc
3967
3968/^abc$/
3969    abc
3970 0: abc
3971    *** Failers
3972No match
3973    abbbbc
3974No match
3975    abcc
3976No match
3977
3978/^abc/
3979    abcc
3980 0: abc
3981
3982/^abc$/
3983
3984/abc$/
3985    aabc
3986 0: abc
3987    *** Failers
3988No match
3989    aabc
3990 0: abc
3991    aabcd
3992No match
3993
3994/^/
3995    abc
3996 0:
3997
3998/$/
3999    abc
4000 0:
4001
4002/a.c/
4003    abc
4004 0: abc
4005    axc
4006 0: axc
4007
4008/a.*c/
4009    axyzc
4010 0: axyzc
4011
4012/a[bc]d/
4013    abd
4014 0: abd
4015    *** Failers
4016No match
4017    axyzd
4018No match
4019    abc
4020No match
4021
4022/a[b-d]e/
4023    ace
4024 0: ace
4025
4026/a[b-d]/
4027    aac
4028 0: ac
4029
4030/a[-b]/
4031    a-
4032 0: a-
4033
4034/a[b-]/
4035    a-
4036 0: a-
4037
4038/a]/
4039    a]
4040 0: a]
4041
4042/a[]]b/
4043    a]b
4044 0: a]b
4045
4046/a[^bc]d/
4047    aed
4048 0: aed
4049    *** Failers
4050No match
4051    abd
4052No match
4053    abd
4054No match
4055
4056/a[^-b]c/
4057    adc
4058 0: adc
4059
4060/a[^]b]c/
4061    adc
4062 0: adc
4063    *** Failers
4064No match
4065    a-c
4066 0: a-c
4067    a]c
4068No match
4069
4070/\ba\b/
4071    a-
4072 0: a
4073    -a
4074 0: a
4075    -a-
4076 0: a
4077
4078/\by\b/
4079    *** Failers
4080No match
4081    xy
4082No match
4083    yz
4084No match
4085    xyz
4086No match
4087
4088/\Ba\B/
4089    *** Failers
4090 0: a
4091    a-
4092No match
4093    -a
4094No match
4095    -a-
4096No match
4097
4098/\By\b/
4099    xy
4100 0: y
4101
4102/\by\B/
4103    yz
4104 0: y
4105
4106/\By\B/
4107    xyz
4108 0: y
4109
4110/\w/
4111    a
4112 0: a
4113
4114/\W/
4115    -
4116 0: -
4117    *** Failers
4118 0: *
4119    -
4120 0: -
4121    a
4122No match
4123
4124/a\sb/
4125    a b
4126 0: a b
4127
4128/a\Sb/
4129    a-b
4130 0: a-b
4131    *** Failers
4132No match
4133    a-b
4134 0: a-b
4135    a b
4136No match
4137
4138/\d/
4139    1
4140 0: 1
4141
4142/\D/
4143    -
4144 0: -
4145    *** Failers
4146 0: *
4147    -
4148 0: -
4149    1
4150No match
4151
4152/[\w]/
4153    a
4154 0: a
4155
4156/[\W]/
4157    -
4158 0: -
4159    *** Failers
4160 0: *
4161    -
4162 0: -
4163    a
4164No match
4165
4166/a[\s]b/
4167    a b
4168 0: a b
4169
4170/a[\S]b/
4171    a-b
4172 0: a-b
4173    *** Failers
4174No match
4175    a-b
4176 0: a-b
4177    a b
4178No match
4179
4180/[\d]/
4181    1
4182 0: 1
4183
4184/[\D]/
4185    -
4186 0: -
4187    *** Failers
4188 0: *
4189    -
4190 0: -
4191    1
4192No match
4193
4194/ab|cd/
4195    abc
4196 0: ab
4197    abcd
4198 0: ab
4199
4200/()ef/
4201    def
4202 0: ef
4203 1:
4204
4205/$b/
4206
4207/a\(b/
4208    a(b
4209 0: a(b
4210
4211/a\(*b/
4212    ab
4213 0: ab
4214    a((b
4215 0: a((b
4216
4217/a\\b/
4218    a\b
4219No match
4220
4221/((a))/
4222    abc
4223 0: a
4224 1: a
4225 2: a
4226
4227/(a)b(c)/
4228    abc
4229 0: abc
4230 1: a
4231 2: c
4232
4233/a+b+c/
4234    aabbabc
4235 0: abc
4236
4237/a{1,}b{1,}c/
4238    aabbabc
4239 0: abc
4240
4241/a.+?c/
4242    abcabc
4243 0: abc
4244
4245/(a+|b)*/
4246    ab
4247 0: ab
4248 1: b
4249
4250/(a+|b){0,}/
4251    ab
4252 0: ab
4253 1: b
4254
4255/(a+|b)+/
4256    ab
4257 0: ab
4258 1: b
4259
4260/(a+|b){1,}/
4261    ab
4262 0: ab
4263 1: b
4264
4265/(a+|b)?/
4266    ab
4267 0: a
4268 1: a
4269
4270/(a+|b){0,1}/
4271    ab
4272 0: a
4273 1: a
4274
4275/[^ab]*/
4276    cde
4277 0: cde
4278
4279/abc/
4280    *** Failers
4281No match
4282    b
4283No match
4284
4285
4286/a*/
4287
4288
4289/([abc])*d/
4290    abbbcd
4291 0: abbbcd
4292 1: c
4293
4294/([abc])*bcd/
4295    abcd
4296 0: abcd
4297 1: a
4298
4299/a|b|c|d|e/
4300    e
4301 0: e
4302
4303/(a|b|c|d|e)f/
4304    ef
4305 0: ef
4306 1: e
4307
4308/abcd*efg/
4309    abcdefg
4310 0: abcdefg
4311
4312/ab*/
4313    xabyabbbz
4314 0: ab
4315    xayabbbz
4316 0: a
4317
4318/(ab|cd)e/
4319    abcde
4320 0: cde
4321 1: cd
4322
4323/[abhgefdc]ij/
4324    hij
4325 0: hij
4326
4327/^(ab|cd)e/
4328
4329/(abc|)ef/
4330    abcdef
4331 0: ef
4332 1:
4333
4334/(a|b)c*d/
4335    abcd
4336 0: bcd
4337 1: b
4338
4339/(ab|ab*)bc/
4340    abc
4341 0: abc
4342 1: a
4343
4344/a([bc]*)c*/
4345    abc
4346 0: abc
4347 1: bc
4348
4349/a([bc]*)(c*d)/
4350    abcd
4351 0: abcd
4352 1: bc
4353 2: d
4354
4355/a([bc]+)(c*d)/
4356    abcd
4357 0: abcd
4358 1: bc
4359 2: d
4360
4361/a([bc]*)(c+d)/
4362    abcd
4363 0: abcd
4364 1: b
4365 2: cd
4366
4367/a[bcd]*dcdcde/
4368    adcdcde
4369 0: adcdcde
4370
4371/a[bcd]+dcdcde/
4372    *** Failers
4373No match
4374    abcde
4375No match
4376    adcdcde
4377No match
4378
4379/(ab|a)b*c/
4380    abc
4381 0: abc
4382 1: ab
4383
4384/((a)(b)c)(d)/
4385    abcd
4386 0: abcd
4387 1: abc
4388 2: a
4389 3: b
4390 4: d
4391
4392/[a-zA-Z_][a-zA-Z0-9_]*/
4393    alpha
4394 0: alpha
4395
4396/^a(bc+|b[eh])g|.h$/
4397    abh
4398 0: bh
4399
4400/(bc+d$|ef*g.|h?i(j|k))/
4401    effgz
4402 0: effgz
4403 1: effgz
4404    ij
4405 0: ij
4406 1: ij
4407 2: j
4408    reffgz
4409 0: effgz
4410 1: effgz
4411    *** Failers
4412No match
4413    effg
4414No match
4415    bcdd
4416No match
4417
4418/((((((((((a))))))))))/
4419    a
4420 0: a
4421 1: a
4422 2: a
4423 3: a
4424 4: a
4425 5: a
4426 6: a
4427 7: a
4428 8: a
4429 9: a
443010: a
4431
4432/((((((((((a))))))))))\10/
4433    aa
4434 0: aa
4435 1: a
4436 2: a
4437 3: a
4438 4: a
4439 5: a
4440 6: a
4441 7: a
4442 8: a
4443 9: a
444410: a
4445
4446/(((((((((a)))))))))/
4447    a
4448 0: a
4449 1: a
4450 2: a
4451 3: a
4452 4: a
4453 5: a
4454 6: a
4455 7: a
4456 8: a
4457 9: a
4458
4459/multiple words of text/
4460    *** Failers
4461No match
4462    aa
4463No match
4464    uh-uh
4465No match
4466
4467/multiple words/
4468    multiple words, yeah
4469 0: multiple words
4470
4471/(.*)c(.*)/
4472    abcde
4473 0: abcde
4474 1: ab
4475 2: de
4476
4477/\((.*), (.*)\)/
4478    (a, b)
4479 0: (a, b)
4480 1: a
4481 2: b
4482
4483/[k]/
4484
4485/abcd/
4486    abcd
4487 0: abcd
4488
4489/a(bc)d/
4490    abcd
4491 0: abcd
4492 1: bc
4493
4494/a[-]?c/
4495    ac
4496 0: ac
4497
4498/(abc)\1/
4499    abcabc
4500 0: abcabc
4501 1: abc
4502
4503/([a-c]*)\1/
4504    abcabc
4505 0: abcabc
4506 1: abc
4507
4508/(a)|\1/
4509    a
4510 0: a
4511 1: a
4512    *** Failers
4513 0: a
4514 1: a
4515    ab
4516 0: a
4517 1: a
4518    x
4519No match
4520
4521/(([a-c])b*?\2)*/
4522    ababbbcbc
4523 0: ababb
4524 1: bb
4525 2: b
4526
4527/(([a-c])b*?\2){3}/
4528    ababbbcbc
4529 0: ababbbcbc
4530 1: cbc
4531 2: c
4532
4533/((\3|b)\2(a)x)+/
4534    aaaxabaxbaaxbbax
4535 0: bbax
4536 1: bbax
4537 2: b
4538 3: a
4539
4540/((\3|b)\2(a)){2,}/
4541    bbaababbabaaaaabbaaaabba
4542 0: bbaaaabba
4543 1: bba
4544 2: b
4545 3: a
4546
4547/abc/i
4548    ABC
4549 0: ABC
4550    XABCY
4551 0: ABC
4552    ABABC
4553 0: ABC
4554    *** Failers
4555No match
4556    aaxabxbaxbbx
4557No match
4558    XBC
4559No match
4560    AXC
4561No match
4562    ABX
4563No match
4564
4565/ab*c/i
4566    ABC
4567 0: ABC
4568
4569/ab*bc/i
4570    ABC
4571 0: ABC
4572    ABBC
4573 0: ABBC
4574
4575/ab*?bc/i
4576    ABBBBC
4577 0: ABBBBC
4578
4579/ab{0,}?bc/i
4580    ABBBBC
4581 0: ABBBBC
4582
4583/ab+?bc/i
4584    ABBC
4585 0: ABBC
4586
4587/ab+bc/i
4588    *** Failers
4589No match
4590    ABC
4591No match
4592    ABQ
4593No match
4594
4595/ab{1,}bc/i
4596
4597/ab+bc/i
4598    ABBBBC
4599 0: ABBBBC
4600
4601/ab{1,}?bc/i
4602    ABBBBC
4603 0: ABBBBC
4604
4605/ab{1,3}?bc/i
4606    ABBBBC
4607 0: ABBBBC
4608
4609/ab{3,4}?bc/i
4610    ABBBBC
4611 0: ABBBBC
4612
4613/ab{4,5}?bc/i
4614    *** Failers
4615No match
4616    ABQ
4617No match
4618    ABBBBC
4619No match
4620
4621/ab??bc/i
4622    ABBC
4623 0: ABBC
4624    ABC
4625 0: ABC
4626
4627/ab{0,1}?bc/i
4628    ABC
4629 0: ABC
4630
4631/ab??bc/i
4632
4633/ab??c/i
4634    ABC
4635 0: ABC
4636
4637/ab{0,1}?c/i
4638    ABC
4639 0: ABC
4640
4641/^abc$/i
4642    ABC
4643 0: ABC
4644    *** Failers
4645No match
4646    ABBBBC
4647No match
4648    ABCC
4649No match
4650
4651/^abc/i
4652    ABCC
4653 0: ABC
4654
4655/^abc$/i
4656
4657/abc$/i
4658    AABC
4659 0: ABC
4660
4661/^/i
4662    ABC
4663 0:
4664
4665/$/i
4666    ABC
4667 0:
4668
4669/a.c/i
4670    ABC
4671 0: ABC
4672    AXC
4673 0: AXC
4674
4675/a.*?c/i
4676    AXYZC
4677 0: AXYZC
4678
4679/a.*c/i
4680    *** Failers
4681No match
4682    AABC
4683 0: AABC
4684    AXYZD
4685No match
4686
4687/a[bc]d/i
4688    ABD
4689 0: ABD
4690
4691/a[b-d]e/i
4692    ACE
4693 0: ACE
4694    *** Failers
4695No match
4696    ABC
4697No match
4698    ABD
4699No match
4700
4701/a[b-d]/i
4702    AAC
4703 0: AC
4704
4705/a[-b]/i
4706    A-
4707 0: A-
4708
4709/a[b-]/i
4710    A-
4711 0: A-
4712
4713/a]/i
4714    A]
4715 0: A]
4716
4717/a[]]b/i
4718    A]B
4719 0: A]B
4720
4721/a[^bc]d/i
4722    AED
4723 0: AED
4724
4725/a[^-b]c/i
4726    ADC
4727 0: ADC
4728    *** Failers
4729No match
4730    ABD
4731No match
4732    A-C
4733No match
4734
4735/a[^]b]c/i
4736    ADC
4737 0: ADC
4738
4739/ab|cd/i
4740    ABC
4741 0: AB
4742    ABCD
4743 0: AB
4744
4745/()ef/i
4746    DEF
4747 0: EF
4748 1:
4749
4750/$b/i
4751    *** Failers
4752No match
4753    A]C
4754No match
4755    B
4756No match
4757
4758/a\(b/i
4759    A(B
4760 0: A(B
4761
4762/a\(*b/i
4763    AB
4764 0: AB
4765    A((B
4766 0: A((B
4767
4768/a\\b/i
4769    A\B
4770No match
4771
4772/((a))/i
4773    ABC
4774 0: A
4775 1: A
4776 2: A
4777
4778/(a)b(c)/i
4779    ABC
4780 0: ABC
4781 1: A
4782 2: C
4783
4784/a+b+c/i
4785    AABBABC
4786 0: ABC
4787
4788/a{1,}b{1,}c/i
4789    AABBABC
4790 0: ABC
4791
4792/a.+?c/i
4793    ABCABC
4794 0: ABC
4795
4796/a.*?c/i
4797    ABCABC
4798 0: ABC
4799
4800/a.{0,5}?c/i
4801    ABCABC
4802 0: ABC
4803
4804/(a+|b)*/i
4805    AB
4806 0: AB
4807 1: B
4808
4809/(a+|b){0,}/i
4810    AB
4811 0: AB
4812 1: B
4813
4814/(a+|b)+/i
4815    AB
4816 0: AB
4817 1: B
4818
4819/(a+|b){1,}/i
4820    AB
4821 0: AB
4822 1: B
4823
4824/(a+|b)?/i
4825    AB
4826 0: A
4827 1: A
4828
4829/(a+|b){0,1}/i
4830    AB
4831 0: A
4832 1: A
4833
4834/(a+|b){0,1}?/i
4835    AB
4836 0:
4837
4838/[^ab]*/i
4839    CDE
4840 0: CDE
4841
4842/abc/i
4843
4844/a*/i
4845
4846
4847/([abc])*d/i
4848    ABBBCD
4849 0: ABBBCD
4850 1: C
4851
4852/([abc])*bcd/i
4853    ABCD
4854 0: ABCD
4855 1: A
4856
4857/a|b|c|d|e/i
4858    E
4859 0: E
4860
4861/(a|b|c|d|e)f/i
4862    EF
4863 0: EF
4864 1: E
4865
4866/abcd*efg/i
4867    ABCDEFG
4868 0: ABCDEFG
4869
4870/ab*/i
4871    XABYABBBZ
4872 0: AB
4873    XAYABBBZ
4874 0: A
4875
4876/(ab|cd)e/i
4877    ABCDE
4878 0: CDE
4879 1: CD
4880
4881/[abhgefdc]ij/i
4882    HIJ
4883 0: HIJ
4884
4885/^(ab|cd)e/i
4886    ABCDE
4887No match
4888
4889/(abc|)ef/i
4890    ABCDEF
4891 0: EF
4892 1:
4893
4894/(a|b)c*d/i
4895    ABCD
4896 0: BCD
4897 1: B
4898
4899/(ab|ab*)bc/i
4900    ABC
4901 0: ABC
4902 1: A
4903
4904/a([bc]*)c*/i
4905    ABC
4906 0: ABC
4907 1: BC
4908
4909/a([bc]*)(c*d)/i
4910    ABCD
4911 0: ABCD
4912 1: BC
4913 2: D
4914
4915/a([bc]+)(c*d)/i
4916    ABCD
4917 0: ABCD
4918 1: BC
4919 2: D
4920
4921/a([bc]*)(c+d)/i
4922    ABCD
4923 0: ABCD
4924 1: B
4925 2: CD
4926
4927/a[bcd]*dcdcde/i
4928    ADCDCDE
4929 0: ADCDCDE
4930
4931/a[bcd]+dcdcde/i
4932
4933/(ab|a)b*c/i
4934    ABC
4935 0: ABC
4936 1: AB
4937
4938/((a)(b)c)(d)/i
4939    ABCD
4940 0: ABCD
4941 1: ABC
4942 2: A
4943 3: B
4944 4: D
4945
4946/[a-zA-Z_][a-zA-Z0-9_]*/i
4947    ALPHA
4948 0: ALPHA
4949
4950/^a(bc+|b[eh])g|.h$/i
4951    ABH
4952 0: BH
4953
4954/(bc+d$|ef*g.|h?i(j|k))/i
4955    EFFGZ
4956 0: EFFGZ
4957 1: EFFGZ
4958    IJ
4959 0: IJ
4960 1: IJ
4961 2: J
4962    REFFGZ
4963 0: EFFGZ
4964 1: EFFGZ
4965    *** Failers
4966No match
4967    ADCDCDE
4968No match
4969    EFFG
4970No match
4971    BCDD
4972No match
4973
4974/((((((((((a))))))))))/i
4975    A
4976 0: A
4977 1: A
4978 2: A
4979 3: A
4980 4: A
4981 5: A
4982 6: A
4983 7: A
4984 8: A
4985 9: A
498610: A
4987
4988/((((((((((a))))))))))\10/i
4989    AA
4990 0: AA
4991 1: A
4992 2: A
4993 3: A
4994 4: A
4995 5: A
4996 6: A
4997 7: A
4998 8: A
4999 9: A
500010: A
5001
5002/(((((((((a)))))))))/i
5003    A
5004 0: A
5005 1: A
5006 2: A
5007 3: A
5008 4: A
5009 5: A
5010 6: A
5011 7: A
5012 8: A
5013 9: A
5014
5015/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
5016    A
5017 0: A
5018 1: A
5019
5020/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
5021    C
5022 0: C
5023 1: C
5024
5025/multiple words of text/i
5026    *** Failers
5027No match
5028    AA
5029No match
5030    UH-UH
5031No match
5032
5033/multiple words/i
5034    MULTIPLE WORDS, YEAH
5035 0: MULTIPLE WORDS
5036
5037/(.*)c(.*)/i
5038    ABCDE
5039 0: ABCDE
5040 1: AB
5041 2: DE
5042
5043/\((.*), (.*)\)/i
5044    (A, B)
5045 0: (A, B)
5046 1: A
5047 2: B
5048
5049/[k]/i
5050
5051/abcd/i
5052    ABCD
5053 0: ABCD
5054
5055/a(bc)d/i
5056    ABCD
5057 0: ABCD
5058 1: BC
5059
5060/a[-]?c/i
5061    AC
5062 0: AC
5063
5064/(abc)\1/i
5065    ABCABC
5066 0: ABCABC
5067 1: ABC
5068
5069/([a-c]*)\1/i
5070    ABCABC
5071 0: ABCABC
5072 1: ABC
5073
5074/a(?!b)./
5075    abad
5076 0: ad
5077
5078/a(?=d)./
5079    abad
5080 0: ad
5081
5082/a(?=c|d)./
5083    abad
5084 0: ad
5085
5086/a(?:b|c|d)(.)/
5087    ace
5088 0: ace
5089 1: e
5090
5091/a(?:b|c|d)*(.)/
5092    ace
5093 0: ace
5094 1: e
5095
5096/a(?:b|c|d)+?(.)/
5097    ace
5098 0: ace
5099 1: e
5100    acdbcdbe
5101 0: acd
5102 1: d
5103
5104/a(?:b|c|d)+(.)/
5105    acdbcdbe
5106 0: acdbcdbe
5107 1: e
5108
5109/a(?:b|c|d){2}(.)/
5110    acdbcdbe
5111 0: acdb
5112 1: b
5113
5114/a(?:b|c|d){4,5}(.)/
5115    acdbcdbe
5116 0: acdbcdb
5117 1: b
5118
5119/a(?:b|c|d){4,5}?(.)/
5120    acdbcdbe
5121 0: acdbcd
5122 1: d
5123
5124/((foo)|(bar))*/
5125    foobar
5126 0: foobar
5127 1: bar
5128 2: foo
5129 3: bar
5130
5131/a(?:b|c|d){6,7}(.)/
5132    acdbcdbe
5133 0: acdbcdbe
5134 1: e
5135
5136/a(?:b|c|d){6,7}?(.)/
5137    acdbcdbe
5138 0: acdbcdbe
5139 1: e
5140
5141/a(?:b|c|d){5,6}(.)/
5142    acdbcdbe
5143 0: acdbcdbe
5144 1: e
5145
5146/a(?:b|c|d){5,6}?(.)/
5147    acdbcdbe
5148 0: acdbcdb
5149 1: b
5150
5151/a(?:b|c|d){5,7}(.)/
5152    acdbcdbe
5153 0: acdbcdbe
5154 1: e
5155
5156/a(?:b|c|d){5,7}?(.)/
5157    acdbcdbe
5158 0: acdbcdb
5159 1: b
5160
5161/a(?:b|(c|e){1,2}?|d)+?(.)/
5162    ace
5163 0: ace
5164 1: c
5165 2: e
5166
5167/^(.+)?B/
5168    AB
5169 0: AB
5170 1: A
5171
5172/^([^a-z])|(\^)$/
5173    .
5174 0: .
5175 1: .
5176
5177/^[<>]&/
5178    <&OUT
5179 0: <&
5180
5181/^(a\1?){4}$/
5182    aaaaaaaaaa
5183 0: aaaaaaaaaa
5184 1: aaaa
5185    *** Failers
5186No match
5187    AB
5188No match
5189    aaaaaaaaa
5190No match
5191    aaaaaaaaaaa
5192No match
5193
5194/^(a(?(1)\1)){4}$/
5195    aaaaaaaaaa
5196 0: aaaaaaaaaa
5197 1: aaaa
5198    *** Failers
5199No match
5200    aaaaaaaaa
5201No match
5202    aaaaaaaaaaa
5203No match
5204
5205/(?:(f)(o)(o)|(b)(a)(r))*/
5206    foobar
5207 0: foobar
5208 1: f
5209 2: o
5210 3: o
5211 4: b
5212 5: a
5213 6: r
5214
5215/(?<=a)b/
5216    ab
5217 0: b
5218    *** Failers
5219No match
5220    cb
5221No match
5222    b
5223No match
5224
5225/(?<!c)b/
5226    ab
5227 0: b
5228    b
5229 0: b
5230    b
5231 0: b
5232
5233/(?:..)*a/
5234    aba
5235 0: aba
5236
5237/(?:..)*?a/
5238    aba
5239 0: a
5240
5241/^(?:b|a(?=(.)))*\1/
5242    abc
5243 0: ab
5244 1: b
5245
5246/^(){3,5}/
5247    abc
5248 0:
5249 1:
5250
5251/^(a+)*ax/
5252    aax
5253 0: aax
5254 1: a
5255
5256/^((a|b)+)*ax/
5257    aax
5258 0: aax
5259 1: a
5260 2: a
5261
5262/^((a|bc)+)*ax/
5263    aax
5264 0: aax
5265 1: a
5266 2: a
5267
5268/(a|x)*ab/
5269    cab
5270 0: ab
5271
5272/(a)*ab/
5273    cab
5274 0: ab
5275
5276/(?:(?i)a)b/
5277    ab
5278 0: ab
5279
5280/((?i)a)b/
5281    ab
5282 0: ab
5283 1: a
5284
5285/(?:(?i)a)b/
5286    Ab
5287 0: Ab
5288
5289/((?i)a)b/
5290    Ab
5291 0: Ab
5292 1: A
5293
5294/(?:(?i)a)b/
5295    *** Failers
5296No match
5297    cb
5298No match
5299    aB
5300No match
5301
5302/((?i)a)b/
5303
5304/(?i:a)b/
5305    ab
5306 0: ab
5307
5308/((?i:a))b/
5309    ab
5310 0: ab
5311 1: a
5312
5313/(?i:a)b/
5314    Ab
5315 0: Ab
5316
5317/((?i:a))b/
5318    Ab
5319 0: Ab
5320 1: A
5321
5322/(?i:a)b/
5323    *** Failers
5324No match
5325    aB
5326No match
5327    aB
5328No match
5329
5330/((?i:a))b/
5331
5332/(?:(?-i)a)b/i
5333    ab
5334 0: ab
5335
5336/((?-i)a)b/i
5337    ab
5338 0: ab
5339 1: a
5340
5341/(?:(?-i)a)b/i
5342    aB
5343 0: aB
5344
5345/((?-i)a)b/i
5346    aB
5347 0: aB
5348 1: a
5349
5350/(?:(?-i)a)b/i
5351    *** Failers
5352No match
5353    aB
5354 0: aB
5355    Ab
5356No match
5357
5358/((?-i)a)b/i
5359
5360/(?:(?-i)a)b/i
5361    aB
5362 0: aB
5363
5364/((?-i)a)b/i
5365    aB
5366 0: aB
5367 1: a
5368
5369/(?:(?-i)a)b/i
5370    *** Failers
5371No match
5372    Ab
5373No match
5374    AB
5375No match
5376
5377/((?-i)a)b/i
5378
5379/(?-i:a)b/i
5380    ab
5381 0: ab
5382
5383/((?-i:a))b/i
5384    ab
5385 0: ab
5386 1: a
5387
5388/(?-i:a)b/i
5389    aB
5390 0: aB
5391
5392/((?-i:a))b/i
5393    aB
5394 0: aB
5395 1: a
5396
5397/(?-i:a)b/i
5398    *** Failers
5399No match
5400    AB
5401No match
5402    Ab
5403No match
5404
5405/((?-i:a))b/i
5406
5407/(?-i:a)b/i
5408    aB
5409 0: aB
5410
5411/((?-i:a))b/i
5412    aB
5413 0: aB
5414 1: a
5415
5416/(?-i:a)b/i
5417    *** Failers
5418No match
5419    Ab
5420No match
5421    AB
5422No match
5423
5424/((?-i:a))b/i
5425
5426/((?-i:a.))b/i
5427    *** Failers
5428No match
5429    AB
5430No match
5431    a\nB
5432No match
5433
5434/((?s-i:a.))b/i
5435    a\nB
5436 0: a\x0aB
5437 1: a\x0a
5438
5439/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
5440    cabbbb
5441 0: cabbbb
5442
5443/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
5444    caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
5445 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
5446
5447/(ab)\d\1/i
5448    Ab4ab
5449 0: Ab4ab
5450 1: Ab
5451    ab4Ab
5452 0: ab4Ab
5453 1: ab
5454
5455/foo\w*\d{4}baz/
5456    foobar1234baz
5457 0: foobar1234baz
5458
5459/x(~~)*(?:(?:F)?)?/
5460    x~~
5461 0: x~~
5462 1: ~~
5463
5464/^a(?#xxx){3}c/
5465    aaac
5466 0: aaac
5467
5468/^a (?#xxx) (?#yyy) {3}c/x
5469    aaac
5470 0: aaac
5471
5472/(?<![cd])b/
5473    *** Failers
5474No match
5475    B\nB
5476No match
5477    dbcb
5478No match
5479
5480/(?<![cd])[ab]/
5481    dbaacb
5482 0: a
5483
5484/(?<!(c|d))b/
5485
5486/(?<!(c|d))[ab]/
5487    dbaacb
5488 0: a
5489
5490/(?<!cd)[ab]/
5491    cdaccb
5492 0: b
5493
5494/^(?:a?b?)*$/
5495    \
5496 0:
5497    a
5498 0: a
5499    ab
5500 0: ab
5501    aaa
5502 0: aaa
5503    *** Failers
5504No match
5505    dbcb
5506No match
5507    a--
5508No match
5509    aa--
5510No match
5511
5512/((?s)^a(.))((?m)^b$)/
5513    a\nb\nc\n
5514 0: a\x0ab
5515 1: a\x0a
5516 2: \x0a
5517 3: b
5518
5519/((?m)^b$)/
5520    a\nb\nc\n
5521 0: b
5522 1: b
5523
5524/(?m)^b/
5525    a\nb\n
5526 0: b
5527
5528/(?m)^(b)/
5529    a\nb\n
5530 0: b
5531 1: b
5532
5533/((?m)^b)/
5534    a\nb\n
5535 0: b
5536 1: b
5537
5538/\n((?m)^b)/
5539    a\nb\n
5540 0: \x0ab
5541 1: b
5542
5543/((?s).)c(?!.)/
5544    a\nb\nc\n
5545 0: \x0ac
5546 1: \x0a
5547    a\nb\nc\n
5548 0: \x0ac
5549 1: \x0a
5550
5551/((?s)b.)c(?!.)/
5552    a\nb\nc\n
5553 0: b\x0ac
5554 1: b\x0a
5555    a\nb\nc\n
5556 0: b\x0ac
5557 1: b\x0a
5558
5559/^b/
5560
5561/()^b/
5562    *** Failers
5563No match
5564    a\nb\nc\n
5565No match
5566    a\nb\nc\n
5567No match
5568
5569/((?m)^b)/
5570    a\nb\nc\n
5571 0: b
5572 1: b
5573
5574/(x)?(?(1)a|b)/
5575    *** Failers
5576No match
5577    a
5578No match
5579    a
5580No match
5581
5582/(x)?(?(1)b|a)/
5583    a
5584 0: a
5585
5586/()?(?(1)b|a)/
5587    a
5588 0: a
5589
5590/()(?(1)b|a)/
5591
5592/()?(?(1)a|b)/
5593    a
5594 0: a
5595 1:
5596
5597/^(\()?blah(?(1)(\)))$/
5598    (blah)
5599 0: (blah)
5600 1: (
5601 2: )
5602    blah
5603 0: blah
5604    *** Failers
5605No match
5606    a
5607No match
5608    blah)
5609No match
5610    (blah
5611No match
5612
5613/^(\(+)?blah(?(1)(\)))$/
5614    (blah)
5615 0: (blah)
5616 1: (
5617 2: )
5618    blah
5619 0: blah
5620    *** Failers
5621No match
5622    blah)
5623No match
5624    (blah
5625No match
5626
5627/(?(?!a)a|b)/
5628
5629/(?(?!a)b|a)/
5630    a
5631 0: a
5632
5633/(?(?=a)b|a)/
5634    *** Failers
5635No match
5636    a
5637No match
5638    a
5639No match
5640
5641/(?(?=a)a|b)/
5642    a
5643 0: a
5644
5645/(?=(a+?))(\1ab)/
5646    aaab
5647 0: aab
5648 1: a
5649 2: aab
5650
5651/^(?=(a+?))\1ab/
5652
5653/(\w+:)+/
5654    one:
5655 0: one:
5656 1: one:
5657
5658/$(?<=^(a))/
5659    a
5660 0:
5661 1: a
5662
5663/(?=(a+?))(\1ab)/
5664    aaab
5665 0: aab
5666 1: a
5667 2: aab
5668
5669/^(?=(a+?))\1ab/
5670    *** Failers
5671No match
5672    aaab
5673No match
5674    aaab
5675No match
5676
5677/([\w:]+::)?(\w+)$/
5678    abcd
5679 0: abcd
5680 1: <unset>
5681 2: abcd
5682    xy:z:::abcd
5683 0: xy:z:::abcd
5684 1: xy:z:::
5685 2: abcd
5686
5687/^[^bcd]*(c+)/
5688    aexycd
5689 0: aexyc
5690 1: c
5691
5692/(a*)b+/
5693    caab
5694 0: aab
5695 1: aa
5696
5697/([\w:]+::)?(\w+)$/
5698    abcd
5699 0: abcd
5700 1: <unset>
5701 2: abcd
5702    xy:z:::abcd
5703 0: xy:z:::abcd
5704 1: xy:z:::
5705 2: abcd
5706    *** Failers
5707 0: Failers
5708 1: <unset>
5709 2: Failers
5710    abcd:
5711No match
5712    abcd:
5713No match
5714
5715/^[^bcd]*(c+)/
5716    aexycd
5717 0: aexyc
5718 1: c
5719
5720/(>a+)ab/
5721
5722/(?>a+)b/
5723    aaab
5724 0: aaab
5725
5726/([[:]+)/
5727    a:[b]:
5728 0: :[
5729 1: :[
5730
5731/([[=]+)/
5732    a=[b]=
5733 0: =[
5734 1: =[
5735
5736/([[.]+)/
5737    a.[b].
5738 0: .[
5739 1: .[
5740
5741/((?>a+)b)/
5742    aaab
5743 0: aaab
5744 1: aaab
5745
5746/(?>(a+))b/
5747    aaab
5748 0: aaab
5749 1: aaa
5750
5751/((?>[^()]+)|\([^()]*\))+/
5752    ((abc(ade)ufh()()x
5753 0: abc(ade)ufh()()x
5754 1: x
5755
5756/a\Z/
5757    *** Failers
5758No match
5759    aaab
5760No match
5761    a\nb\n
5762No match
5763
5764/b\Z/
5765    a\nb\n
5766 0: b
5767
5768/b\z/
5769
5770/b\Z/
5771    a\nb
5772 0: b
5773
5774/b\z/
5775    a\nb
5776 0: b
5777    *** Failers
5778No match
5779
5780/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
5781    a
5782 0: a
5783 1:
5784    abc
5785 0: abc
5786 1:
5787    a-b
5788 0: a-b
5789 1:
5790    0-9
5791 0: 0-9
5792 1:
5793    a.b
5794 0: a.b
5795 1:
5796    5.6.7
5797 0: 5.6.7
5798 1:
5799    the.quick.brown.fox
5800 0: the.quick.brown.fox
5801 1:
5802    a100.b200.300c
5803 0: a100.b200.300c
5804 1:
5805    12-ab.1245
5806 0: 12-ab.1245
5807 1:
5808    *** Failers
5809No match
5810    \
5811No match
5812    .a
5813No match
5814    -a
5815No match
5816    a-
5817No match
5818    a.
5819No match
5820    a_b
5821No match
5822    a.-
5823No match
5824    a..
5825No match
5826    ab..bc
5827No match
5828    the.quick.brown.fox-
5829No match
5830    the.quick.brown.fox.
5831No match
5832    the.quick.brown.fox_
5833No match
5834    the.quick.brown.fox+
5835No match
5836
5837/(?>.*)(?<=(abcd|wxyz))/
5838    alphabetabcd
5839 0: alphabetabcd
5840 1: abcd
5841    endingwxyz
5842 0: endingwxyz
5843 1: wxyz
5844    *** Failers
5845No match
5846    a rather long string that doesn't end with one of them
5847No match
5848
5849/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
5850    word cat dog elephant mussel cow horse canary baboon snake shark otherword
5851 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
5852    word cat dog elephant mussel cow horse canary baboon snake shark
5853No match
5854
5855/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
5856    word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
5857No match
5858
5859/(?<=\d{3}(?!999))foo/
5860    999foo
5861 0: foo
5862    123999foo
5863 0: foo
5864    *** Failers
5865No match
5866    123abcfoo
5867No match
5868
5869/(?<=(?!...999)\d{3})foo/
5870    999foo
5871 0: foo
5872    123999foo
5873 0: foo
5874    *** Failers
5875No match
5876    123abcfoo
5877No match
5878
5879/(?<=\d{3}(?!999)...)foo/
5880    123abcfoo
5881 0: foo
5882    123456foo
5883 0: foo
5884    *** Failers
5885No match
5886    123999foo
5887No match
5888
5889/(?<=\d{3}...)(?<!999)foo/
5890    123abcfoo
5891 0: foo
5892    123456foo
5893 0: foo
5894    *** Failers
5895No match
5896    123999foo
5897No match
5898
5899/<a[\s]+href[\s]*=[\s]*          # find <a href=
5900 ([\"\'])?                       # find single or double quote
5901 (?(1) (.*?)\1 | ([^\s]+))       # if quote found, match up to next matching
5902                                 # quote, otherwise match up to next space
5903/isx
5904    <a href=abcd xyz
5905 0: <a href=abcd
5906 1: <unset>
5907 2: <unset>
5908 3: abcd
5909    <a href=\"abcd xyz pqr\" cats
5910 0: <a href="abcd xyz pqr"
5911 1: "
5912 2: abcd xyz pqr
5913    <a href=\'abcd xyz pqr\' cats
5914 0: <a href='abcd xyz pqr'
5915 1: '
5916 2: abcd xyz pqr
5917
5918/<a\s+href\s*=\s*                # find <a href=
5919 (["'])?                         # find single or double quote
5920 (?(1) (.*?)\1 | (\S+))          # if quote found, match up to next matching
5921                                 # quote, otherwise match up to next space
5922/isx
5923    <a href=abcd xyz
5924 0: <a href=abcd
5925 1: <unset>
5926 2: <unset>
5927 3: abcd
5928    <a href=\"abcd xyz pqr\" cats
5929 0: <a href="abcd xyz pqr"
5930 1: "
5931 2: abcd xyz pqr
5932    <a href       =       \'abcd xyz pqr\' cats
5933 0: <a href       =       'abcd xyz pqr'
5934 1: '
5935 2: abcd xyz pqr
5936
5937/<a\s+href(?>\s*)=(?>\s*)        # find <a href=
5938 (["'])?                         # find single or double quote
5939 (?(1) (.*?)\1 | (\S+))          # if quote found, match up to next matching
5940                                 # quote, otherwise match up to next space
5941/isx
5942    <a href=abcd xyz
5943 0: <a href=abcd
5944 1: <unset>
5945 2: <unset>
5946 3: abcd
5947    <a href=\"abcd xyz pqr\" cats
5948 0: <a href="abcd xyz pqr"
5949 1: "
5950 2: abcd xyz pqr
5951    <a href       =       \'abcd xyz pqr\' cats
5952 0: <a href       =       'abcd xyz pqr'
5953 1: '
5954 2: abcd xyz pqr
5955
5956/((Z)+|A)*/
5957    ZABCDEFG
5958 0: ZA
5959 1: A
5960 2: Z
5961
5962/(Z()|A)*/
5963    ZABCDEFG
5964 0: ZA
5965 1: A
5966 2:
5967
5968/(Z(())|A)*/
5969    ZABCDEFG
5970 0: ZA
5971 1: A
5972 2:
5973 3:
5974
5975/((?>Z)+|A)*/
5976    ZABCDEFG
5977 0: ZA
5978 1: A
5979
5980/((?>)+|A)*/
5981    ZABCDEFG
5982 0:
5983 1:
5984
5985/a*/g
5986    abbab
5987 0: a
5988 0:
5989 0:
5990 0: a
5991 0:
5992 0:
5993
5994/^[\d-a]/
5995    abcde
5996 0: a
5997    -things
5998 0: -
5999    0digit
6000 0: 0
6001    *** Failers
6002No match
6003    bcdef
6004No match
6005
6006/[[:space:]]+/
6007    > \x09\x0a\x0c\x0d\x0b<
6008 0:  \x09\x0a\x0c\x0d\x0b
6009
6010/[[:blank:]]+/
6011    > \x09\x0a\x0c\x0d\x0b<
6012 0:  \x09
6013
6014/[\s]+/
6015    > \x09\x0a\x0c\x0d\x0b<
6016 0:  \x09\x0a\x0c\x0d\x0b
6017
6018/\s+/
6019    > \x09\x0a\x0c\x0d\x0b<
6020 0:  \x09\x0a\x0c\x0d\x0b
6021
6022/ab/x
6023    ab
6024 0: ab
6025
6026/(?!\A)x/m
6027  a\nxb\n
6028 0: x
6029
6030/(?!^)x/m
6031  a\nxb\n
6032No match
6033
6034/abc\Qabc\Eabc/
6035    abcabcabc
6036 0: abcabcabc
6037
6038/abc\Q(*+|\Eabc/
6039    abc(*+|abc
6040 0: abc(*+|abc
6041
6042/   abc\Q abc\Eabc/x
6043    abc abcabc
6044 0: abc abcabc
6045    *** Failers
6046No match
6047    abcabcabc
6048No match
6049
6050/abc#comment
6051    \Q#not comment
6052    literal\E/x
6053    abc#not comment\n    literal
6054 0: abc#not comment\x0a    literal
6055
6056/abc#comment
6057    \Q#not comment
6058    literal/x
6059    abc#not comment\n    literal
6060 0: abc#not comment\x0a    literal
6061
6062/abc#comment
6063    \Q#not comment
6064    literal\E #more comment
6065    /x
6066    abc#not comment\n    literal
6067 0: abc#not comment\x0a    literal
6068
6069/abc#comment
6070    \Q#not comment
6071    literal\E #more comment/x
6072    abc#not comment\n    literal
6073 0: abc#not comment\x0a    literal
6074
6075/\Qabc\$xyz\E/
6076    abc\\\$xyz
6077 0: abc\$xyz
6078
6079/\Qabc\E\$\Qxyz\E/
6080    abc\$xyz
6081 0: abc$xyz
6082
6083/\Gabc/
6084    abc
6085 0: abc
6086    *** Failers
6087No match
6088    xyzabc
6089No match
6090
6091/\Gabc./g
6092    abc1abc2xyzabc3
6093 0: abc1
6094 0: abc2
6095
6096/abc./g
6097    abc1abc2xyzabc3
6098 0: abc1
6099 0: abc2
6100 0: abc3
6101
6102/a(?x: b c )d/
6103    XabcdY
6104 0: abcd
6105    *** Failers
6106No match
6107    Xa b c d Y
6108No match
6109
6110/((?x)x y z | a b c)/
6111    XabcY
6112 0: abc
6113 1: abc
6114    AxyzB
6115 0: xyz
6116 1: xyz
6117
6118/(?i)AB(?-i)C/
6119    XabCY
6120 0: abC
6121    *** Failers
6122No match
6123    XabcY
6124No match
6125
6126/((?i)AB(?-i)C|D)E/
6127    abCE
6128 0: abCE
6129 1: abC
6130    DE
6131 0: DE
6132 1: D
6133    *** Failers
6134No match
6135    abcE
6136No match
6137    abCe
6138No match
6139    dE
6140No match
6141    De
6142No match
6143
6144/(.*)\d+\1/
6145    abc123abc
6146 0: abc123abc
6147 1: abc
6148    abc123bc
6149 0: bc123bc
6150 1: bc
6151
6152/(.*)\d+\1/s
6153    abc123abc
6154 0: abc123abc
6155 1: abc
6156    abc123bc
6157 0: bc123bc
6158 1: bc
6159
6160/((.*))\d+\1/
6161    abc123abc
6162 0: abc123abc
6163 1: abc
6164 2: abc
6165    abc123bc
6166 0: bc123bc
6167 1: bc
6168 2: bc
6169
6170/-- This tests for an IPv6 address in the form where it can have up to
6171    eight components, one and only one of which is empty. This must be
6172    an internal component. --/
6173
6174/^(?!:)                       # colon disallowed at start
6175  (?:                         # start of item
6176    (?: [0-9a-f]{1,4} |       # 1-4 hex digits or
6177    (?(1)0 | () ) )           # if null previously matched, fail; else null
6178    :                         # followed by colon
6179  ){1,7}                      # end item; 1-7 of them required
6180  [0-9a-f]{1,4} $             # final hex number at end of string
6181  (?(1)|.)                    # check that there was an empty component
6182  /xi
6183    a123::a123
6184 0: a123::a123
6185 1:
6186    a123:b342::abcd
6187 0: a123:b342::abcd
6188 1:
6189    a123:b342::324e:abcd
6190 0: a123:b342::324e:abcd
6191 1:
6192    a123:ddde:b342::324e:abcd
6193 0: a123:ddde:b342::324e:abcd
6194 1:
6195    a123:ddde:b342::324e:dcba:abcd
6196 0: a123:ddde:b342::324e:dcba:abcd
6197 1:
6198    a123:ddde:9999:b342::324e:dcba:abcd
6199 0: a123:ddde:9999:b342::324e:dcba:abcd
6200 1:
6201    *** Failers
6202No match
6203    1:2:3:4:5:6:7:8
6204No match
6205    a123:bce:ddde:9999:b342::324e:dcba:abcd
6206No match
6207    a123::9999:b342::324e:dcba:abcd
6208No match
6209    abcde:2:3:4:5:6:7:8
6210No match
6211    ::1
6212No match
6213    abcd:fee0:123::
6214No match
6215    :1
6216No match
6217    1:
6218No match
6219
6220/[z\Qa-d]\E]/
6221    z
6222 0: z
6223    a
6224 0: a
6225    -
6226 0: -
6227    d
6228 0: d
6229    ]
6230 0: ]
6231    *** Failers
6232 0: a
6233    b
6234No match
6235
6236/[\z\C]/
6237    z
6238 0: z
6239    C
6240 0: C
6241
6242/\M/
6243    M
6244 0: M
6245
6246/(a+)*b/
6247    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6248No match
6249
6250/(?i)reg(?:ul(?:[a�]|ae)r|ex)/
6251    REGular
6252 0: REGular
6253    regulaer
6254 0: regulaer
6255    Regex
6256 0: Regex
6257    regul�r
6258 0: regul\xe4r
6259
6260/����[�-��-�]+/
6261    �����
6262 0: \xc5\xe6\xe5\xe4\xe0
6263    �����
6264 0: \xc5\xe6\xe5\xe4\xff
6265    �����
6266 0: \xc5\xe6\xe5\xe4\xc0
6267    �����
6268 0: \xc5\xe6\xe5\xe4\xdf
6269
6270/(?<=Z)X./
6271  \x84XAZXB
6272 0: XB
6273
6274/ab cd (?x) de fg/
6275    ab cd defg
6276 0: ab cd defg
6277
6278/ab cd(?x) de fg/
6279    ab cddefg
6280 0: ab cddefg
6281    ** Failers
6282No match
6283    abcddefg
6284No match
6285
6286/(?<![^f]oo)(bar)/
6287    foobarX
6288 0: bar
6289 1: bar
6290    ** Failers
6291No match
6292    boobarX
6293No match
6294
6295/(?<![^f])X/
6296    offX
6297 0: X
6298    ** Failers
6299No match
6300    onyX
6301No match
6302
6303/(?<=[^f])X/
6304    onyX
6305 0: X
6306    ** Failers
6307No match
6308    offX
6309No match
6310
6311/^/mg
6312    a\nb\nc\n
6313 0:
6314 0:
6315 0:
6316    \
6317 0:
6318
6319/(?<=C\n)^/mg
6320    A\nC\nC\n
6321 0:
6322
6323/(?:(?(1)a|b)(X))+/
6324    bXaX
6325 0: bXaX
6326 1: X
6327
6328/(?:(?(1)\1a|b)(X|Y))+/
6329    bXXaYYaY
6330 0: bXXaYYaY
6331 1: Y
6332    bXYaXXaX
6333 0: bX
6334 1: X
6335
6336/()()()()()()()()()(?:(?(10)\10a|b)(X|Y))+/
6337    bXXaYYaY
6338 0: bX
6339 1:
6340 2:
6341 3:
6342 4:
6343 5:
6344 6:
6345 7:
6346 8:
6347 9:
634810: X
6349
6350/[[,abc,]+]/
6351    abc]
6352 0: abc]
6353    a,b]
6354 0: a,b]
6355    [a,b,c]
6356 0: [a,b,c]
6357
6358/(?-x: )/x
6359    A\x20B
6360 0:
6361
6362"(?x)(?-x: \s*#\s*)"
6363    A # B
6364 0:  #
6365    ** Failers
6366No match
6367    #
6368No match
6369
6370"(?x-is)(?:(?-ixs) \s*#\s*) include"
6371    A #include
6372 0:  #include
6373    ** Failers
6374No match
6375    A#include
6376No match
6377    A #Include
6378No match
6379
6380/a*b*\w/
6381    aaabbbb
6382 0: aaabbbb
6383    aaaa
6384 0: aaaa
6385    a
6386 0: a
6387
6388/a*b?\w/
6389    aaabbbb
6390 0: aaabb
6391    aaaa
6392 0: aaaa
6393    a
6394 0: a
6395
6396/a*b{0,4}\w/
6397    aaabbbb
6398 0: aaabbbb
6399    aaaa
6400 0: aaaa
6401    a
6402 0: a
6403
6404/a*b{0,}\w/
6405    aaabbbb
6406 0: aaabbbb
6407    aaaa
6408 0: aaaa
6409    a
6410 0: a
6411
6412/a*\d*\w/
6413    0a
6414 0: 0a
6415    a
6416 0: a
6417
6418/a*b *\w/x
6419    a
6420 0: a
6421
6422/a*b#comment
6423  *\w/x
6424    a
6425 0: a
6426
6427/a* b *\w/x
6428    a
6429 0: a
6430
6431/^\w+=.*(\\\n.*)*/
6432    abc=xyz\\\npqr
6433 0: abc=xyz\
6434
6435/(?=(\w+))\1:/
6436    abcd:
6437 0: abcd:
6438 1: abcd
6439
6440/^(?=(\w+))\1:/
6441    abcd:
6442 0: abcd:
6443 1: abcd
6444
6445/^\Eabc/
6446    abc
6447 0: abc
6448
6449/^[\Eabc]/
6450    a
6451 0: a
6452    ** Failers
6453No match
6454    E
6455No match
6456
6457/^[a-\Ec]/
6458    b
6459 0: b
6460    ** Failers
6461No match
6462    -
6463No match
6464    E
6465No match
6466
6467/^[a\E\E-\Ec]/
6468    b
6469 0: b
6470    ** Failers
6471No match
6472    -
6473No match
6474    E
6475No match
6476
6477/^[\E\Qa\E-\Qz\E]+/
6478    b
6479 0: b
6480    ** Failers
6481No match
6482    -
6483No match
6484
6485/^[a\Q]bc\E]/
6486    a
6487 0: a
6488    ]
6489 0: ]
6490    c
6491 0: c
6492
6493/^[a-\Q\E]/
6494    a
6495 0: a
6496    -
6497 0: -
6498
6499/^(a()*)*/
6500    aaaa
6501 0: aaaa
6502 1: a
6503 2:
6504
6505/^(?:a(?:(?:))*)*/
6506    aaaa
6507 0: aaaa
6508
6509/^(a()+)+/
6510    aaaa
6511 0: aaaa
6512 1: a
6513 2:
6514
6515/^(?:a(?:(?:))+)+/
6516    aaaa
6517 0: aaaa
6518
6519/(a){0,3}(?(1)b|(c|))*D/
6520    abbD
6521 0: abbD
6522 1: a
6523    ccccD
6524 0: ccccD
6525 1: <unset>
6526 2:
6527    D
6528 0: D
6529 1: <unset>
6530 2:
6531
6532/(a|)*\d/
6533  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6534No match
6535  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6536 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6537 1:
6538
6539/(?>a|)*\d/
6540  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6541No match
6542  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6543 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6544
6545/(?:a|)*\d/
6546  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6547No match
6548  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6549 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6550
6551/\Z/g
6552  abc\n
6553 0:
6554 0:
6555
6556/^(?s)(?>.*)(?<!\n)/
6557  abc
6558 0: abc
6559  abc\n
6560No match
6561
6562/^(?![^\n]*\n\z)/
6563  abc
6564 0:
6565  abc\n
6566No match
6567
6568/\z(?<!\n)/
6569  abc
6570 0:
6571  abc\n
6572No match
6573
6574/(.*(.)?)*/
6575    abcd
6576 0: abcd
6577 1:
6578
6579/( (A | (?(1)0|) )*   )/x
6580    abcd
6581 0:
6582 1:
6583 2:
6584
6585/( ( (?(1)0|) )*   )/x
6586    abcd
6587 0:
6588 1:
6589 2:
6590
6591/(  (?(1)0|)*   )/x
6592    abcd
6593 0:
6594 1:
6595
6596/[[:abcd:xyz]]/
6597    a]
6598 0: a]
6599    :]
6600 0: :]
6601
6602/[abc[:x\]pqr]/
6603    a
6604 0: a
6605    [
6606 0: [
6607    :
6608 0: :
6609    ]
6610 0: ]
6611    p
6612 0: p
6613
6614/.*[op][xyz]/
6615    fooabcfoo
6616No match
6617
6618/(?(?=.*b)b|^)/
6619   adc
6620 0:
6621   abc
6622 0: b
6623
6624/(?(?=^.*b)b|^)/
6625   adc
6626 0:
6627   abc
6628No match
6629
6630/(?(?=.*b)b|^)*/
6631   adc
6632 0:
6633   abc
6634 0:
6635
6636/(?(?=.*b)b|^)+/
6637   adc
6638 0:
6639   abc
6640 0: b
6641
6642/(?(?=b).*b|^d)/
6643    abc
6644 0: b
6645
6646/(?(?=.*b).*b|^d)/
6647    abc
6648 0: ab
6649
6650/^%((?(?=[a])[^%])|b)*%$/
6651    %ab%
6652 0: %ab%
6653 1:
6654
6655/(?i)a(?-i)b|c/
6656    XabX
6657 0: ab
6658    XAbX
6659 0: Ab
6660    CcC
6661 0: c
6662    ** Failers
6663No match
6664    XABX
6665No match
6666
6667/[\x00-\xff\s]+/
6668    \x0a\x0b\x0c\x0d
6669 0: \x0a\x0b\x0c\x0d
6670
6671/^\c/
6672    ?
6673 0: ?
6674
6675/(abc)\1/i
6676   abc
6677No match
6678
6679/(abc)\1/
6680   abc
6681No match
6682
6683/[^a]*/i
6684    12abc
6685 0: 12
6686    12ABC
6687 0: 12
6688
6689/[^a]*+/i
6690    12abc
6691 0: 12
6692    12ABC
6693 0: 12
6694
6695/[^a]*?X/i
6696    ** Failers
6697No match
6698    12abc
6699No match
6700    12ABC
6701No match
6702
6703/[^a]+?X/i
6704    ** Failers
6705No match
6706    12abc
6707No match
6708    12ABC
6709No match
6710
6711/[^a]?X/i
6712    12aXbcX
6713 0: X
6714    12AXBCX
6715 0: X
6716    BCX
6717 0: CX
6718
6719/[^a]??X/i
6720    12aXbcX
6721 0: X
6722    12AXBCX
6723 0: X
6724    BCX
6725 0: CX
6726
6727/[^a]?+X/i
6728    12aXbcX
6729 0: cX
6730    12AXBCX
6731 0: CX
6732    BCX
6733 0: CX
6734
6735/[^a]{2,3}/i
6736    abcdef
6737 0: bcd
6738    ABCDEF
6739 0: BCD
6740
6741/[^a]{2,3}?/i
6742    abcdef
6743 0: bc
6744    ABCDEF
6745 0: BC
6746
6747/[^a]{2,3}+/i
6748    abcdef
6749 0: bcd
6750    ABCDEF
6751 0: BCD
6752
6753/((a|)+)+Z/
6754    Z
6755 0: Z
6756 1:
6757 2:
6758
6759/(a)b|(a)c/
6760    ac
6761 0: ac
6762 1: <unset>
6763 2: a
6764
6765/(?>(a))b|(a)c/
6766    ac
6767 0: ac
6768 1: <unset>
6769 2: a
6770
6771/(?=(a))ab|(a)c/
6772    ac
6773 0: ac
6774 1: <unset>
6775 2: a
6776
6777/((?>(a))b|(a)c)/
6778    ac
6779 0: ac
6780 1: ac
6781 2: <unset>
6782 3: a
6783
6784/((?>(a))b|(a)c)++/
6785    ac
6786 0: ac
6787 1: ac
6788 2: <unset>
6789 3: a
6790
6791/(?:(?>(a))b|(a)c)++/
6792    ac
6793 0: ac
6794 1: <unset>
6795 2: a
6796
6797/(?=(?>(a))b|(a)c)(..)/
6798    ac
6799 0: ac
6800 1: <unset>
6801 2: a
6802 3: ac
6803
6804/(?>(?>(a))b|(a)c)/
6805    ac
6806 0: ac
6807 1: <unset>
6808 2: a
6809
6810/(?:(?>([ab])))+a=/+
6811    =ba=
6812 0: ba=
6813 0+
6814 1: b
6815
6816/(?>([ab]))+a=/+
6817    =ba=
6818 0: ba=
6819 0+
6820 1: b
6821
6822/((?>(a+)b)+(aabab))/
6823    aaaabaaabaabab
6824 0: aaaabaaabaabab
6825 1: aaaabaaabaabab
6826 2: aaa
6827 3: aabab
6828
6829/(?>a+|ab)+?c/
6830    aabc
6831No match
6832
6833/(?>a+|ab)+c/
6834    aabc
6835No match
6836
6837/(?:a+|ab)+c/
6838    aabc
6839 0: aabc
6840
6841/(?(?=(a))a)/
6842    a
6843 0: a
6844 1: a
6845
6846/(?(?=(a))a)(b)/
6847    ab
6848 0: ab
6849 1: a
6850 2: b
6851
6852/^(?:a|ab)++c/
6853    aaaabc
6854No match
6855
6856/^(?>a|ab)++c/
6857    aaaabc
6858No match
6859
6860/^(?:a|ab)+c/
6861    aaaabc
6862 0: aaaabc
6863
6864/(?=abc){3}abc/+
6865    abcabcabc
6866 0: abc
6867 0+ abcabc
6868    ** Failers
6869No match
6870    xyz
6871No match
6872
6873/(?=abc)+abc/+
6874    abcabcabc
6875 0: abc
6876 0+ abcabc
6877    ** Failers
6878No match
6879    xyz
6880No match
6881
6882/(?=abc)++abc/+
6883    abcabcabc
6884 0: abc
6885 0+ abcabc
6886    ** Failers
6887No match
6888    xyz
6889No match
6890
6891/(?=abc){0}xyz/
6892    xyz
6893 0: xyz
6894
6895/(?=abc){1}xyz/
6896    ** Failers
6897No match
6898    xyz
6899No match
6900
6901/(?=(a))?./
6902    ab
6903 0: a
6904 1: a
6905    bc
6906 0: b
6907
6908/(?=(a))??./
6909    ab
6910 0: a
6911    bc
6912 0: b
6913
6914/^(?=(?1))?[az]([abc])d/
6915    abd
6916 0: abd
6917 1: b
6918    zcdxx
6919 0: zcd
6920 1: c
6921
6922/^(?!a){0}\w+/
6923    aaaaa
6924 0: aaaaa
6925
6926/(?<=(abc))?xyz/
6927    abcxyz
6928 0: xyz
6929 1: abc
6930    pqrxyz
6931 0: xyz
6932
6933/^[\g<a>]+/
6934    ggg<<<aaa>>>
6935 0: ggg<<<aaa>>>
6936    ** Failers
6937No match
6938    \\ga
6939No match
6940
6941/^[\ga]+/
6942    gggagagaxyz
6943 0: gggagaga
6944
6945/^[:a[:digit:]]+/
6946    aaaa444:::Z
6947 0: aaaa444:::
6948
6949/^[:a[:digit:]:b]+/
6950    aaaa444:::bbbZ
6951 0: aaaa444:::bbb
6952
6953/[:a]xxx[b:]/
6954     :xxx:
6955 0: :xxx:
6956
6957/(?<=a{2})b/i
6958    xaabc
6959 0: b
6960    ** Failers
6961No match
6962    xabc
6963No match
6964
6965/(?<!a{2})b/i
6966    xabc
6967 0: b
6968    ** Failers
6969No match
6970    xaabc
6971No match
6972
6973/(?<=a\h)c/
6974    xa c
6975 0: c
6976
6977/(?<=[^a]{2})b/
6978    axxbc
6979 0: b
6980    aAAbc
6981 0: b
6982    ** Failers
6983No match
6984    xaabc
6985No match
6986
6987/(?<=[^a]{2})b/i
6988    axxbc
6989 0: b
6990    ** Failers
6991No match
6992    aAAbc
6993No match
6994    xaabc
6995No match
6996
6997/(?<=a\H)c/
6998    abc
6999 0: c
7000
7001/(?<=a\V)c/
7002    abc
7003 0: c
7004
7005/(?<=a\v)c/
7006    a\nc
7007 0: c
7008
7009/(?(?=c)c|d)++Y/
7010    XcccddYX
7011 0: cccddY
7012
7013/(?(?=c)c|d)*+Y/
7014    XcccddYX
7015 0: cccddY
7016
7017/^(a{2,3}){2,}+a/
7018    aaaaaaa
7019 0: aaaaaaa
7020 1: aaa
7021    ** Failers
7022No match
7023    aaaaaa
7024No match
7025    aaaaaaaaa
7026No match
7027
7028/^(a{2,3})++a/
7029    ** Failers
7030No match
7031    aaaaaa
7032No match
7033
7034/^(a{2,3})*+a/
7035    ** Failers
7036No match
7037    aaaaaa
7038No match
7039
7040/ab\Cde/
7041    abXde
7042 0: abXde
7043
7044/(?<=ab\Cde)X/
7045    abZdeX
7046 0: X
7047
7048/a[\CD]b/
7049    aCb
7050 0: aCb
7051    aDb
7052 0: aDb
7053
7054/a[\C-X]b/
7055    aJb
7056 0: aJb
7057
7058/\H\h\V\v/
7059    X X\x0a
7060 0: X X\x0a
7061    X\x09X\x0b
7062 0: X\x09X\x0b
7063    ** Failers
7064No match
7065    \xa0 X\x0a
7066No match
7067
7068/\H*\h+\V?\v{3,4}/
7069    \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
7070 0: \x09 \xa0X\x0a\x0b\x0c\x0d
7071    \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
7072 0: \x09 \xa0\x0a\x0b\x0c\x0d
7073    \x09\x20\xa0\x0a\x0b\x0c
7074 0: \x09 \xa0\x0a\x0b\x0c
7075    ** Failers
7076No match
7077    \x09\x20\xa0\x0a\x0b
7078No match
7079
7080/\H{3,4}/
7081    XY  ABCDE
7082 0: ABCD
7083    XY  PQR ST
7084 0: PQR
7085
7086/.\h{3,4}./
7087    XY  AB    PQRS
7088 0: B    P
7089
7090/\h*X\h?\H+Y\H?Z/
7091    >XNNNYZ
7092 0: XNNNYZ
7093    >  X NYQZ
7094 0:   X NYQZ
7095    ** Failers
7096No match
7097    >XYZ
7098No match
7099    >  X NY Z
7100No match
7101
7102/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
7103    >XY\x0aZ\x0aA\x0bNN\x0c
7104 0: XY\x0aZ\x0aA\x0bNN\x0c
7105    >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
7106 0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
7107
7108/(foo)\Kbar/
7109    foobar
7110 0: bar
7111 1: foo
7112
7113/(foo)(\Kbar|baz)/
7114    foobar
7115 0: bar
7116 1: foo
7117 2: bar
7118    foobaz
7119 0: foobaz
7120 1: foo
7121 2: baz
7122
7123/(foo\Kbar)baz/
7124    foobarbaz
7125 0: barbaz
7126 1: foobar
7127
7128/abc\K|def\K/g+
7129    Xabcdefghi
7130 0:
7131 0+ defghi
7132 0:
7133 0+ ghi
7134
7135/ab\Kc|de\Kf/g+
7136    Xabcdefghi
7137 0: c
7138 0+ defghi
7139 0: f
7140 0+ ghi
7141
7142/(?=C)/g+
7143    ABCDECBA
7144 0:
7145 0+ CDECBA
7146 0:
7147 0+ CBA
7148
7149/^abc\K/+
7150    abcdef
7151 0:
7152 0+ def
7153    ** Failers
7154No match
7155    defabcxyz
7156No match
7157
7158/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
7159    ababababbbabZXXXX
7160 0: ababababbbabZ
7161 1: ab
7162 2: b
7163
7164/(?<A>tom|bon)-\g{A}/
7165    tom-tom
7166 0: tom-tom
7167 1: tom
7168    bon-bon
7169 0: bon-bon
7170 1: bon
7171
7172/(^(a|b\g{-1}))/
7173    bacxxx
7174No match
7175
7176/(?|(abc)|(xyz))\1/
7177    abcabc
7178 0: abcabc
7179 1: abc
7180    xyzxyz
7181 0: xyzxyz
7182 1: xyz
7183    ** Failers
7184No match
7185    abcxyz
7186No match
7187    xyzabc
7188No match
7189
7190/(?|(abc)|(xyz))(?1)/
7191    abcabc
7192 0: abcabc
7193 1: abc
7194    xyzabc
7195 0: xyzabc
7196 1: xyz
7197    ** Failers
7198No match
7199    xyzxyz
7200No match
7201
7202/^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/
7203    XYabcdY
7204 0: XYabcdY
7205 1: a
7206 2: b
7207 3: c
7208 4: d
7209 5: Y
7210
7211/^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/
7212    XYabcdY
7213 0: XYabcdY
7214 1: a
7215 2: b
7216 3: <unset>
7217 4: <unset>
7218 5: c
7219 6: d
7220 7: Y
7221
7222/^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/
7223    XYabcdY
7224 0: XYabcdY
7225 1: a
7226 2: b
7227 3: <unset>
7228 4: <unset>
7229 5: c
7230 6: d
7231 7: Y
7232
7233/(?'abc'\w+):\k<abc>{2}/
7234    a:aaxyz
7235 0: a:aa
7236 1: a
7237    ab:ababxyz
7238 0: ab:abab
7239 1: ab
7240    ** Failers
7241No match
7242    a:axyz
7243No match
7244    ab:abxyz
7245No match
7246
7247/(?'abc'\w+):\g{abc}{2}/
7248    a:aaxyz
7249 0: a:aa
7250 1: a
7251    ab:ababxyz
7252 0: ab:abab
7253 1: ab
7254    ** Failers
7255No match
7256    a:axyz
7257No match
7258    ab:abxyz
7259No match
7260
7261/^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
7262    abd
7263 0: abd
7264 1: a
7265    ce
7266 0: ce
7267
7268/^(a.)\g-1Z/
7269    aXaXZ
7270 0: aXaXZ
7271 1: aX
7272
7273/^(a.)\g{-1}Z/
7274    aXaXZ
7275 0: aXaXZ
7276 1: aX
7277
7278/^(?(DEFINE) (?<A> a) (?<B> b) )  (?&A) (?&B) /x
7279    abcd
7280 0: ab
7281
7282/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
7283  (?(DEFINE)
7284  (?<NAME_PAT>[a-z]+)
7285  (?<ADDRESS_PAT>\d+)
7286  )/x
7287    metcalfe 33
7288 0: metcalfe 33
7289 1: metcalfe
7290 2: 33
7291
7292/(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
7293    1.2.3.4
7294 0: 1.2.3.4
7295 1: <unset>
7296 2: .4
7297    131.111.10.206
7298 0: 131.111.10.206
7299 1: <unset>
7300 2: .206
7301    10.0.0.0
7302 0: 10.0.0.0
7303 1: <unset>
7304 2: .0
7305    ** Failers
7306No match
7307    10.6
7308No match
7309    455.3.4.5
7310No match
7311
7312/\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
7313    1.2.3.4
7314 0: 1.2.3.4
7315 1: .4
7316    131.111.10.206
7317 0: 131.111.10.206
7318 1: .206
7319    10.0.0.0
7320 0: 10.0.0.0
7321 1: .0
7322    ** Failers
7323No match
7324    10.6
7325No match
7326    455.3.4.5
7327No match
7328
7329/^(\w++|\s++)*$/
7330    now is the time for all good men to come to the aid of the party
7331 0: now is the time for all good men to come to the aid of the party
7332 1: party
7333    *** Failers
7334No match
7335    this is not a line with only words and spaces!
7336No match
7337
7338/(\d++)(\w)/
7339    12345a
7340 0: 12345a
7341 1: 12345
7342 2: a
7343    *** Failers
7344No match
7345    12345+
7346No match
7347
7348/a++b/
7349    aaab
7350 0: aaab
7351
7352/(a++b)/
7353    aaab
7354 0: aaab
7355 1: aaab
7356
7357/(a++)b/
7358    aaab
7359 0: aaab
7360 1: aaa
7361
7362/([^()]++|\([^()]*\))+/
7363    ((abc(ade)ufh()()x
7364 0: abc(ade)ufh()()x
7365 1: x
7366
7367/\(([^()]++|\([^()]+\))+\)/
7368    (abc)
7369 0: (abc)
7370 1: abc
7371    (abc(def)xyz)
7372 0: (abc(def)xyz)
7373 1: xyz
7374    *** Failers
7375No match
7376    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
7377No match
7378
7379/^([^()]|\((?1)*\))*$/
7380    abc
7381 0: abc
7382 1: c
7383    a(b)c
7384 0: a(b)c
7385 1: c
7386    a(b(c))d
7387 0: a(b(c))d
7388 1: d
7389    *** Failers)
7390No match
7391    a(b(c)d
7392No match
7393
7394/^>abc>([^()]|\((?1)*\))*<xyz<$/
7395   >abc>123<xyz<
7396 0: >abc>123<xyz<
7397 1: 3
7398   >abc>1(2)3<xyz<
7399 0: >abc>1(2)3<xyz<
7400 1: 3
7401   >abc>(1(2)3)<xyz<
7402 0: >abc>(1(2)3)<xyz<
7403 1: (1(2)3)
7404
7405/^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i
7406    1221
7407 0: 1221
7408 1: 1221
7409 2: 1
7410    Satanoscillatemymetallicsonatas
7411 0: Satanoscillatemymetallicsonatas
7412 1: <unset>
7413 2: <unset>
7414 3: Satanoscillatemymetallicsonatas
7415 4: S
7416    AmanaplanacanalPanama
7417 0: AmanaplanacanalPanama
7418 1: <unset>
7419 2: <unset>
7420 3: AmanaplanacanalPanama
7421 4: A
7422    AblewasIereIsawElba
7423 0: AblewasIereIsawElba
7424 1: <unset>
7425 2: <unset>
7426 3: AblewasIereIsawElba
7427 4: A
7428    *** Failers
7429No match
7430    Thequickbrownfox
7431No match
7432
7433/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
7434    12
7435 0: 12
7436 1: 12
7437    (((2+2)*-3)-7)
7438 0: (((2+2)*-3)-7)
7439 1: (((2+2)*-3)-7)
7440 2: -
7441    -12
7442 0: -12
7443 1: -12
7444    *** Failers
7445No match
7446    ((2+2)*-3)-7)
7447No match
7448
7449/^(x(y|(?1){2})z)/
7450    xyz
7451 0: xyz
7452 1: xyz
7453 2: y
7454    xxyzxyzz
7455 0: xxyzxyzz
7456 1: xxyzxyzz
7457 2: xyzxyz
7458    *** Failers
7459No match
7460    xxyzz
7461No match
7462    xxyzxyzxyzz
7463No match
7464
7465/((< (?: (?(R) \d++  | [^<>]*+) | (?2)) * >))/x
7466    <>
7467 0: <>
7468 1: <>
7469 2: <>
7470    <abcd>
7471 0: <abcd>
7472 1: <abcd>
7473 2: <abcd>
7474    <abc <123> hij>
7475 0: <abc <123> hij>
7476 1: <abc <123> hij>
7477 2: <abc <123> hij>
7478    <abc <def> hij>
7479 0: <def>
7480 1: <def>
7481 2: <def>
7482    <abc<>def>
7483 0: <abc<>def>
7484 1: <abc<>def>
7485 2: <abc<>def>
7486    <abc<>
7487 0: <>
7488 1: <>
7489 2: <>
7490    *** Failers
7491No match
7492    <abc
7493No match
7494
7495/^a+(*FAIL)/
7496    aaaaaa
7497No match
7498
7499/a+b?c+(*FAIL)/
7500    aaabccc
7501No match
7502
7503/a+b?(*PRUNE)c+(*FAIL)/
7504    aaabccc
7505No match
7506
7507/a+b?(*COMMIT)c+(*FAIL)/
7508    aaabccc
7509No match
7510
7511/a+b?(*SKIP)c+(*FAIL)/
7512    aaabcccaaabccc
7513No match
7514
7515/^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
7516    aaaxxxxxx
7517 0: aaaxxxxxx
7518    aaa++++++
7519 0: aaa
7520    bbbxxxxx
7521 0: bbbxxxxx
7522    bbb+++++
7523 0: bbb
7524    cccxxxx
7525 0: cccxxxx
7526    ccc++++
7527 0: ccc
7528    dddddddd
7529 0: ddd
7530
7531/^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
7532    aaaxxxxxx
7533 0: aaaxxxxxx
7534 1: aaaxxxxxx
7535    aaa++++++
7536 0: aaa
7537 1: aaa
7538    bbbxxxxx
7539 0: bbbxxxxx
7540 1: bbbxxxxx
7541    bbb+++++
7542 0: bbb
7543 1: bbb
7544    cccxxxx
7545 0: cccxxxx
7546 1: cccxxxx
7547    ccc++++
7548 0: ccc
7549 1: ccc
7550    dddddddd
7551 0: ddd
7552 1: ddd
7553
7554/a+b?(*THEN)c+(*FAIL)/
7555    aaabccc
7556No match
7557
7558/(A (A|B(*ACCEPT)|C) D)(E)/x
7559    AB
7560 0: AB
7561 1: AB
7562 2: B
7563    ABX
7564 0: AB
7565 1: AB
7566 2: B
7567    AADE
7568 0: AADE
7569 1: AAD
7570 2: A
7571 3: E
7572    ACDE
7573 0: ACDE
7574 1: ACD
7575 2: C
7576 3: E
7577    ** Failers
7578No match
7579    AD
7580No match
7581
7582/^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i
7583    1221
7584 0: 1221
7585 1: 1221
7586 2: 1
7587    Satan, oscillate my metallic sonatas!
7588 0: Satan, oscillate my metallic sonatas!
7589 1: <unset>
7590 2: <unset>
7591 3: Satan, oscillate my metallic sonatas
7592 4: S
7593    A man, a plan, a canal: Panama!
7594 0: A man, a plan, a canal: Panama!
7595 1: <unset>
7596 2: <unset>
7597 3: A man, a plan, a canal: Panama
7598 4: A
7599    Able was I ere I saw Elba.
7600 0: Able was I ere I saw Elba.
7601 1: <unset>
7602 2: <unset>
7603 3: Able was I ere I saw Elba
7604 4: A
7605    *** Failers
7606No match
7607    The quick brown fox
7608No match
7609
7610/^((.)(?1)\2|.)$/
7611    a
7612 0: a
7613 1: a
7614    aba
7615 0: aba
7616 1: aba
7617 2: a
7618    aabaa
7619 0: aabaa
7620 1: aabaa
7621 2: a
7622    abcdcba
7623 0: abcdcba
7624 1: abcdcba
7625 2: a
7626    pqaabaaqp
7627 0: pqaabaaqp
7628 1: pqaabaaqp
7629 2: p
7630    ablewasiereisawelba
7631 0: ablewasiereisawelba
7632 1: ablewasiereisawelba
7633 2: a
7634    rhubarb
7635No match
7636    the quick brown fox
7637No match
7638
7639/(a)(?<=b(?1))/
7640    baz
7641 0: a
7642 1: a
7643    ** Failers
7644No match
7645    caz
7646No match
7647
7648/(?<=b(?1))(a)/
7649    zbaaz
7650 0: a
7651 1: a
7652    ** Failers
7653No match
7654    aaa
7655No match
7656
7657/(?<X>a)(?<=b(?&X))/
7658    baz
7659 0: a
7660 1: a
7661
7662/^(?|(abc)|(def))\1/
7663    abcabc
7664 0: abcabc
7665 1: abc
7666    defdef
7667 0: defdef
7668 1: def
7669    ** Failers
7670No match
7671    abcdef
7672No match
7673    defabc
7674No match
7675
7676/^(?|(abc)|(def))(?1)/
7677    abcabc
7678 0: abcabc
7679 1: abc
7680    defabc
7681 0: defabc
7682 1: def
7683    ** Failers
7684No match
7685    defdef
7686No match
7687    abcdef
7688No match
7689
7690/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/xJ
7691    a\"aaaaa
7692 0: a"aaaaa
7693 1: "
7694 2: <unset>
7695 3: "
7696    b\"aaaaa
7697 0: b"aaaaa
7698 1: <unset>
7699 2: <unset>
7700 3: <unset>
7701 4: "
7702 5: <unset>
7703 6: "
7704    ** Failers
7705No match
7706    b\"11111
7707No match
7708
7709/(?:(?1)|B)(A(*F)|C)/
7710    ABCD
7711 0: BC
7712 1: C
7713    CCD
7714 0: CC
7715 1: C
7716    ** Failers
7717No match
7718    CAD
7719No match
7720
7721/^(?:(?1)|B)(A(*F)|C)/
7722    CCD
7723 0: CC
7724 1: C
7725    BCD
7726 0: BC
7727 1: C
7728    ** Failers
7729No match
7730    ABCD
7731No match
7732    CAD
7733No match
7734    BAD
7735No match
7736
7737/(?:(?1)|B)(A(*ACCEPT)XX|C)D/
7738    AAD
7739 0: AA
7740 1: A
7741    ACD
7742 0: ACD
7743 1: C
7744    BAD
7745 0: BA
7746 1: A
7747    BCD
7748 0: BCD
7749 1: C
7750    BAX
7751 0: BA
7752 1: A
7753    ** Failers
7754No match
7755    ACX
7756No match
7757    ABC
7758No match
7759
7760/(?(DEFINE)(A))B(?1)C/
7761    BAC
7762 0: BAC
7763
7764/(?(DEFINE)((A)\2))B(?1)C/
7765    BAAC
7766 0: BAAC
7767
7768/(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x
7769    (ab(cd)ef)
7770 0: (ab(cd)ef)
7771 1: (ab(cd)ef)
7772 2: ef
7773
7774/^(?=a(*SKIP)b|ac)/
7775    ** Failers
7776No match
7777    ac
7778No match
7779
7780/^(?=a(*PRUNE)b)/
7781    ab
7782 0:
7783    ** Failers
7784No match
7785    ac
7786No match
7787
7788/^(?=a(*ACCEPT)b)/
7789    ac
7790 0:
7791
7792/(?>a\Kb)/
7793    ab
7794 0: b
7795
7796/((?>a\Kb))/
7797    ab
7798 0: b
7799 1: ab
7800
7801/(a\Kb)/
7802    ab
7803 0: b
7804 1: ab
7805
7806/^a\Kcz|ac/
7807    ac
7808 0: ac
7809
7810/(?>a\Kbz|ab)/
7811    ab
7812 0: ab
7813
7814/^(?&t)(?(DEFINE)(?<t>a\Kb))$/
7815    ab
7816 0: b
7817
7818/^([^()]|\((?1)*\))*$/
7819    a(b)c
7820 0: a(b)c
7821 1: c
7822    a(b(c)d)e
7823 0: a(b(c)d)e
7824 1: e
7825
7826/(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/
7827    0
7828 0: 0
7829 1: 0
7830    00
7831 0: 00
7832 1: 00
7833 2: 0
7834    0000
7835 0: 0000
7836 1: 0000
7837 2: 0
7838
7839/(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/
7840    0
7841 0: 0
7842 1: 0
7843 2: 0
7844    00
7845 0: 0
7846 1: 0
7847 2: 0
7848    0000
7849 0: 0
7850 1: 0
7851 2: 0
7852
7853/--- This one does fail, as expected, in Perl. It needs the complex item at the
7854     end of the pattern. A single letter instead of (B|D) makes it not fail,
7855     which I think is a Perl bug. --- /
7856
7857/A(*COMMIT)(B|D)/
7858    ACABX
7859No match
7860
7861/--- Check the use of names for failure ---/
7862
7863/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
7864    ** Failers
7865No match
7866    AC
7867No match, mark = A
7868    CB
7869No match, mark = B
7870
7871/--- Force no study, otherwise mark is not seen. The studied version is in
7872     test 2 because it isn't Perl-compatible. ---/
7873
7874/(*MARK:A)(*SKIP:B)(C|X)/KSS
7875    C
7876 0: C
7877 1: C
7878MK: A
7879    D
7880No match, mark = A
7881
7882/^(A(*THEN:A)B|C(*THEN:B)D)/K
7883    ** Failers
7884No match
7885    CB
7886No match, mark = B
7887
7888/^(?:A(*THEN:A)B|C(*THEN:B)D)/K
7889    CB
7890No match, mark = B
7891
7892/^(?>A(*THEN:A)B|C(*THEN:B)D)/K
7893    CB
7894No match, mark = B
7895
7896/--- This should succeed, as the skip causes bump to offset 1 (the mark). Note
7897that we have to have something complicated such as (B|Z) at the end because,
7898for Perl, a simple character somehow causes an unwanted optimization to mess
7899with the handling of backtracking verbs. ---/
7900
7901/A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/xK
7902    AAAC
7903 0: AC
7904
7905/--- Test skipping over a non-matching mark. ---/
7906
7907/A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/xK
7908    AAAC
7909 0: AC
7910
7911/--- Check shorthand for MARK ---/
7912
7913/A(*:A)A+(*SKIP:A)(B|Z) | AC/xK
7914    AAAC
7915 0: AC
7916
7917/--- Don't loop! Force no study, otherwise mark is not seen. ---/
7918
7919/(*:A)A+(*SKIP:A)(B|Z)/KSS
7920    AAAC
7921No match, mark = A
7922
7923/--- This should succeed, as a non-existent skip name disables the skip ---/
7924
7925/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
7926    AAAC
7927 0: AC
7928
7929/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/xK
7930    AAAC
7931 0: AC
7932MK: B
7933
7934/--- COMMIT at the start of a pattern should act like an anchor. Again,
7935however, we need the complication for Perl. ---/
7936
7937/(*COMMIT)(A|P)(B|P)(C|P)/
7938    ABCDEFG
7939 0: ABC
7940 1: A
7941 2: B
7942 3: C
7943    ** Failers
7944No match
7945    DEFGABC
7946No match
7947
7948/--- COMMIT inside an atomic group can't stop backtracking over the group. ---/
7949
7950/(\w+)(?>b(*COMMIT))\w{2}/
7951    abbb
7952 0: abbb
7953 1: a
7954
7955/(\w+)b(*COMMIT)\w{2}/
7956    abbb
7957No match
7958
7959/--- Check opening parens in comment when seeking forward reference. ---/
7960
7961/(?&t)(?#()(?(DEFINE)(?<t>a))/
7962    bac
7963 0: a
7964
7965/--- COMMIT should override THEN ---/
7966
7967/(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?/
7968  yes
7969No match
7970
7971/(?>(*COMMIT)(yes|no)(*THEN)(*F))?/
7972  yes
7973No match
7974
7975/b?(*SKIP)c/
7976    bc
7977 0: bc
7978    abc
7979 0: bc
7980
7981/(*SKIP)bc/
7982    a
7983No match
7984
7985/(*SKIP)b/
7986    a
7987No match
7988
7989/(?P<abn>(?P=abn)xxx|)+/
7990    xxx
7991 0:
7992 1:
7993
7994/(?i:([^b]))(?1)/
7995    aa
7996 0: aa
7997 1: a
7998    aA
7999 0: aA
8000 1: a
8001    ** Failers
8002 0: **
8003 1: *
8004    ab
8005No match
8006    aB
8007No match
8008    Ba
8009No match
8010    ba
8011No match
8012
8013/^(?&t)*+(?(DEFINE)(?<t>a))\w$/
8014    aaaaaaX
8015 0: aaaaaaX
8016    ** Failers
8017No match
8018    aaaaaa
8019No match
8020
8021/^(?&t)*(?(DEFINE)(?<t>a))\w$/
8022    aaaaaaX
8023 0: aaaaaaX
8024    aaaaaa
8025 0: aaaaaa
8026
8027/^(a)*+(\w)/
8028    aaaaX
8029 0: aaaaX
8030 1: a
8031 2: X
8032    YZ
8033 0: Y
8034 1: <unset>
8035 2: Y
8036    ** Failers
8037No match
8038    aaaa
8039No match
8040
8041/^(?:a)*+(\w)/
8042    aaaaX
8043 0: aaaaX
8044 1: X
8045    YZ
8046 0: Y
8047 1: Y
8048    ** Failers
8049No match
8050    aaaa
8051No match
8052
8053/^(a)++(\w)/
8054    aaaaX
8055 0: aaaaX
8056 1: a
8057 2: X
8058    ** Failers
8059No match
8060    aaaa
8061No match
8062    YZ
8063No match
8064
8065/^(?:a)++(\w)/
8066    aaaaX
8067 0: aaaaX
8068 1: X
8069    ** Failers
8070No match
8071    aaaa
8072No match
8073    YZ
8074No match
8075
8076/^(a)?+(\w)/
8077    aaaaX
8078 0: aa
8079 1: a
8080 2: a
8081    YZ
8082 0: Y
8083 1: <unset>
8084 2: Y
8085
8086/^(?:a)?+(\w)/
8087    aaaaX
8088 0: aa
8089 1: a
8090    YZ
8091 0: Y
8092 1: Y
8093
8094/^(a){2,}+(\w)/
8095    aaaaX
8096 0: aaaaX
8097 1: a
8098 2: X
8099    ** Failers
8100No match
8101    aaa
8102No match
8103    YZ
8104No match
8105
8106/^(?:a){2,}+(\w)/
8107    aaaaX
8108 0: aaaaX
8109 1: X
8110    ** Failers
8111No match
8112    aaa
8113No match
8114    YZ
8115No match
8116
8117/(a|)*(?1)b/
8118    b
8119 0: b
8120 1:
8121    ab
8122 0: ab
8123 1:
8124    aab
8125 0: aab
8126 1:
8127
8128/(a)++(?1)b/
8129    ** Failers
8130No match
8131    ab
8132No match
8133    aab
8134No match
8135
8136/(a)*+(?1)b/
8137    ** Failers
8138No match
8139    ab
8140No match
8141    aab
8142No match
8143
8144/(?1)(?:(b)){0}/
8145    b
8146 0: b
8147
8148/(foo ( \( ((?:(?> [^()]+ )|(?2))*) \) ) )/x
8149    foo(bar(baz)+baz(bop))
8150 0: foo(bar(baz)+baz(bop))
8151 1: foo(bar(baz)+baz(bop))
8152 2: (bar(baz)+baz(bop))
8153 3: bar(baz)+baz(bop)
8154
8155/(A (A|B(*ACCEPT)|C) D)(E)/x
8156    AB
8157 0: AB
8158 1: AB
8159 2: B
8160
8161/\A.*?(a|bc)/
8162    ba
8163 0: ba
8164 1: a
8165
8166/\A.*?(?:a|bc)++/
8167    ba
8168 0: ba
8169
8170/\A.*?(a|bc)++/
8171    ba
8172 0: ba
8173 1: a
8174
8175/\A.*?(?:a|bc|d)/
8176    ba
8177 0: ba
8178
8179/(?:(b))++/
8180    beetle
8181 0: b
8182 1: b
8183
8184/(?(?=(a(*ACCEPT)z))a)/
8185    a
8186 0: a
8187 1: a
8188
8189/^(a)(?1)+ab/
8190    aaaab
8191 0: aaaab
8192 1: a
8193
8194/^(a)(?1)++ab/
8195    aaaab
8196No match
8197
8198/^(?=a(*:M))aZ/K
8199    aZbc
8200 0: aZ
8201MK: M
8202
8203/^(?!(*:M)b)aZ/K
8204    aZbc
8205 0: aZ
8206
8207/(?(DEFINE)(a))?b(?1)/
8208    backgammon
8209 0: ba
8210
8211/^\N+/
8212    abc\ndef
8213 0: abc
8214
8215/^\N{1,}/
8216    abc\ndef
8217 0: abc
8218
8219/(?(R)a+|(?R)b)/
8220    aaaabcde
8221 0: aaaab
8222
8223/(?(R)a+|((?R))b)/
8224    aaaabcde
8225 0: aaaab
8226 1: aaaa
8227
8228/((?(R)a+|(?1)b))/
8229    aaaabcde
8230 0: aaaab
8231 1: aaaab
8232
8233/((?(R1)a+|(?1)b))/
8234    aaaabcde
8235 0: aaaab
8236 1: aaaab
8237
8238/((?(R)a|(?1)))*/
8239    aaa
8240 0: aaa
8241 1: a
8242
8243/((?(R)a|(?1)))+/
8244    aaa
8245 0: aaa
8246 1: a
8247
8248/a(*:any
8249name)/K
8250    abc
8251 0: a
8252MK: any \x0aname
8253
8254/(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/
8255    a
8256 0: a
8257    ba
8258 0: a
8259    bba
8260 0: a
8261
8262/--- Checking revised (*THEN) handling ---/
8263
8264/--- Capture ---/
8265
8266/^.*? (a(*THEN)b) c/x
8267    aabc
8268No match
8269
8270/^.*? (a(*THEN)b|(*F)) c/x
8271    aabc
8272 0: aabc
8273 1: ab
8274
8275/^.*? ( (a(*THEN)b) | (*F) ) c/x
8276    aabc
8277 0: aabc
8278 1: ab
8279 2: ab
8280
8281/^.*? ( (a(*THEN)b) ) c/x
8282    aabc
8283No match
8284
8285/--- Non-capture ---/
8286
8287/^.*? (?:a(*THEN)b) c/x
8288    aabc
8289No match
8290
8291/^.*? (?:a(*THEN)b|(*F)) c/x
8292    aabc
8293 0: aabc
8294
8295/^.*? (?: (?:a(*THEN)b) | (*F) ) c/x
8296    aabc
8297 0: aabc
8298
8299/^.*? (?: (?:a(*THEN)b) ) c/x
8300    aabc
8301No match
8302
8303/--- Atomic ---/
8304
8305/^.*? (?>a(*THEN)b) c/x
8306    aabc
8307No match
8308
8309/^.*? (?>a(*THEN)b|(*F)) c/x
8310    aabc
8311 0: aabc
8312
8313/^.*? (?> (?>a(*THEN)b) | (*F) ) c/x
8314    aabc
8315 0: aabc
8316
8317/^.*? (?> (?>a(*THEN)b) ) c/x
8318    aabc
8319No match
8320
8321/--- Possessive capture ---/
8322
8323/^.*? (a(*THEN)b)++ c/x
8324    aabc
8325No match
8326
8327/^.*? (a(*THEN)b|(*F))++ c/x
8328    aabc
8329 0: aabc
8330 1: ab
8331
8332/^.*? ( (a(*THEN)b)++ | (*F) )++ c/x
8333    aabc
8334 0: aabc
8335 1: ab
8336 2: ab
8337
8338/^.*? ( (a(*THEN)b)++ )++ c/x
8339    aabc
8340No match
8341
8342/--- Possessive non-capture ---/
8343
8344/^.*? (?:a(*THEN)b)++ c/x
8345    aabc
8346No match
8347
8348/^.*? (?:a(*THEN)b|(*F))++ c/x
8349    aabc
8350 0: aabc
8351
8352/^.*? (?: (?:a(*THEN)b)++ | (*F) )++ c/x
8353    aabc
8354 0: aabc
8355
8356/^.*? (?: (?:a(*THEN)b)++ )++ c/x
8357    aabc
8358No match
8359
8360/--- Condition assertion ---/
8361
8362/^(?(?=a(*THEN)b)ab|ac)/
8363    ac
8364 0: ac
8365
8366/--- Condition ---/
8367
8368/^.*?(?(?=a)a|b(*THEN)c)/
8369    ba
8370No match
8371
8372/^.*?(?:(?(?=a)a|b(*THEN)c)|d)/
8373    ba
8374 0: ba
8375
8376/^.*?(?(?=a)a(*THEN)b|c)/
8377    ac
8378No match
8379
8380/--- Assertion ---/
8381
8382/^.*(?=a(*THEN)b)/
8383    aabc
8384 0: a
8385
8386/------------------------------/
8387
8388/(?>a(*:m))/imsxSK
8389    a
8390 0: a
8391MK: m
8392
8393/(?>(a)(*:m))/imsxSK
8394    a
8395 0: a
8396 1: a
8397MK: m
8398
8399/(?<=a(*ACCEPT)b)c/
8400    xacd
8401 0: c
8402
8403/(?<=(a(*ACCEPT)b))c/
8404    xacd
8405 0: c
8406 1: a
8407
8408/(?<=(a(*COMMIT)b))c/
8409    xabcd
8410 0: c
8411 1: ab
8412    ** Failers
8413No match
8414    xacd
8415No match
8416
8417/(?<!a(*FAIL)b)c/
8418    xcd
8419 0: c
8420    acd
8421 0: c
8422
8423/(?<=a(*:N)b)c/K
8424    xabcd
8425 0: c
8426MK: N
8427
8428/(?<=a(*PRUNE)b)c/
8429    xabcd
8430 0: c
8431
8432/(?<=a(*SKIP)b)c/
8433    xabcd
8434 0: c
8435
8436/(?<=a(*THEN)b)c/
8437    xabcd
8438 0: c
8439
8440/(a)(?2){2}(.)/
8441    abcd
8442 0: abcd
8443 1: a
8444 2: d
8445
8446/(*MARK:A)(*PRUNE:B)(C|X)/KS
8447    C
8448 0: C
8449 1: C
8450MK: B
8451    D
8452No match, mark = B
8453
8454/(*MARK:A)(*PRUNE:B)(C|X)/KSS
8455    C
8456 0: C
8457 1: C
8458MK: B
8459    D
8460No match, mark = B
8461
8462/(*MARK:A)(*THEN:B)(C|X)/KS
8463    C
8464 0: C
8465 1: C
8466MK: B
8467    D
8468No match, mark = B
8469
8470/(*MARK:A)(*THEN:B)(C|X)/KSY
8471    C
8472 0: C
8473 1: C
8474MK: B
8475    D
8476No match, mark = B
8477
8478/(*MARK:A)(*THEN:B)(C|X)/KSS
8479    C
8480 0: C
8481 1: C
8482MK: B
8483    D
8484No match, mark = B
8485
8486/--- This should fail, as the skip causes a bump to offset 3 (the skip) ---/
8487
8488/A(*MARK:A)A+(*SKIP)(B|Z) | AC/xK
8489    AAAC
8490No match, mark = A
8491
8492/--- Same --/
8493
8494/A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/xK
8495    AAAC
8496No match, mark = B
8497
8498/A(*:A)A+(*SKIP)(B|Z) | AC/xK
8499    AAAC
8500No match, mark = A
8501
8502/--- This should fail, as a null name is the same as no name ---/
8503
8504/A(*MARK:A)A+(*SKIP:)(B|Z) | AC/xK
8505    AAAC
8506No match, mark = A
8507
8508/--- A check on what happens after hitting a mark and them bumping along to
8509something that does not even start. Perl reports tags after the failures here,
8510though it does not when the individual letters are made into something
8511more complicated. ---/
8512
8513/A(*:A)B|XX(*:B)Y/K
8514    AABC
8515 0: AB
8516MK: A
8517    XXYZ
8518 0: XXY
8519MK: B
8520    ** Failers
8521No match
8522    XAQQ
8523No match, mark = A
8524    XAQQXZZ
8525No match, mark = A
8526    AXQQQ
8527No match, mark = A
8528    AXXQQQ
8529No match, mark = B
8530
8531/^(A(*THEN:A)B|C(*THEN:B)D)/K
8532    AB
8533 0: AB
8534 1: AB
8535MK: A
8536    CD
8537 0: CD
8538 1: CD
8539MK: B
8540    ** Failers
8541No match
8542    AC
8543No match, mark = A
8544    CB
8545No match, mark = B
8546
8547/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
8548    AB
8549 0: AB
8550 1: AB
8551MK: A
8552    CD
8553 0: CD
8554 1: CD
8555MK: B
8556    ** Failers
8557No match
8558    AC
8559No match, mark = A
8560    CB
8561No match, mark = B
8562
8563/--- An empty name does not pass back an empty string. It is the same as if no
8564name were given. ---/
8565
8566/^(A(*PRUNE:)B|C(*PRUNE:B)D)/K
8567    AB
8568 0: AB
8569 1: AB
8570    CD
8571 0: CD
8572 1: CD
8573MK: B
8574
8575/--- PRUNE goes to next bumpalong; COMMIT does not. ---/
8576
8577/A(*PRUNE:A)B/K
8578    ACAB
8579 0: AB
8580MK: A
8581
8582/--- Mark names can be duplicated ---/
8583
8584/A(*:A)B|X(*:A)Y/K
8585    AABC
8586 0: AB
8587MK: A
8588    XXYZ
8589 0: XY
8590MK: A
8591
8592/b(*:m)f|a(*:n)w/K
8593    aw
8594 0: aw
8595MK: n
8596    ** Failers
8597No match, mark = n
8598    abc
8599No match, mark = m
8600
8601/b(*:m)f|aw/K
8602    abaw
8603 0: aw
8604    ** Failers
8605No match
8606    abc
8607No match, mark = m
8608    abax
8609No match, mark = m
8610
8611/A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/xK
8612    AAAC
8613 0: AAC
8614
8615/a(*PRUNE:X)bc|qq/KY
8616    ** Failers
8617No match, mark = X
8618    axy
8619No match, mark = X
8620
8621/a(*THEN:X)bc|qq/KY
8622    ** Failers
8623No match, mark = X
8624    axy
8625No match, mark = X
8626
8627/(?=a(*MARK:A)b)..x/K
8628    abxy
8629 0: abx
8630MK: A
8631    ** Failers
8632No match
8633    abpq
8634No match
8635
8636/(?=a(*MARK:A)b)..(*:Y)x/K
8637    abxy
8638 0: abx
8639MK: Y
8640    ** Failers
8641No match
8642    abpq
8643No match
8644
8645/(?=a(*PRUNE:A)b)..x/K
8646    abxy
8647 0: abx
8648MK: A
8649    ** Failers
8650No match
8651    abpq
8652No match
8653
8654/(?=a(*PRUNE:A)b)..(*:Y)x/K
8655    abxy
8656 0: abx
8657MK: Y
8658    ** Failers
8659No match
8660    abpq
8661No match
8662
8663/(?=a(*THEN:A)b)..x/K
8664    abxy
8665 0: abx
8666MK: A
8667    ** Failers
8668No match
8669    abpq
8670No match
8671
8672/(?=a(*THEN:A)b)..(*:Y)x/K
8673    abxy
8674 0: abx
8675MK: Y
8676    ** Failers
8677No match
8678    abpq
8679No match
8680
8681/(another)?(\1?)test/
8682    hello world test
8683 0: test
8684 1: <unset>
8685 2:
8686
8687/(another)?(\1+)test/
8688    hello world test
8689No match
8690
8691/(a(*COMMIT)b){0}a(?1)|aac/
8692    aac
8693 0: aac
8694
8695/((?:a?)*)*c/
8696  aac
8697 0: aac
8698 1:
8699
8700/((?>a?)*)*c/
8701  aac
8702 0: aac
8703 1:
8704
8705/(?>.*?a)(?<=ba)/
8706    aba
8707 0: ba
8708
8709/(?:.*?a)(?<=ba)/
8710    aba
8711 0: aba
8712
8713/.*?a(*PRUNE)b/
8714    aab
8715 0: ab
8716
8717/.*?a(*PRUNE)b/s
8718    aab
8719 0: ab
8720
8721/^a(*PRUNE)b/s
8722    aab
8723No match
8724
8725/.*?a(*SKIP)b/
8726    aab
8727 0: ab
8728
8729/(?>.*?a)b/s
8730    aab
8731 0: ab
8732
8733/(?>.*?a)b/
8734    aab
8735 0: ab
8736
8737/(?>^a)b/s
8738    aab
8739No match
8740
8741/(?>.*?)(?<=(abcd)|(wxyz))/
8742    alphabetabcd
8743 0:
8744 1: abcd
8745    endingwxyz
8746 0:
8747 1: <unset>
8748 2: wxyz
8749
8750/(?>.*)(?<=(abcd)|(wxyz))/
8751    alphabetabcd
8752 0: alphabetabcd
8753 1: abcd
8754    endingwxyz
8755 0: endingwxyz
8756 1: <unset>
8757 2: wxyz
8758
8759"(?>.*)foo"
8760    abcdfooxyz
8761No match
8762
8763"(?>.*?)foo"
8764    abcdfooxyz
8765 0: foo
8766
8767/(?:(a(*PRUNE)b)){0}(?:(?1)|ac)/
8768    ac
8769 0: ac
8770
8771/(?:(a(*SKIP)b)){0}(?:(?1)|ac)/
8772    ac
8773 0: ac
8774
8775/(?<=(*SKIP)ac)a/
8776    aa
8777No match
8778
8779/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
8780    AAAC
8781 0: AC
8782
8783/a(*SKIP:m)x|ac(*:n)(*SKIP:n)d|ac/K
8784    acacd
8785 0: acd
8786MK: n
8787
8788/A(*SKIP:m)x|A(*SKIP:n)x|AB/K
8789    AB
8790 0: AB
8791
8792/((*SKIP:r)d){0}a(*SKIP:m)x|ac(*:n)|ac/K
8793    acacd
8794 0: ac
8795MK: n
8796
8797/-- Tests that try to figure out how Perl works. My hypothesis is that the
8798    first verb that is backtracked onto is the one that acts. This seems to be
8799    the case almost all the time, but there is one exception that is perhaps a
8800    bug. --/
8801
8802/-- This matches "aaaac"; each PRUNE advances one character until the subject
8803    no longer starts with 5 'a's. --/
8804
8805/aaaaa(*PRUNE)b|a+c/
8806    aaaaaac
8807 0: aaaac
8808
8809/-- Putting SKIP in front of PRUNE makes no difference, as it is never
8810backtracked onto, whether or not it has a label. --/
8811
8812/aaaaa(*SKIP)(*PRUNE)b|a+c/
8813    aaaaaac
8814 0: aaaac
8815
8816/aaaaa(*SKIP:N)(*PRUNE)b|a+c/
8817    aaaaaac
8818 0: aaaac
8819
8820/aaaa(*:N)a(*SKIP:N)(*PRUNE)b|a+c/
8821    aaaaaac
8822 0: aaaac
8823
8824/-- Putting THEN in front makes no difference. */
8825
8826/aaaaa(*THEN)(*PRUNE)b|a+c/
8827    aaaaaac
8828 0: aaaac
8829
8830/-- However, putting COMMIT in front of the prune changes it to "no match". I
8831    think this is inconsistent and possibly a bug. For the moment, running this
8832    test is moved out of the Perl-compatible file. --/
8833
8834/aaaaa(*COMMIT)(*PRUNE)b|a+c/
8835
8836
8837/---- OK, lets play the same game again using SKIP instead of PRUNE. ----/
8838
8839/-- This matches "ac" because SKIP forces the next match to start on the
8840    sixth "a". --/
8841
8842/aaaaa(*SKIP)b|a+c/
8843    aaaaaac
8844 0: ac
8845
8846/-- Putting PRUNE in front makes no difference. --/
8847
8848/aaaaa(*PRUNE)(*SKIP)b|a+c/
8849    aaaaaac
8850 0: ac
8851
8852/-- Putting THEN in front makes no difference. --/
8853
8854/aaaaa(*THEN)(*SKIP)b|a+c/
8855    aaaaaac
8856 0: ac
8857
8858/-- In this case, neither does COMMIT. This still matches "ac". --/
8859
8860/aaaaa(*COMMIT)(*SKIP)b|a+c/
8861    aaaaaac
8862 0: ac
8863
8864/-- This gives "no match", as expected. --/
8865
8866/aaaaa(*COMMIT)b|a+c/
8867    aaaaaac
8868No match
8869
8870
8871/------ Tests using THEN ------/
8872
8873/-- This matches "aaaaaac", as expected. --/
8874
8875/aaaaa(*THEN)b|a+c/
8876    aaaaaac
8877 0: aaaaaac
8878
8879/-- Putting SKIP in front makes no difference. --/
8880
8881/aaaaa(*SKIP)(*THEN)b|a+c/
8882    aaaaaac
8883 0: aaaaaac
8884
8885/-- Putting PRUNE in front makes no difference. --/
8886
8887/aaaaa(*PRUNE)(*THEN)b|a+c/
8888    aaaaaac
8889 0: aaaaaac
8890
8891/-- Putting COMMIT in front makes no difference. --/
8892
8893/aaaaa(*COMMIT)(*THEN)b|a+c/
8894    aaaaaac
8895 0: aaaaaac
8896
8897/-- End of "priority" tests --/
8898
8899/aaaaa(*:m)(*PRUNE:m)(*SKIP:m)m|a+/
8900    aaaaaa
8901 0: a
8902
8903/aaaaa(*:m)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/
8904    aaaaaa
8905 0: a
8906
8907/aaaaa(*:n)(*PRUNE:m)(*SKIP:m)m|a+/
8908    aaaaaa
8909 0: aaaa
8910
8911/aaaaa(*:n)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/
8912    aaaaaa
8913 0: a
8914
8915/a(*MARK:A)aa(*PRUNE:A)a(*SKIP:A)b|a+c/
8916    aaaac
8917 0: aac
8918
8919/a(*MARK:A)aa(*MARK:A)a(*SKIP:A)b|a+c/
8920    aaaac
8921 0: ac
8922
8923/aaa(*PRUNE:A)a(*SKIP:A)b|a+c/
8924    aaaac
8925 0: aac
8926
8927/aaa(*MARK:A)a(*SKIP:A)b|a+c/
8928    aaaac
8929 0: ac
8930
8931/a(*:m)a(*COMMIT)(*SKIP:m)b|a+c/K
8932    aaaaaac
8933 0: ac
8934
8935/.?(a|b(*THEN)c)/
8936    ba
8937 0: ba
8938 1: a
8939
8940/(a(*COMMIT)b)c|abd/
8941    abc
8942 0: abc
8943 1: ab
8944    abd
8945No match
8946
8947/(?=a(*COMMIT)b)abc|abd/
8948    abc
8949 0: abc
8950    abd
8951 0: abd
8952
8953/(?>a(*COMMIT)b)c|abd/
8954    abc
8955 0: abc
8956    abd
8957 0: abd
8958
8959/a(?=b(*COMMIT)c)[^d]|abd/
8960    abd
8961No match
8962    abc
8963 0: ab
8964
8965/a(?=bc).|abd/
8966    abd
8967 0: abd
8968    abc
8969 0: ab
8970
8971/a(?>b(*COMMIT)c)d|abd/
8972    abceabd
8973No match
8974
8975/a(?>bc)d|abd/
8976    abceabd
8977 0: abd
8978
8979/(?>a(*COMMIT)b)c|abd/
8980    abd
8981 0: abd
8982
8983/(?>a(*COMMIT)c)d|abd/
8984    abd
8985No match
8986
8987/((?=a(*COMMIT)b)ab|ac){0}(?:(?1)|a(c))/
8988    ac
8989 0: ac
8990 1: <unset>
8991 2: c
8992
8993/-- These tests were formerly in test 2, but changes in PCRE and Perl have
8994    made them compatible. --/
8995
8996/^(a)?(?(1)a|b)+$/
8997    *** Failers
8998No match
8999    a
9000No match
9001
9002/(?=a\Kb)ab/
9003    ab
9004 0: b
9005
9006/(?!a\Kb)ac/
9007    ac
9008 0: ac
9009
9010/^abc(?<=b\Kc)d/
9011    abcd
9012 0: cd
9013
9014/^abc(?<!b\Kq)d/
9015    abcd
9016 0: abcd
9017
9018
9019/A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xK
9020    AAAC
9021No match, mark = A
9022
9023/^((abc|abcx)(*THEN)y|abcd)/
9024    abcd
9025 0: abcd
9026 1: abcd
9027    *** Failers
9028No match
9029    abcxy
9030No match
9031
9032/^((yes|no)(*THEN)(*F))?/
9033  yes
9034No match
9035
9036/(A (.*)   C? (*THEN)  | A D) (*FAIL)/x
9037AbcdCBefgBhiBqz
9038No match
9039
9040/(A (.*)   C? (*THEN)  | A D) z/x
9041AbcdCBefgBhiBqz
9042No match
9043
9044/(A (.*)   C? (*THEN)  | A D) \s* (*FAIL)/x
9045AbcdCBefgBhiBqz
9046No match
9047
9048/(A (.*)   C? (*THEN)  | A D) \s* z/x
9049AbcdCBefgBhiBqz
9050No match
9051
9052/(A (.*)   (?:C|) (*THEN)  | A D) (*FAIL)/x
9053AbcdCBefgBhiBqz
9054No match
9055
9056/(A (.*)   (?:C|) (*THEN)  | A D) z/x
9057AbcdCBefgBhiBqz
9058No match
9059
9060/(A (.*)   C{0,6} (*THEN)  | A D) (*FAIL)/x
9061AbcdCBefgBhiBqz
9062No match
9063
9064/(A (.*)   C{0,6} (*THEN)  | A D) z/x
9065AbcdCBefgBhiBqz
9066No match
9067
9068/(A (.*)   (CE){0,6} (*THEN)  | A D) (*FAIL)/x
9069AbcdCEBefgBhiBqz
9070No match
9071
9072/(A (.*)   (CE){0,6} (*THEN)  | A D) z/x
9073AbcdCEBefgBhiBqz
9074No match
9075
9076/(A (.*)   (CE*){0,6} (*THEN)  | A D) (*FAIL)/x
9077AbcdCBefgBhiBqz
9078No match
9079
9080/(A (.*)   (CE*){0,6} (*THEN)  | A D) z/x
9081AbcdCBefgBhiBqz
9082No match
9083
9084/(?=a(*COMMIT)b|ac)ac|ac/
9085    ac
9086No match
9087
9088/(?=a(*COMMIT)b|(ac)) ac | (a)c/x
9089    ac
9090No match
9091
9092/--------/
9093
9094/(?(?!b(*THEN)a)bn|bnn)/
9095   bnn
9096 0: bn
9097
9098/(?!b(*SKIP)a)bn|bnn/
9099    bnn
9100 0: bn
9101
9102/(?(?!b(*SKIP)a)bn|bnn)/
9103   bnn
9104 0: bn
9105
9106/(?!b(*PRUNE)a)bn|bnn/
9107    bnn
9108 0: bn
9109
9110/(?(?!b(*PRUNE)a)bn|bnn)/
9111   bnn
9112 0: bn
9113
9114/(?!b(*COMMIT)a)bn|bnn/
9115    bnn
9116 0: bn
9117
9118/(?(?!b(*COMMIT)a)bn|bnn)/
9119   bnn
9120 0: bn
9121
9122/(?=b(*SKIP)a)bn|bnn/
9123    bnn
9124No match
9125
9126/(?=b(*THEN)a)bn|bnn/
9127    bnn
9128 0: bnn
9129
9130 /^(?!a(*SKIP)b)/
9131     ac
9132 0:
9133
9134 /^(?!a(*SKIP)b)../
9135     acd
9136 0: ac
9137
9138/(?!a(*SKIP)b)../
9139     acd
9140 0: ac
9141
9142/^(?(?!a(*SKIP)b))/
9143     ac
9144 0:
9145
9146/^(?!a(*PRUNE)b)../
9147     acd
9148 0: ac
9149
9150/(?!a(*PRUNE)b)../
9151     acd
9152 0: ac
9153
9154 /(?!a(*COMMIT)b)ac|cd/
9155     ac
9156 0: ac
9157
9158/\A.*?(?:a|bc)/
9159    ba
9160 0: ba
9161
9162/^(A(*THEN)B|C(*THEN)D)/
9163    CD
9164 0: CD
9165 1: CD
9166
9167/(*:m(m)(?&y)(?(DEFINE)(?<y>b))/K
9168    abc
9169 0: b
9170MK: m(m
9171
9172/(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/K
9173    abc
9174 0: b
9175MK: m(m
9176
9177/(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/K
9178    abc
9179 0: b
9180
9181/(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/K
9182    abc
9183 0: b
9184MK: m(m
9185
9186/^\d*\w{4}/
9187    1234
9188 0: 1234
9189    123
9190No match
9191
9192/^[^b]*\w{4}/
9193    aaaa
9194 0: aaaa
9195    aaa
9196No match
9197
9198/^[^b]*\w{4}/i
9199    aaaa
9200 0: aaaa
9201    aaa
9202No match
9203
9204/^a*\w{4}/
9205    aaaa
9206 0: aaaa
9207    aaa
9208No match
9209
9210/^a*\w{4}/i
9211    aaaa
9212 0: aaaa
9213    aaa
9214No match
9215
9216/(?(?=ab)ab)/+
9217    ca
9218 0:
9219 0+ ca
9220    cd
9221 0:
9222 0+ cd
9223
9224/(?:(?<n>foo)|(?<n>bar))\k<n>/J
9225    foofoo
9226 0: foofoo
9227 1: foo
9228    barbar
9229 0: barbar
9230 1: <unset>
9231 2: bar
9232
9233/(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/J
9234    AfooA
9235 0: AfooA
9236 1: A
9237 2: foo
9238    AbarA
9239 0: AbarA
9240 1: A
9241 2: <unset>
9242 3: bar
9243    ** Failers
9244No match
9245    Afoofoo
9246No match
9247    Abarbar
9248No match
9249
9250/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
9251    1 IN SOA non-sp1 non-sp2(
9252 0: 1 IN SOA non-sp1 non-sp2(
9253 1: 1
9254 2: non-sp1
9255 3: non-sp2
9256
9257/^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?('A')x) (?(<B>)y)$/xJ
9258    Ax
9259 0: Ax
9260 1: A
9261    BAxy
9262 0: BAxy
9263 1: <unset>
9264 2: B
9265 3: A
9266
9267/^A\xZ/
9268    A\0Z
9269 0: A\x00Z
9270
9271/^A\o{123}B/
9272    A\123B
9273 0: ASB
9274
9275/ ^ a + + b $ /x
9276    aaaab
9277 0: aaaab
9278
9279/ ^ a + #comment
9280  + b $ /x
9281    aaaab
9282 0: aaaab
9283
9284/ ^ a + #comment
9285  #comment
9286  + b $ /x
9287    aaaab
9288 0: aaaab
9289
9290/ ^ (?> a + ) b $ /x
9291    aaaab
9292 0: aaaab
9293
9294/ ^ ( a + ) + + \w $ /x
9295    aaaab
9296 0: aaaab
9297 1: aaaa
9298
9299/(?:a\Kb)*+/+
9300    ababc
9301 0: b
9302 0+ c
9303
9304/(?>a\Kb)*/+
9305    ababc
9306 0: b
9307 0+ c
9308
9309/(?:a\Kb)*/+
9310    ababc
9311 0: b
9312 0+ c
9313
9314/(a\Kb)*+/+
9315    ababc
9316 0: b
9317 0+ c
9318 1: ab
9319
9320/(a\Kb)*/+
9321    ababc
9322 0: b
9323 0+ c
9324 1: ab
9325
9326/(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/
9327    acb
9328No match
9329
9330'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++'
9331    NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
9332 0: NON QUOTED "QUOT""ED" AFTER
9333
9334'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
9335    NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
9336 0: NON QUOTED "QUOT""ED" AFTER
9337
9338'\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++'
9339    NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
9340 0: NON QUOTED "QUOT""ED" AFTER
9341
9342'\A([^\"1]++|[\"2]([^\"3]*+|[\"4][\"5])*+[\"6])++'
9343    NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
9344 0: NON QUOTED "QUOT""ED" AFTER
9345 1:  AFTER
9346 2:
9347
9348/^\w+(?>\s*)(?<=\w)/
9349  test test
9350 0: tes
9351
9352/(?P<same>a)(?P<same>b)/gJ
9353    abbaba
9354 0: ab
9355 1: a
9356 2: b
9357 0: ab
9358 1: a
9359 2: b
9360
9361/(?P<same>a)(?P<same>b)(?P=same)/gJ
9362    abbaba
9363 0: aba
9364 1: a
9365 2: b
9366
9367/(?P=same)?(?P<same>a)(?P<same>b)/gJ
9368    abbaba
9369 0: ab
9370 1: a
9371 2: b
9372 0: ab
9373 1: a
9374 2: b
9375
9376/(?:(?P=same)?(?:(?P<same>a)|(?P<same>b))(?P=same))+/gJ
9377    bbbaaabaabb
9378 0: bbbaaaba
9379 1: a
9380 2: b
9381 0: bb
9382 1: <unset>
9383 2: b
9384
9385/(?:(?P=same)?(?:(?P=same)(?P<same>a)(?P=same)|(?P=same)?(?P<same>b)(?P=same)){2}(?P=same)(?P<same>c)(?P=same)){2}(?P<same>z)?/gJ
9386    bbbaaaccccaaabbbcc
9387No match
9388
9389/(?P<Name>a)?(?P<Name2>b)?(?(<Name>)c|d)*l/
9390    acl
9391 0: acl
9392 1: a
9393    bdl
9394 0: bdl
9395 1: <unset>
9396 2: b
9397    adl
9398 0: dl
9399    bcl
9400 0: l
9401
9402/\sabc/
9403    \x{0b}abc
9404 0: \x0babc
9405
9406/[\Qa]\E]+/
9407    aa]]
9408 0: aa]]
9409
9410/[\Q]a\E]+/
9411    aa]]
9412 0: aa]]
9413
9414/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
9415    1234abcd
9416 0:
9417 1: <unset>
9418 2: <unset>
9419 3: <unset>
9420 4: <unset>
9421 5:
9422
9423/(\2)(\1)/
9424
9425"Z*(|d*){216}"
9426
9427"(?1)(?#?'){8}(a)"
9428    baaaaaaaaac
9429 0: aaaaaaaaa
9430 1: a
9431
9432"(?|(\k'Pm')|(?'Pm'))"
9433    abcd
9434 0:
9435 1:
9436
9437/(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\s])/
9438    \  Fred:099
9439 0:
9440
9441/(?=.*X)X$/
9442    \  X
9443 0: X
9444
9445/X+(?#comment)?/
9446    >XXX<
9447 0: X
9448
9449/   (?<word> \w+ )*    \.   /xi
9450    pokus.
9451 0: pokus.
9452 1: pokus
9453
9454/(?(DEFINE) (?<word> \w+ ) ) (?&word)*   \./xi
9455    pokus.
9456 0: pokus.
9457
9458/(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* )   \./xi
9459    pokus.
9460 0: pokus.
9461 1: <unset>
9462 2: pokus
9463
9464/(?&word)*  (?(DEFINE) (?<word> \w+ ) )  \./xi
9465    pokus.
9466 0: pokus.
9467
9468/(?&word)*  \. (?<word> \w+ )/xi
9469    pokus.hokus
9470 0: pokus.hokus
9471 1: hokus
9472
9473/(?:A(*:X))*+/K
9474    A
9475 0: A
9476MK: X
9477
9478/-- End of testinput1 --/
9479