1# This set of tests check the DFA matching functionality of pcre2_dfa_match(),
2# excluding UTF and Unicode property support. All matches are done using DFA,
3# forced by setting a default subject modifier at the start.
4
5#forbid_utf
6#subject dfa
7#newline_default lf anycrlf any
8
9/abc/
10    abc
11 0: abc
12
13/ab*c/
14    abc
15 0: abc
16    abbbbc
17 0: abbbbc
18    ac
19 0: ac
20
21/ab+c/
22    abc
23 0: abc
24    abbbbbbc
25 0: abbbbbbc
26\= Expect no match
27    ac
28No match
29    ab
30No match
31
32/a*/no_auto_possess
33    a
34 0: a
35 1:
36    aaaaaaaaaaaaaaaaa
37Matched, but offsets vector is too small to show all matches
38 0: aaaaaaaaaaaaaaaaa
39 1: aaaaaaaaaaaaaaaa
40 2: aaaaaaaaaaaaaaa
41 3: aaaaaaaaaaaaaa
42 4: aaaaaaaaaaaaa
43 5: aaaaaaaaaaaa
44 6: aaaaaaaaaaa
45 7: aaaaaaaaaa
46 8: aaaaaaaaa
47 9: aaaaaaaa
4810: aaaaaaa
4911: aaaaaa
5012: aaaaa
5113: aaaa
5214: aaa
53    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=10
54Matched, but offsets vector is too small to show all matches
55 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
56 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
57 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaa
58 3: aaaaaaaaaaaaaaaaaaaaaaaaaaa
59 4: aaaaaaaaaaaaaaaaaaaaaaaaaa
60 5: aaaaaaaaaaaaaaaaaaaaaaaaa
61 6: aaaaaaaaaaaaaaaaaaaaaaaa
62 7: aaaaaaaaaaaaaaaaaaaaaaa
63 8: aaaaaaaaaaaaaaaaaaaaaa
64 9: aaaaaaaaaaaaaaaaaaaaa
65    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=dfa_shortest
66 0:
67
68/(a|abcd|african)/
69    a
70 0: a
71    abcd
72 0: abcd
73 1: a
74    african
75 0: african
76 1: a
77
78/^abc/
79    abcdef
80 0: abc
81\= Expect no match
82    xyzabc
83No match
84    xyz\nabc
85No match
86
87/^abc/m
88    abcdef
89 0: abc
90    xyz\nabc
91 0: abc
92\= Expect no match
93    xyzabc
94No match
95
96/\Aabc/
97    abcdef
98 0: abc
99\= Expect no match
100    xyzabc
101No match
102    xyz\nabc
103No match
104
105/\Aabc/m
106    abcdef
107 0: abc
108\= Expect no match
109    xyzabc
110No match
111    xyz\nabc
112No match
113
114/\Gabc/
115    abcdef
116 0: abc
117    xyzabc\=offset=3
118 0: abc
119\= Expect no match
120    xyzabc
121No match
122    xyzabc\=offset=2
123No match
124
125/x\dy\Dz/
126    x9yzz
127 0: x9yzz
128    x0y+z
129 0: x0y+z
130\= Expect no match
131    xyz
132No match
133    xxy0z
134No match
135
136/x\sy\Sz/
137    x yzz
138 0: x yzz
139    x y+z
140 0: x y+z
141\= Expect no match
142    xyz
143No match
144    xxyyz
145No match
146
147/x\wy\Wz/
148    xxy+z
149 0: xxy+z
150\= Expect no match
151    xxy0z
152No match
153    x+y+z
154No match
155
156/x.y/
157    x+y
158 0: x+y
159    x-y
160 0: x-y
161\= Expect no match
162    x\ny
163No match
164
165/x.y/s
166    x+y
167 0: x+y
168    x-y
169 0: x-y
170    x\ny
171 0: x\x0ay
172
173/(a.b(?s)c.d|x.y)p.q/
174    a+bc+dp+q
175 0: a+bc+dp+q
176    a+bc\ndp+q
177 0: a+bc\x0adp+q
178    x\nyp+q
179 0: x\x0ayp+q
180\= Expect no match
181    a\nbc\ndp+q
182No match
183    a+bc\ndp\nq
184No match
185    x\nyp\nq
186No match
187
188/a\d\z/
189    ba0
190 0: a0
191\= Expect no match
192    ba0\n
193No match
194    ba0\ncd
195No match
196
197/a\d\z/m
198    ba0
199 0: a0
200\= Expect no match
201    ba0\n
202No match
203    ba0\ncd
204No match
205
206/a\d\Z/
207    ba0
208 0: a0
209    ba0\n
210 0: a0
211\= Expect no match
212    ba0\ncd
213No match
214
215/a\d\Z/m
216    ba0
217 0: a0
218    ba0\n
219 0: a0
220\= Expect no match
221    ba0\ncd
222No match
223
224/a\d$/
225    ba0
226 0: a0
227    ba0\n
228 0: a0
229\= Expect no match
230    ba0\ncd
231No match
232
233/a\d$/m
234    ba0
235 0: a0
236    ba0\n
237 0: a0
238    ba0\ncd
239 0: a0
240
241/abc/i
242    abc
243 0: abc
244    aBc
245 0: aBc
246    ABC
247 0: ABC
248
249/[^a]/
250    abcd
251 0: b
252
253/ab?\w/
254    abz
255 0: abz
256 1: ab
257    abbz
258 0: abb
259 1: ab
260    azz
261 0: az
262
263/x{0,3}yz/
264    ayzq
265 0: yz
266    axyzq
267 0: xyz
268    axxyz
269 0: xxyz
270    axxxyzq
271 0: xxxyz
272    axxxxyzq
273 0: xxxyz
274\= Expect no match
275    ax
276No match
277    axx
278No match
279
280/x{3}yz/
281    axxxyzq
282 0: xxxyz
283    axxxxyzq
284 0: xxxyz
285\= Expect no match
286    ax
287No match
288    axx
289No match
290    ayzq
291No match
292    axyzq
293No match
294    axxyz
295No match
296
297/x{2,3}yz/
298    axxyz
299 0: xxyz
300    axxxyzq
301 0: xxxyz
302    axxxxyzq
303 0: xxxyz
304\= Expect no match
305    ax
306No match
307    axx
308No match
309    ayzq
310No match
311    axyzq
312No match
313
314/[^a]+/no_auto_possess
315    bac
316 0: b
317    bcdefax
318 0: bcdef
319 1: bcde
320 2: bcd
321 3: bc
322 4: b
323\= Expect no match
324    aaaaa
325No match
326
327/[^a]*/no_auto_possess
328    bac
329 0: b
330 1:
331    bcdefax
332 0: bcdef
333 1: bcde
334 2: bcd
335 3: bc
336 4: b
337 5:
338    aaaaa
339 0:
340
341/[^a]{3,5}/no_auto_possess
342    xyz
343 0: xyz
344    awxyza
345 0: wxyz
346 1: wxy
347    abcdefa
348 0: bcdef
349 1: bcde
350 2: bcd
351    abcdefghijk
352 0: bcdef
353 1: bcde
354 2: bcd
355\= Expect no match
356    axya
357No match
358    axa
359No match
360    aaaaa
361No match
362
363/\d*/
364    1234b567
365 0: 1234
366    xyz
367 0:
368
369/\D*/
370    a1234b567
371 0: a
372    xyz
373 0: xyz
374
375/\d+/
376    ab1234c56
377 0: 1234
378\= Expect no match
379    xyz
380No match
381
382/\D+/
383    ab123c56
384 0: ab
385\= Expect no match
386    789
387No match
388
389/\d?A/
390    045ABC
391 0: 5A
392    ABC
393 0: A
394\= Expect no match
395    XYZ
396No match
397
398/\D?A/
399    ABC
400 0: A
401    BAC
402 0: BA
403    9ABC
404 0: A
405
406/a+/
407    aaaa
408 0: aaaa
409
410/^.*xyz/
411    xyz
412 0: xyz
413    ggggggggxyz
414 0: ggggggggxyz
415
416/^.+xyz/
417    abcdxyz
418 0: abcdxyz
419    axyz
420 0: axyz
421\= Expect no match
422    xyz
423No match
424
425/^.?xyz/
426    xyz
427 0: xyz
428    cxyz
429 0: cxyz
430
431/^\d{2,3}X/
432    12X
433 0: 12X
434    123X
435 0: 123X
436\= Expect no match
437    X
438No match
439    1X
440No match
441    1234X
442No match
443
444/^[abcd]\d/
445    a45
446 0: a4
447    b93
448 0: b9
449    c99z
450 0: c9
451    d04
452 0: d0
453\= Expect no match
454    e45
455No match
456    abcd
457No match
458    abcd1234
459No match
460    1234
461No match
462
463/^[abcd]*\d/
464    a45
465 0: a4
466    b93
467 0: b9
468    c99z
469 0: c9
470    d04
471 0: d0
472    abcd1234
473 0: abcd1
474    1234
475 0: 1
476\= Expect no match
477    e45
478No match
479    abcd
480No match
481
482/^[abcd]+\d/
483    a45
484 0: a4
485    b93
486 0: b9
487    c99z
488 0: c9
489    d04
490 0: d0
491    abcd1234
492 0: abcd1
493\= Expect no match
494    1234
495No match
496    e45
497No match
498    abcd
499No match
500
501/^a+X/
502    aX
503 0: aX
504    aaX
505 0: aaX
506
507/^[abcd]?\d/
508    a45
509 0: a4
510    b93
511 0: b9
512    c99z
513 0: c9
514    d04
515 0: d0
516    1234
517 0: 1
518\= Expect no match
519    abcd1234
520No match
521    e45
522No match
523
524/^[abcd]{2,3}\d/
525    ab45
526 0: ab4
527    bcd93
528 0: bcd9
529\= Expect no match
530    1234
531No match
532    a36
533No match
534    abcd1234
535No match
536    ee45
537No match
538
539/^(abc)*\d/
540    abc45
541 0: abc4
542    abcabcabc45
543 0: abcabcabc4
544    42xyz
545 0: 4
546
547/^(abc)+\d/
548    abc45
549 0: abc4
550    abcabcabc45
551 0: abcabcabc4
552\= Expect no match
553    42xyz
554No match
555
556/^(abc)?\d/
557    abc45
558 0: abc4
559    42xyz
560 0: 4
561\= Expect no match
562    abcabcabc45
563No match
564
565/^(abc){2,3}\d/
566    abcabc45
567 0: abcabc4
568    abcabcabc45
569 0: abcabcabc4
570\= Expect no match
571    abcabcabcabc45
572No match
573    abc45
574No match
575    42xyz
576No match
577
578/1(abc|xyz)2(?1)3/
579    1abc2abc3456
580 0: 1abc2abc3
581    1abc2xyz3456
582 0: 1abc2xyz3
583
584/^(a*\w|ab)=(a*\w|ab)/
585    ab=ab
586 0: ab=ab
587 1: ab=a
588
589/^(a*\w|ab)=(?1)/
590    ab=ab
591 0: ab=ab
592 1: ab=a
593
594/^([^()]|\((?1)*\))*$/
595    abc
596 0: abc
597    a(b)c
598 0: a(b)c
599    a(b(c))d
600 0: a(b(c))d
601\= Expect no match)
602    a(b(c)d
603No match
604
605/^>abc>([^()]|\((?1)*\))*<xyz<$/
606    >abc>123<xyz<
607 0: >abc>123<xyz<
608    >abc>1(2)3<xyz<
609 0: >abc>1(2)3<xyz<
610    >abc>(1(2)3)<xyz<
611 0: >abc>(1(2)3)<xyz<
612
613/^(?>a*)\d/
614    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9876
615 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9
616\= Expect no match
617    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
618No match
619
620/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/x
621    <>
622 0: <>
623    <abcd>
624 0: <abcd>
625    <abc <123> hij>
626 0: <abc <123> hij>
627    <abc <def> hij>
628 0: <def>
629    <abc<>def>
630 0: <abc<>def>
631    <abc<>
632 0: <>
633\= Expect no match
634    <abc
635No match
636
637/^(?(?=abc)\w{3}:|\d\d)$/
638    abc:
639 0: abc:
640    12
641 0: 12
642\= Expect no match
643    123
644No match
645    xyz
646No match
647
648/^(?(?!abc)\d\d|\w{3}:)$/
649    abc:
650 0: abc:
651    12
652 0: 12
653\= Expect no match
654    123
655No match
656    xyz
657No match
658
659/^(?=abc)\w{5}:$/
660    abcde:
661 0: abcde:
662\= Expect no match
663    abc..
664No match
665    123
666No match
667    vwxyz
668No match
669
670/^(?!abc)\d\d$/
671    12
672 0: 12
673\= Expect no match
674    abcde:
675No match
676    abc..
677No match
678    123
679No match
680    vwxyz
681No match
682
683/(?<=abc|xy)123/
684    abc12345
685 0: 123
686    wxy123z
687 0: 123
688\= Expect no match
689    123abc
690No match
691
692/(?<!abc|xy)123/
693    123abc
694 0: 123
695    mno123456
696 0: 123
697\= Expect no match
698    abc12345
699No match
700    wxy123z
701No match
702
703/abc(?C1)xyz/
704    abcxyz
705--->abcxyz
706  1 ^  ^       x
707 0: abcxyz
708    123abcxyz999
709--->123abcxyz999
710  1    ^  ^          x
711 0: abcxyz
712
713/(ab|cd){3,4}/auto_callout
714  ababab
715--->ababab
716 +0 ^          (ab|cd){3,4}
717 +1 ^          a
718 +4 ^          c
719 +2 ^^         b
720 +3 ^ ^        |
721 +1 ^ ^        a
722 +4 ^ ^        c
723 +2 ^  ^       b
724 +3 ^   ^      |
725 +1 ^   ^      a
726 +4 ^   ^      c
727 +2 ^    ^     b
728 +3 ^     ^    |
729+12 ^     ^
730 +1 ^     ^    a
731 +4 ^     ^    c
732 0: ababab
733  abcdabcd
734--->abcdabcd
735 +0 ^            (ab|cd){3,4}
736 +1 ^            a
737 +4 ^            c
738 +2 ^^           b
739 +3 ^ ^          |
740 +1 ^ ^          a
741 +4 ^ ^          c
742 +5 ^  ^         d
743 +6 ^   ^        )
744 +1 ^   ^        a
745 +4 ^   ^        c
746 +2 ^    ^       b
747 +3 ^     ^      |
748+12 ^     ^
749 +1 ^     ^      a
750 +4 ^     ^      c
751 +5 ^      ^     d
752 +6 ^       ^    )
753+12 ^       ^
754 0: abcdabcd
755 1: abcdab
756  abcdcdcdcdcd
757--->abcdcdcdcdcd
758 +0 ^                (ab|cd){3,4}
759 +1 ^                a
760 +4 ^                c
761 +2 ^^               b
762 +3 ^ ^              |
763 +1 ^ ^              a
764 +4 ^ ^              c
765 +5 ^  ^             d
766 +6 ^   ^            )
767 +1 ^   ^            a
768 +4 ^   ^            c
769 +5 ^    ^           d
770 +6 ^     ^          )
771+12 ^     ^
772 +1 ^     ^          a
773 +4 ^     ^          c
774 +5 ^      ^         d
775 +6 ^       ^        )
776+12 ^       ^
777 0: abcdcdcd
778 1: abcdcd
779
780/^abc/
781    abcdef
782 0: abc
783\= Expect no match
784    abcdef\=notbol
785No match
786
787/^(a*|xyz)/
788    bcd
789 0:
790    aaabcd
791 0: aaa
792    xyz
793 0: xyz
794 1:
795    xyz\=notempty
796 0: xyz
797\= Expect no match
798    bcd\=notempty
799No match
800
801/xyz$/
802    xyz
803 0: xyz
804    xyz\n
805 0: xyz
806\= Expect no match
807    xyz\=noteol
808No match
809    xyz\n\=noteol
810No match
811
812/xyz$/m
813    xyz
814 0: xyz
815    xyz\n
816 0: xyz
817    abcxyz\npqr
818 0: xyz
819    abcxyz\npqr\=noteol
820 0: xyz
821    xyz\n\=noteol
822 0: xyz
823\= Expect no match
824    xyz\=noteol
825No match
826
827/\Gabc/
828    abcdef
829 0: abc
830    defabcxyz\=offset=3
831 0: abc
832\= Expect no match
833    defabcxyz
834No match
835
836/^abcdef/
837    ab\=ps
838Partial match: ab
839    abcde\=ps
840Partial match: abcde
841    abcdef\=ps
842 0: abcdef
843\= Expect no match
844    abx\=ps
845No match
846
847/^a{2,4}\d+z/
848    a\=ps
849Partial match: a
850    aa\=ps
851Partial match: aa
852    aa2\=ps
853Partial match: aa2
854    aaa\=ps
855Partial match: aaa
856    aaa23\=ps
857Partial match: aaa23
858    aaaa12345\=ps
859Partial match: aaaa12345
860    aa0z\=ps
861 0: aa0z
862    aaaa4444444444444z\=ps
863 0: aaaa4444444444444z
864\= Expect no match
865    az\=ps
866No match
867    aaaaa\=ps
868No match
869    a56\=ps
870No match
871
872/^abcdef/
873   abc\=ps
874Partial match: abc
875   def\=dfa_restart
876 0: def
877
878/(?<=foo)bar/
879   foob\=ps,offset=2
880Partial match: foob
881               <<<
882   foobar...\=ps,dfa_restart,offset=4
883 0: ar
884   foobar\=offset=2
885 0: bar
886\= Expect no match
887   xyzfo\=ps
888No match
889   obar\=dfa_restart
890No match
891
892/(ab*(cd|ef))+X/
893    lkjhlkjhlkjhlkjhabbbbbbcdaefabbbbbbbefa\=ps,notbol,noteol
894Partial match: abbbbbbcdaefabbbbbbbefa
895    cdabbbbbbbb\=ps,notbol,dfa_restart,noteol
896Partial match: cdabbbbbbbb
897    efabbbbbbbbbbbbbbbb\=ps,notbol,dfa_restart,noteol
898Partial match: efabbbbbbbbbbbbbbbb
899    bbbbbbbbbbbbcdXyasdfadf\=ps,notbol,dfa_restart,noteol
900 0: bbbbbbbbbbbbcdX
901\= Expect no match
902    adfadadaklhlkalkajhlkjahdfasdfasdfladsfjkj\=ps,noteol
903No match
904
905/the quick brown fox/
906    the quick brown fox
907 0: the quick brown fox
908    What do you know about the quick brown fox?
909 0: the quick brown fox
910\= Expect no match
911    The quick brown FOX
912No match
913    What do you know about THE QUICK BROWN FOX?
914No match
915
916/The quick brown fox/i
917    the quick brown fox
918 0: the quick brown fox
919    The quick brown FOX
920 0: The quick brown FOX
921    What do you know about the quick brown fox?
922 0: the quick brown fox
923    What do you know about THE QUICK BROWN FOX?
924 0: THE QUICK BROWN FOX
925
926/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
927    abcd\t\n\r\f\a\e9;\$\\?caxyz
928 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz
929
930/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
931    abxyzpqrrrabbxyyyypqAzz
932 0: abxyzpqrrrabbxyyyypqAzz
933    abxyzpqrrrabbxyyyypqAzz
934 0: abxyzpqrrrabbxyyyypqAzz
935    aabxyzpqrrrabbxyyyypqAzz
936 0: aabxyzpqrrrabbxyyyypqAzz
937    aaabxyzpqrrrabbxyyyypqAzz
938 0: aaabxyzpqrrrabbxyyyypqAzz
939    aaaabxyzpqrrrabbxyyyypqAzz
940 0: aaaabxyzpqrrrabbxyyyypqAzz
941    abcxyzpqrrrabbxyyyypqAzz
942 0: abcxyzpqrrrabbxyyyypqAzz
943    aabcxyzpqrrrabbxyyyypqAzz
944 0: aabcxyzpqrrrabbxyyyypqAzz
945    aaabcxyzpqrrrabbxyyyypAzz
946 0: aaabcxyzpqrrrabbxyyyypAzz
947    aaabcxyzpqrrrabbxyyyypqAzz
948 0: aaabcxyzpqrrrabbxyyyypqAzz
949    aaabcxyzpqrrrabbxyyyypqqAzz
950 0: aaabcxyzpqrrrabbxyyyypqqAzz
951    aaabcxyzpqrrrabbxyyyypqqqAzz
952 0: aaabcxyzpqrrrabbxyyyypqqqAzz
953    aaabcxyzpqrrrabbxyyyypqqqqAzz
954 0: aaabcxyzpqrrrabbxyyyypqqqqAzz
955    aaabcxyzpqrrrabbxyyyypqqqqqAzz
956 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz
957    aaabcxyzpqrrrabbxyyyypqqqqqqAzz
958 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz
959    aaaabcxyzpqrrrabbxyyyypqAzz
960 0: aaaabcxyzpqrrrabbxyyyypqAzz
961    abxyzzpqrrrabbxyyyypqAzz
962 0: abxyzzpqrrrabbxyyyypqAzz
963    aabxyzzzpqrrrabbxyyyypqAzz
964 0: aabxyzzzpqrrrabbxyyyypqAzz
965    aaabxyzzzzpqrrrabbxyyyypqAzz
966 0: aaabxyzzzzpqrrrabbxyyyypqAzz
967    aaaabxyzzzzpqrrrabbxyyyypqAzz
968 0: aaaabxyzzzzpqrrrabbxyyyypqAzz
969    abcxyzzpqrrrabbxyyyypqAzz
970 0: abcxyzzpqrrrabbxyyyypqAzz
971    aabcxyzzzpqrrrabbxyyyypqAzz
972 0: aabcxyzzzpqrrrabbxyyyypqAzz
973    aaabcxyzzzzpqrrrabbxyyyypqAzz
974 0: aaabcxyzzzzpqrrrabbxyyyypqAzz
975    aaaabcxyzzzzpqrrrabbxyyyypqAzz
976 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz
977    aaaabcxyzzzzpqrrrabbbxyyyypqAzz
978 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz
979    aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
980 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
981    aaabcxyzpqrrrabbxyyyypABzz
982 0: aaabcxyzpqrrrabbxyyyypABzz
983    aaabcxyzpqrrrabbxyyyypABBzz
984 0: aaabcxyzpqrrrabbxyyyypABBzz
985    >>>aaabxyzpqrrrabbxyyyypqAzz
986 0: aaabxyzpqrrrabbxyyyypqAzz
987    >aaaabxyzpqrrrabbxyyyypqAzz
988 0: aaaabxyzpqrrrabbxyyyypqAzz
989    >>>>abcxyzpqrrrabbxyyyypqAzz
990 0: abcxyzpqrrrabbxyyyypqAzz
991\= Expect no match
992    abxyzpqrrabbxyyyypqAzz
993No match
994    abxyzpqrrrrabbxyyyypqAzz
995No match
996    abxyzpqrrrabxyyyypqAzz
997No match
998    aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
999No match
1000    aaaabcxyzzzzpqrrrabbbxyyypqAzz
1001No match
1002    aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
1003No match
1004
1005/^(abc){1,2}zz/
1006    abczz
1007 0: abczz
1008    abcabczz
1009 0: abcabczz
1010\= Expect no match
1011    zz
1012No match
1013    abcabcabczz
1014No match
1015    >>abczz
1016No match
1017
1018/^(b+?|a){1,2}?c/
1019    bc
1020 0: bc
1021    bbc
1022 0: bbc
1023    bbbc
1024 0: bbbc
1025    bac
1026 0: bac
1027    bbac
1028 0: bbac
1029    aac
1030 0: aac
1031    abbbbbbbbbbbc
1032 0: abbbbbbbbbbbc
1033    bbbbbbbbbbbac
1034 0: bbbbbbbbbbbac
1035\= Expect no match
1036    aaac
1037No match
1038    abbbbbbbbbbbac
1039No match
1040
1041/^(b+|a){1,2}c/
1042    bc
1043 0: bc
1044    bbc
1045 0: bbc
1046    bbbc
1047 0: bbbc
1048    bac
1049 0: bac
1050    bbac
1051 0: bbac
1052    aac
1053 0: aac
1054    abbbbbbbbbbbc
1055 0: abbbbbbbbbbbc
1056    bbbbbbbbbbbac
1057 0: bbbbbbbbbbbac
1058\= Expect no match
1059    aaac
1060No match
1061    abbbbbbbbbbbac
1062No match
1063
1064/^(b+|a){1,2}?bc/
1065    bbc
1066 0: bbc
1067
1068/^(b*|ba){1,2}?bc/
1069    babc
1070 0: babc
1071    bbabc
1072 0: bbabc
1073    bababc
1074 0: bababc
1075\= Expect no match
1076    bababbc
1077No match
1078    babababc
1079No match
1080
1081/^(ba|b*){1,2}?bc/
1082    babc
1083 0: babc
1084    bbabc
1085 0: bbabc
1086    bababc
1087 0: bababc
1088\= Expect no match
1089    bababbc
1090No match
1091    babababc
1092No match
1093
1094/^\ca\cA\c[\c{\c:/
1095    \x01\x01\e;z
1096 0: \x01\x01\x1b;z
1097
1098/^[ab\]cde]/
1099    athing
1100 0: a
1101    bthing
1102 0: b
1103    ]thing
1104 0: ]
1105    cthing
1106 0: c
1107    dthing
1108 0: d
1109    ething
1110 0: e
1111\= Expect no match
1112    fthing
1113No match
1114    [thing
1115No match
1116    \\thing
1117No match
1118
1119/^[]cde]/
1120    ]thing
1121 0: ]
1122    cthing
1123 0: c
1124    dthing
1125 0: d
1126    ething
1127 0: e
1128\= Expect no match
1129    athing
1130No match
1131    fthing
1132No match
1133
1134/^[^ab\]cde]/
1135    fthing
1136 0: f
1137    [thing
1138 0: [
1139    \\thing
1140 0: \
1141\= Expect no match
1142    athing
1143No match
1144    bthing
1145No match
1146    ]thing
1147No match
1148    cthing
1149No match
1150    dthing
1151No match
1152    ething
1153No match
1154
1155/^[^]cde]/
1156    athing
1157 0: a
1158    fthing
1159 0: f
1160\= Expect no match
1161    ]thing
1162No match
1163    cthing
1164No match
1165    dthing
1166No match
1167    ething
1168No match
1169
1170/^\�/
11711172 0: \x81
1173
1174/^�/
11751176 0: \xff
1177
1178/^[0-9]+$/
1179    0
1180 0: 0
1181    1
1182 0: 1
1183    2
1184 0: 2
1185    3
1186 0: 3
1187    4
1188 0: 4
1189    5
1190 0: 5
1191    6
1192 0: 6
1193    7
1194 0: 7
1195    8
1196 0: 8
1197    9
1198 0: 9
1199    10
1200 0: 10
1201    100
1202 0: 100
1203\= Expect no match
1204    abc
1205No match
1206
1207/^.*nter/
1208    enter
1209 0: enter
1210    inter
1211 0: inter
1212    uponter
1213 0: uponter
1214
1215/^xxx[0-9]+$/
1216    xxx0
1217 0: xxx0
1218    xxx1234
1219 0: xxx1234
1220\= Expect no match
1221    xxx
1222No match
1223
1224/^.+[0-9][0-9][0-9]$/
1225    x123
1226 0: x123
1227    xx123
1228 0: xx123
1229    123456
1230 0: 123456
1231    x1234
1232 0: x1234
1233\= Expect no match
1234    123
1235No match
1236
1237/^.+?[0-9][0-9][0-9]$/
1238    x123
1239 0: x123
1240    xx123
1241 0: xx123
1242    123456
1243 0: 123456
1244    x1234
1245 0: x1234
1246\= Expect no match
1247    123
1248No match
1249
1250/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
1251    abc!pqr=apquxz.ixr.zzz.ac.uk
1252 0: abc!pqr=apquxz.ixr.zzz.ac.uk
1253\= Expect no match
1254    !pqr=apquxz.ixr.zzz.ac.uk
1255No match
1256    abc!=apquxz.ixr.zzz.ac.uk
1257No match
1258    abc!pqr=apquxz:ixr.zzz.ac.uk
1259No match
1260    abc!pqr=apquxz.ixr.zzz.ac.ukk
1261No match
1262
1263/:/
1264    Well, we need a colon: somewhere
1265 0: :
1266\= Expect no match
1267    No match without a colon
1268No match
1269
1270/([\da-f:]+)$/i
1271    0abc
1272 0: 0abc
1273    abc
1274 0: abc
1275    fed
1276 0: fed
1277    E
1278 0: E
1279    ::
1280 0: ::
1281    5f03:12C0::932e
1282 0: 5f03:12C0::932e
1283    fed def
1284 0: def
1285    Any old stuff
1286 0: ff
1287\= Expect no match
1288    0zzz
1289No match
1290    gzzz
1291No match
1292    fed\x20
1293No match
1294    Any old rubbish
1295No match
1296
1297/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
1298    .1.2.3
1299 0: .1.2.3
1300    A.12.123.0
1301 0: A.12.123.0
1302\= Expect no match
1303    .1.2.3333
1304No match
1305    1.2.3
1306No match
1307    1234.2.3
1308No match
1309
1310/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
1311    1 IN SOA non-sp1 non-sp2(
1312 0: 1 IN SOA non-sp1 non-sp2(
1313    1    IN    SOA    non-sp1    non-sp2   (
1314 0: 1    IN    SOA    non-sp1    non-sp2   (
1315\= Expect no match
1316    1IN SOA non-sp1 non-sp2(
1317No match
1318
1319/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
1320    a.
1321 0: a.
1322    Z.
1323 0: Z.
1324    2.
1325 0: 2.
1326    ab-c.pq-r.
1327 0: ab-c.pq-r.
1328    sxk.zzz.ac.uk.
1329 0: sxk.zzz.ac.uk.
1330    x-.y-.
1331 0: x-.y-.
1332\= Expect no match
1333    -abc.peq.
1334No match
1335
1336/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
1337    *.a
1338 0: *.a
1339    *.b0-a
1340 0: *.b0-a
1341    *.c3-b.c
1342 0: *.c3-b.c
1343    *.c-a.b-c
1344 0: *.c-a.b-c
1345\= Expect no match
1346    *.0
1347No match
1348    *.a-
1349No match
1350    *.a-b.c-
1351No match
1352    *.c-a.0-c
1353No match
1354
1355/^(?=ab(de))(abd)(e)/
1356    abde
1357 0: abde
1358
1359/^(?!(ab)de|x)(abd)(f)/
1360    abdf
1361 0: abdf
1362
1363/^(?=(ab(cd)))(ab)/
1364    abcd
1365 0: ab
1366
1367/^[\da-f](\.[\da-f])*$/i
1368    a.b.c.d
1369 0: a.b.c.d
1370    A.B.C.D
1371 0: A.B.C.D
1372    a.b.c.1.2.3.C
1373 0: a.b.c.1.2.3.C
1374
1375/^\".*\"\s*(;.*)?$/
1376    \"1234\"
1377 0: "1234"
1378    \"abcd\" ;
1379 0: "abcd" ;
1380    \"\" ; rhubarb
1381 0: "" ; rhubarb
1382\= Expect no match
1383    \"1234\" : things
1384No match
1385
1386/^$/
1387    \
1388 0:
1389
1390/   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/x
1391    ab c
1392 0: ab c
1393\= Expect no match
1394    abc
1395No match
1396    ab cde
1397No match
1398
1399/(?x)   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/
1400    ab c
1401 0: ab c
1402\= Expect no match
1403    abc
1404No match
1405    ab cde
1406No match
1407
1408/^   a\ b[c ]d       $/x
1409    a bcd
1410 0: a bcd
1411    a b d
1412 0: a b d
1413\= Expect no match
1414    abcd
1415No match
1416    ab d
1417No match
1418
1419/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
1420    abcdefhijklm
1421 0: abcdefhijklm
1422
1423/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
1424    abcdefhijklm
1425 0: abcdefhijklm
1426
1427/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
1428    a+ Z0+\x08\n\x1d\x12
1429 0: a+ Z0+\x08\x0a\x1d\x12
1430
1431/^[.^$|()*+?{,}]+/
1432    .^\$(*+)|{?,?}
1433 0: .^$(*+)|{?,?}
1434
1435/^a*\w/
1436    z
1437 0: z
1438    az
1439 0: az
1440 1: a
1441    aaaz
1442 0: aaaz
1443 1: aaa
1444 2: aa
1445 3: a
1446    a
1447 0: a
1448    aa
1449 0: aa
1450 1: a
1451    aaaa
1452 0: aaaa
1453 1: aaa
1454 2: aa
1455 3: a
1456    a+
1457 0: a
1458    aa+
1459 0: aa
1460 1: a
1461
1462/^a*?\w/
1463    z
1464 0: z
1465    az
1466 0: az
1467 1: a
1468    aaaz
1469 0: aaaz
1470 1: aaa
1471 2: aa
1472 3: a
1473    a
1474 0: a
1475    aa
1476 0: aa
1477 1: a
1478    aaaa
1479 0: aaaa
1480 1: aaa
1481 2: aa
1482 3: a
1483    a+
1484 0: a
1485    aa+
1486 0: aa
1487 1: a
1488
1489/^a+\w/
1490    az
1491 0: az
1492    aaaz
1493 0: aaaz
1494 1: aaa
1495 2: aa
1496    aa
1497 0: aa
1498    aaaa
1499 0: aaaa
1500 1: aaa
1501 2: aa
1502    aa+
1503 0: aa
1504
1505/^a+?\w/
1506    az
1507 0: az
1508    aaaz
1509 0: aaaz
1510 1: aaa
1511 2: aa
1512    aa
1513 0: aa
1514    aaaa
1515 0: aaaa
1516 1: aaa
1517 2: aa
1518    aa+
1519 0: aa
1520
1521/^\d{8}\w{2,}/
1522    1234567890
1523 0: 1234567890
1524    12345678ab
1525 0: 12345678ab
1526    12345678__
1527 0: 12345678__
1528\= Expect no match
1529    1234567
1530No match
1531
1532/^[aeiou\d]{4,5}$/
1533    uoie
1534 0: uoie
1535    1234
1536 0: 1234
1537    12345
1538 0: 12345
1539    aaaaa
1540 0: aaaaa
1541\= Expect no match
1542    123456
1543No match
1544
1545/^[aeiou\d]{4,5}?/
1546    uoie
1547 0: uoie
1548    1234
1549 0: 1234
1550    12345
1551 0: 12345
1552 1: 1234
1553    aaaaa
1554 0: aaaaa
1555 1: aaaa
1556    123456
1557 0: 12345
1558 1: 1234
1559
1560/^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]/
1561    From abcd  Mon Sep 01 12:33:02 1997
1562 0: From abcd  Mon Sep 01 12:33
1563
1564/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
1565    From abcd  Mon Sep 01 12:33:02 1997
1566 0: From abcd  Mon Sep 01 12:33
1567    From abcd  Mon Sep  1 12:33:02 1997
1568 0: From abcd  Mon Sep  1 12:33
1569\= Expect no match
1570    From abcd  Sep 01 12:33:02 1997
1571No match
1572
1573/^12.34/s
1574    12\n34
1575 0: 12\x0a34
1576    12\r34
1577 0: 12\x0d34
1578
1579/\w+(?=\t)/
1580    the quick brown\t fox
1581 0: brown
1582
1583/foo(?!bar)(.*)/
1584    foobar is foolish see?
1585 0: foolish see?
1586
1587/(?:(?!foo)...|^.{0,2})bar(.*)/
1588    foobar crowbar etc
1589 0: rowbar etc
1590    barrel
1591 0: barrel
1592    2barrel
1593 0: 2barrel
1594    A barrel
1595 0: A barrel
1596
1597/^(\D*)(?=\d)(?!123)/
1598    abc456
1599 0: abc
1600\= Expect no match
1601    abc123
1602No match
1603
1604/^1234(?# test newlines
1605  inside)/
1606    1234
1607 0: 1234
1608
1609/^1234 #comment in extended re
1610  /x
1611    1234
1612 0: 1234
1613
1614/#rhubarb
1615  abcd/x
1616    abcd
1617 0: abcd
1618
1619/^abcd#rhubarb/x
1620    abcd
1621 0: abcd
1622
1623/(?!^)abc/
1624    the abc
1625 0: abc
1626\= Expect no match
1627    abc
1628No match
1629
1630/(?=^)abc/
1631    abc
1632 0: abc
1633\= Expect no match
1634    the abc
1635No match
1636
1637/^[ab]{1,3}(ab*|b)/no_auto_possess
1638    aabbbbb
1639 0: aabbbbb
1640 1: aabbbb
1641 2: aabbb
1642 3: aabb
1643 4: aab
1644 5: aa
1645
1646/^[ab]{1,3}?(ab*|b)/no_auto_possess
1647    aabbbbb
1648 0: aabbbbb
1649 1: aabbbb
1650 2: aabbb
1651 3: aabb
1652 4: aab
1653 5: aa
1654
1655/^[ab]{1,3}?(ab*?|b)/no_auto_possess
1656    aabbbbb
1657 0: aabbbbb
1658 1: aabbbb
1659 2: aabbb
1660 3: aabb
1661 4: aab
1662 5: aa
1663
1664/^[ab]{1,3}(ab*?|b)/no_auto_possess
1665    aabbbbb
1666 0: aabbbbb
1667 1: aabbbb
1668 2: aabbb
1669 3: aabb
1670 4: aab
1671 5: aa
1672
1673/  (?: [\040\t] |  \(
1674(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1675\)  )*                          # optional leading comment
1676(?:    (?:
1677[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1678(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1679|
1680" (?:                      # opening quote...
1681[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1682|                     #    or
1683\\ [^\x80-\xff]           #   Escaped something (something != CR)
1684)* "  # closing quote
1685)                    # initial word
1686(?:  (?: [\040\t] |  \(
1687(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1688\)  )*  \.  (?: [\040\t] |  \(
1689(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1690\)  )*   (?:
1691[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1692(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1693|
1694" (?:                      # opening quote...
1695[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1696|                     #    or
1697\\ [^\x80-\xff]           #   Escaped something (something != CR)
1698)* "  # closing quote
1699)  )* # further okay, if led by a period
1700(?: [\040\t] |  \(
1701(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1702\)  )*  @  (?: [\040\t] |  \(
1703(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1704\)  )*    (?:
1705[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1706(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1707|   \[                         # [
1708(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1709\]                        #           ]
1710)                           # initial subdomain
1711(?:                                  #
1712(?: [\040\t] |  \(
1713(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1714\)  )*  \.                        # if led by a period...
1715(?: [\040\t] |  \(
1716(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1717\)  )*   (?:
1718[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1719(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1720|   \[                         # [
1721(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1722\]                        #           ]
1723)                     #   ...further okay
1724)*
1725# address
1726|                     #  or
1727(?:
1728[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1729(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1730|
1731" (?:                      # opening quote...
1732[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1733|                     #    or
1734\\ [^\x80-\xff]           #   Escaped something (something != CR)
1735)* "  # closing quote
1736)             # one word, optionally followed by....
1737(?:
1738[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]  |  # atom and space parts, or...
1739\(
1740(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1741\)       |  # comments, or...
1742
1743" (?:                      # opening quote...
1744[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1745|                     #    or
1746\\ [^\x80-\xff]           #   Escaped something (something != CR)
1747)* "  # closing quote
1748# quoted strings
1749)*
1750<  (?: [\040\t] |  \(
1751(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1752\)  )*                     # leading <
1753(?:  @  (?: [\040\t] |  \(
1754(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1755\)  )*    (?:
1756[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1757(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1758|   \[                         # [
1759(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1760\]                        #           ]
1761)                           # initial subdomain
1762(?:                                  #
1763(?: [\040\t] |  \(
1764(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1765\)  )*  \.                        # if led by a period...
1766(?: [\040\t] |  \(
1767(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1768\)  )*   (?:
1769[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1770(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1771|   \[                         # [
1772(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1773\]                        #           ]
1774)                     #   ...further okay
1775)*
1776
1777(?:  (?: [\040\t] |  \(
1778(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1779\)  )*  ,  (?: [\040\t] |  \(
1780(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1781\)  )*  @  (?: [\040\t] |  \(
1782(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1783\)  )*    (?:
1784[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1785(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1786|   \[                         # [
1787(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1788\]                        #           ]
1789)                           # initial subdomain
1790(?:                                  #
1791(?: [\040\t] |  \(
1792(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1793\)  )*  \.                        # if led by a period...
1794(?: [\040\t] |  \(
1795(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1796\)  )*   (?:
1797[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1798(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1799|   \[                         # [
1800(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1801\]                        #           ]
1802)                     #   ...further okay
1803)*
1804)* # further okay, if led by comma
1805:                                # closing colon
1806(?: [\040\t] |  \(
1807(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1808\)  )*  )? #       optional route
1809(?:
1810[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1811(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1812|
1813" (?:                      # opening quote...
1814[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1815|                     #    or
1816\\ [^\x80-\xff]           #   Escaped something (something != CR)
1817)* "  # closing quote
1818)                    # initial word
1819(?:  (?: [\040\t] |  \(
1820(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1821\)  )*  \.  (?: [\040\t] |  \(
1822(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1823\)  )*   (?:
1824[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1825(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1826|
1827" (?:                      # opening quote...
1828[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1829|                     #    or
1830\\ [^\x80-\xff]           #   Escaped something (something != CR)
1831)* "  # closing quote
1832)  )* # further okay, if led by a period
1833(?: [\040\t] |  \(
1834(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1835\)  )*  @  (?: [\040\t] |  \(
1836(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1837\)  )*    (?:
1838[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1839(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1840|   \[                         # [
1841(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1842\]                        #           ]
1843)                           # initial subdomain
1844(?:                                  #
1845(?: [\040\t] |  \(
1846(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1847\)  )*  \.                        # if led by a period...
1848(?: [\040\t] |  \(
1849(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1850\)  )*   (?:
1851[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1852(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1853|   \[                         # [
1854(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1855\]                        #           ]
1856)                     #   ...further okay
1857)*
1858#       address spec
1859(?: [\040\t] |  \(
1860(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1861\)  )*  > #                  trailing >
1862# name and address
1863)  (?: [\040\t] |  \(
1864(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1865\)  )*                       # optional trailing comment
1866/x
1867    Alan Other <user\@dom.ain>
1868 0: Alan Other <user@dom.ain>
1869    <user\@dom.ain>
1870 0: user@dom.ain
1871 1: user@dom
1872    user\@dom.ain
1873 0: user@dom.ain
1874 1: user@dom
1875    \"A. Other\" <user.1234\@dom.ain> (a comment)
1876 0: "A. Other" <user.1234@dom.ain> (a comment)
1877 1: "A. Other" <user.1234@dom.ain>
1878 2: "A. Other" <user.1234@dom.ain>
1879    A. Other <user.1234\@dom.ain> (a comment)
1880 0:  Other <user.1234@dom.ain> (a comment)
1881 1:  Other <user.1234@dom.ain>
1882 2:  Other <user.1234@dom.ain>
1883    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
1884 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
1885 1: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re
1886    A missing angle <user\@some.where
1887 0: user@some.where
1888 1: user@some
1889\= Expect no match
1890    The quick brown fox
1891No match
1892
1893/[\040\t]*                    # Nab whitespace.
1894(?:
1895\(                              #  (
1896[^\\\x80-\xff\n\015()] *                             #     normal*
1897(?:                                 #       (
1898(?:  \\ [^\x80-\xff]  |
1899\(                            #  (
1900[^\\\x80-\xff\n\015()] *                            #     normal*
1901(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1902\)                           #                       )
1903)    #         special
1904[^\\\x80-\xff\n\015()] *                         #         normal*
1905)*                                  #            )*
1906\)                             #                )
1907[\040\t]* )*    # If comment found, allow more spaces.
1908# optional leading comment
1909(?:
1910(?:
1911[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1912(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1913# Atom
1914|                       #  or
1915"                                     # "
1916[^\\\x80-\xff\n\015"] *                            #   normal
1917(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1918"                                     #        "
1919# Quoted string
1920)
1921[\040\t]*                    # Nab whitespace.
1922(?:
1923\(                              #  (
1924[^\\\x80-\xff\n\015()] *                             #     normal*
1925(?:                                 #       (
1926(?:  \\ [^\x80-\xff]  |
1927\(                            #  (
1928[^\\\x80-\xff\n\015()] *                            #     normal*
1929(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1930\)                           #                       )
1931)    #         special
1932[^\\\x80-\xff\n\015()] *                         #         normal*
1933)*                                  #            )*
1934\)                             #                )
1935[\040\t]* )*    # If comment found, allow more spaces.
1936(?:
1937\.
1938[\040\t]*                    # Nab whitespace.
1939(?:
1940\(                              #  (
1941[^\\\x80-\xff\n\015()] *                             #     normal*
1942(?:                                 #       (
1943(?:  \\ [^\x80-\xff]  |
1944\(                            #  (
1945[^\\\x80-\xff\n\015()] *                            #     normal*
1946(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1947\)                           #                       )
1948)    #         special
1949[^\\\x80-\xff\n\015()] *                         #         normal*
1950)*                                  #            )*
1951\)                             #                )
1952[\040\t]* )*    # If comment found, allow more spaces.
1953(?:
1954[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1955(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1956# Atom
1957|                       #  or
1958"                                     # "
1959[^\\\x80-\xff\n\015"] *                            #   normal
1960(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1961"                                     #        "
1962# Quoted string
1963)
1964[\040\t]*                    # Nab whitespace.
1965(?:
1966\(                              #  (
1967[^\\\x80-\xff\n\015()] *                             #     normal*
1968(?:                                 #       (
1969(?:  \\ [^\x80-\xff]  |
1970\(                            #  (
1971[^\\\x80-\xff\n\015()] *                            #     normal*
1972(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1973\)                           #                       )
1974)    #         special
1975[^\\\x80-\xff\n\015()] *                         #         normal*
1976)*                                  #            )*
1977\)                             #                )
1978[\040\t]* )*    # If comment found, allow more spaces.
1979# additional words
1980)*
1981@
1982[\040\t]*                    # Nab whitespace.
1983(?:
1984\(                              #  (
1985[^\\\x80-\xff\n\015()] *                             #     normal*
1986(?:                                 #       (
1987(?:  \\ [^\x80-\xff]  |
1988\(                            #  (
1989[^\\\x80-\xff\n\015()] *                            #     normal*
1990(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1991\)                           #                       )
1992)    #         special
1993[^\\\x80-\xff\n\015()] *                         #         normal*
1994)*                                  #            )*
1995\)                             #                )
1996[\040\t]* )*    # If comment found, allow more spaces.
1997(?:
1998[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1999(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2000|
2001\[                            # [
2002(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
2003\]                           #           ]
2004)
2005[\040\t]*                    # Nab whitespace.
2006(?:
2007\(                              #  (
2008[^\\\x80-\xff\n\015()] *                             #     normal*
2009(?:                                 #       (
2010(?:  \\ [^\x80-\xff]  |
2011\(                            #  (
2012[^\\\x80-\xff\n\015()] *                            #     normal*
2013(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2014\)                           #                       )
2015)    #         special
2016[^\\\x80-\xff\n\015()] *                         #         normal*
2017)*                                  #            )*
2018\)                             #                )
2019[\040\t]* )*    # If comment found, allow more spaces.
2020# optional trailing comments
2021(?:
2022\.
2023[\040\t]*                    # Nab whitespace.
2024(?:
2025\(                              #  (
2026[^\\\x80-\xff\n\015()] *                             #     normal*
2027(?:                                 #       (
2028(?:  \\ [^\x80-\xff]  |
2029\(                            #  (
2030[^\\\x80-\xff\n\015()] *                            #     normal*
2031(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2032\)                           #                       )
2033)    #         special
2034[^\\\x80-\xff\n\015()] *                         #         normal*
2035)*                                  #            )*
2036\)                             #                )
2037[\040\t]* )*    # If comment found, allow more spaces.
2038(?:
2039[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
2040(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2041|
2042\[                            # [
2043(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
2044\]                           #           ]
2045)
2046[\040\t]*                    # Nab whitespace.
2047(?:
2048\(                              #  (
2049[^\\\x80-\xff\n\015()] *                             #     normal*
2050(?:                                 #       (
2051(?:  \\ [^\x80-\xff]  |
2052\(                            #  (
2053[^\\\x80-\xff\n\015()] *                            #     normal*
2054(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2055\)                           #                       )
2056)    #         special
2057[^\\\x80-\xff\n\015()] *                         #         normal*
2058)*                                  #            )*
2059\)                             #                )
2060[\040\t]* )*    # If comment found, allow more spaces.
2061# optional trailing comments
2062)*
2063# address
2064|                             #  or
2065(?:
2066[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
2067(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2068# Atom
2069|                       #  or
2070"                                     # "
2071[^\\\x80-\xff\n\015"] *                            #   normal
2072(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
2073"                                     #        "
2074# Quoted string
2075)
2076# leading word
2077[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *               # "normal" atoms and or spaces
2078(?:
2079(?:
2080\(                              #  (
2081[^\\\x80-\xff\n\015()] *                             #     normal*
2082(?:                                 #       (
2083(?:  \\ [^\x80-\xff]  |
2084\(                            #  (
2085[^\\\x80-\xff\n\015()] *                            #     normal*
2086(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2087\)                           #                       )
2088)    #         special
2089[^\\\x80-\xff\n\015()] *                         #         normal*
2090)*                                  #            )*
2091\)                             #                )
2092|
2093"                                     # "
2094[^\\\x80-\xff\n\015"] *                            #   normal
2095(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
2096"                                     #        "
2097) # "special" comment or quoted string
2098[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *            #  more "normal"
2099)*
2100<
2101[\040\t]*                    # Nab whitespace.
2102(?:
2103\(                              #  (
2104[^\\\x80-\xff\n\015()] *                             #     normal*
2105(?:                                 #       (
2106(?:  \\ [^\x80-\xff]  |
2107\(                            #  (
2108[^\\\x80-\xff\n\015()] *                            #     normal*
2109(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2110\)                           #                       )
2111)    #         special
2112[^\\\x80-\xff\n\015()] *                         #         normal*
2113)*                                  #            )*
2114\)                             #                )
2115[\040\t]* )*    # If comment found, allow more spaces.
2116# <
2117(?:
2118@
2119[\040\t]*                    # Nab whitespace.
2120(?:
2121\(                              #  (
2122[^\\\x80-\xff\n\015()] *                             #     normal*
2123(?:                                 #       (
2124(?:  \\ [^\x80-\xff]  |
2125\(                            #  (
2126[^\\\x80-\xff\n\015()] *                            #     normal*
2127(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2128\)                           #                       )
2129)    #         special
2130[^\\\x80-\xff\n\015()] *                         #         normal*
2131)*                                  #            )*
2132\)                             #                )
2133[\040\t]* )*    # If comment found, allow more spaces.
2134(?:
2135[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
2136(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2137|
2138\[                            # [
2139(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
2140\]                           #           ]
2141)
2142[\040\t]*                    # Nab whitespace.
2143(?:
2144\(                              #  (
2145[^\\\x80-\xff\n\015()] *                             #     normal*
2146(?:                                 #       (
2147(?:  \\ [^\x80-\xff]  |
2148\(                            #  (
2149[^\\\x80-\xff\n\015()] *                            #     normal*
2150(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2151\)                           #                       )
2152)    #         special
2153[^\\\x80-\xff\n\015()] *                         #         normal*
2154)*                                  #            )*
2155\)                             #                )
2156[\040\t]* )*    # If comment found, allow more spaces.
2157# optional trailing comments
2158(?:
2159\.
2160[\040\t]*                    # Nab whitespace.
2161(?:
2162\(                              #  (
2163[^\\\x80-\xff\n\015()] *                             #     normal*
2164(?:                                 #       (
2165(?:  \\ [^\x80-\xff]  |
2166\(                            #  (
2167[^\\\x80-\xff\n\015()] *                            #     normal*
2168(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2169\)                           #                       )
2170)    #         special
2171[^\\\x80-\xff\n\015()] *                         #         normal*
2172)*                                  #            )*
2173\)                             #                )
2174[\040\t]* )*    # If comment found, allow more spaces.
2175(?:
2176[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
2177(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2178|
2179\[                            # [
2180(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
2181\]                           #           ]
2182)
2183[\040\t]*                    # Nab whitespace.
2184(?:
2185\(                              #  (
2186[^\\\x80-\xff\n\015()] *                             #     normal*
2187(?:                                 #       (
2188(?:  \\ [^\x80-\xff]  |
2189\(                            #  (
2190[^\\\x80-\xff\n\015()] *                            #     normal*
2191(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2192\)                           #                       )
2193)    #         special
2194[^\\\x80-\xff\n\015()] *                         #         normal*
2195)*                                  #            )*
2196\)                             #                )
2197[\040\t]* )*    # If comment found, allow more spaces.
2198# optional trailing comments
2199)*
2200(?: ,
2201[\040\t]*                    # Nab whitespace.
2202(?:
2203\(                              #  (
2204[^\\\x80-\xff\n\015()] *                             #     normal*
2205(?:                                 #       (
2206(?:  \\ [^\x80-\xff]  |
2207\(                            #  (
2208[^\\\x80-\xff\n\015()] *                            #     normal*
2209(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2210\)                           #                       )
2211)    #         special
2212[^\\\x80-\xff\n\015()] *                         #         normal*
2213)*                                  #            )*
2214\)                             #                )
2215[\040\t]* )*    # If comment found, allow more spaces.
2216@
2217[\040\t]*                    # Nab whitespace.
2218(?:
2219\(                              #  (
2220[^\\\x80-\xff\n\015()] *                             #     normal*
2221(?:                                 #       (
2222(?:  \\ [^\x80-\xff]  |
2223\(                            #  (
2224[^\\\x80-\xff\n\015()] *                            #     normal*
2225(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2226\)                           #                       )
2227)    #         special
2228[^\\\x80-\xff\n\015()] *                         #         normal*
2229)*                                  #            )*
2230\)                             #                )
2231[\040\t]* )*    # If comment found, allow more spaces.
2232(?:
2233[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
2234(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2235|
2236\[                            # [
2237(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
2238\]                           #           ]
2239)
2240[\040\t]*                    # Nab whitespace.
2241(?:
2242\(                              #  (
2243[^\\\x80-\xff\n\015()] *                             #     normal*
2244(?:                                 #       (
2245(?:  \\ [^\x80-\xff]  |
2246\(                            #  (
2247[^\\\x80-\xff\n\015()] *                            #     normal*
2248(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2249\)                           #                       )
2250)    #         special
2251[^\\\x80-\xff\n\015()] *                         #         normal*
2252)*                                  #            )*
2253\)                             #                )
2254[\040\t]* )*    # If comment found, allow more spaces.
2255# optional trailing comments
2256(?:
2257\.
2258[\040\t]*                    # Nab whitespace.
2259(?:
2260\(                              #  (
2261[^\\\x80-\xff\n\015()] *                             #     normal*
2262(?:                                 #       (
2263(?:  \\ [^\x80-\xff]  |
2264\(                            #  (
2265[^\\\x80-\xff\n\015()] *                            #     normal*
2266(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2267\)                           #                       )
2268)    #         special
2269[^\\\x80-\xff\n\015()] *                         #         normal*
2270)*                                  #            )*
2271\)                             #                )
2272[\040\t]* )*    # If comment found, allow more spaces.
2273(?:
2274[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
2275(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2276|
2277\[                            # [
2278(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
2279\]                           #           ]
2280)
2281[\040\t]*                    # Nab whitespace.
2282(?:
2283\(                              #  (
2284[^\\\x80-\xff\n\015()] *                             #     normal*
2285(?:                                 #       (
2286(?:  \\ [^\x80-\xff]  |
2287\(                            #  (
2288[^\\\x80-\xff\n\015()] *                            #     normal*
2289(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2290\)                           #                       )
2291)    #         special
2292[^\\\x80-\xff\n\015()] *                         #         normal*
2293)*                                  #            )*
2294\)                             #                )
2295[\040\t]* )*    # If comment found, allow more spaces.
2296# optional trailing comments
2297)*
2298)*  # additional domains
2299:
2300[\040\t]*                    # Nab whitespace.
2301(?:
2302\(                              #  (
2303[^\\\x80-\xff\n\015()] *                             #     normal*
2304(?:                                 #       (
2305(?:  \\ [^\x80-\xff]  |
2306\(                            #  (
2307[^\\\x80-\xff\n\015()] *                            #     normal*
2308(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2309\)                           #                       )
2310)    #         special
2311[^\\\x80-\xff\n\015()] *                         #         normal*
2312)*                                  #            )*
2313\)                             #                )
2314[\040\t]* )*    # If comment found, allow more spaces.
2315# optional trailing comments
2316)?     #       optional route
2317(?:
2318[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
2319(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2320# Atom
2321|                       #  or
2322"                                     # "
2323[^\\\x80-\xff\n\015"] *                            #   normal
2324(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
2325"                                     #        "
2326# Quoted string
2327)
2328[\040\t]*                    # Nab whitespace.
2329(?:
2330\(                              #  (
2331[^\\\x80-\xff\n\015()] *                             #     normal*
2332(?:                                 #       (
2333(?:  \\ [^\x80-\xff]  |
2334\(                            #  (
2335[^\\\x80-\xff\n\015()] *                            #     normal*
2336(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2337\)                           #                       )
2338)    #         special
2339[^\\\x80-\xff\n\015()] *                         #         normal*
2340)*                                  #            )*
2341\)                             #                )
2342[\040\t]* )*    # If comment found, allow more spaces.
2343(?:
2344\.
2345[\040\t]*                    # Nab whitespace.
2346(?:
2347\(                              #  (
2348[^\\\x80-\xff\n\015()] *                             #     normal*
2349(?:                                 #       (
2350(?:  \\ [^\x80-\xff]  |
2351\(                            #  (
2352[^\\\x80-\xff\n\015()] *                            #     normal*
2353(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2354\)                           #                       )
2355)    #         special
2356[^\\\x80-\xff\n\015()] *                         #         normal*
2357)*                                  #            )*
2358\)                             #                )
2359[\040\t]* )*    # If comment found, allow more spaces.
2360(?:
2361[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
2362(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2363# Atom
2364|                       #  or
2365"                                     # "
2366[^\\\x80-\xff\n\015"] *                            #   normal
2367(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
2368"                                     #        "
2369# Quoted string
2370)
2371[\040\t]*                    # Nab whitespace.
2372(?:
2373\(                              #  (
2374[^\\\x80-\xff\n\015()] *                             #     normal*
2375(?:                                 #       (
2376(?:  \\ [^\x80-\xff]  |
2377\(                            #  (
2378[^\\\x80-\xff\n\015()] *                            #     normal*
2379(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2380\)                           #                       )
2381)    #         special
2382[^\\\x80-\xff\n\015()] *                         #         normal*
2383)*                                  #            )*
2384\)                             #                )
2385[\040\t]* )*    # If comment found, allow more spaces.
2386# additional words
2387)*
2388@
2389[\040\t]*                    # Nab whitespace.
2390(?:
2391\(                              #  (
2392[^\\\x80-\xff\n\015()] *                             #     normal*
2393(?:                                 #       (
2394(?:  \\ [^\x80-\xff]  |
2395\(                            #  (
2396[^\\\x80-\xff\n\015()] *                            #     normal*
2397(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2398\)                           #                       )
2399)    #         special
2400[^\\\x80-\xff\n\015()] *                         #         normal*
2401)*                                  #            )*
2402\)                             #                )
2403[\040\t]* )*    # If comment found, allow more spaces.
2404(?:
2405[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
2406(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2407|
2408\[                            # [
2409(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
2410\]                           #           ]
2411)
2412[\040\t]*                    # Nab whitespace.
2413(?:
2414\(                              #  (
2415[^\\\x80-\xff\n\015()] *                             #     normal*
2416(?:                                 #       (
2417(?:  \\ [^\x80-\xff]  |
2418\(                            #  (
2419[^\\\x80-\xff\n\015()] *                            #     normal*
2420(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2421\)                           #                       )
2422)    #         special
2423[^\\\x80-\xff\n\015()] *                         #         normal*
2424)*                                  #            )*
2425\)                             #                )
2426[\040\t]* )*    # If comment found, allow more spaces.
2427# optional trailing comments
2428(?:
2429\.
2430[\040\t]*                    # Nab whitespace.
2431(?:
2432\(                              #  (
2433[^\\\x80-\xff\n\015()] *                             #     normal*
2434(?:                                 #       (
2435(?:  \\ [^\x80-\xff]  |
2436\(                            #  (
2437[^\\\x80-\xff\n\015()] *                            #     normal*
2438(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2439\)                           #                       )
2440)    #         special
2441[^\\\x80-\xff\n\015()] *                         #         normal*
2442)*                                  #            )*
2443\)                             #                )
2444[\040\t]* )*    # If comment found, allow more spaces.
2445(?:
2446[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
2447(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
2448|
2449\[                            # [
2450(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
2451\]                           #           ]
2452)
2453[\040\t]*                    # Nab whitespace.
2454(?:
2455\(                              #  (
2456[^\\\x80-\xff\n\015()] *                             #     normal*
2457(?:                                 #       (
2458(?:  \\ [^\x80-\xff]  |
2459\(                            #  (
2460[^\\\x80-\xff\n\015()] *                            #     normal*
2461(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
2462\)                           #                       )
2463)    #         special
2464[^\\\x80-\xff\n\015()] *                         #         normal*
2465)*                                  #            )*
2466\)                             #                )
2467[\040\t]* )*    # If comment found, allow more spaces.
2468# optional trailing comments
2469)*
2470#       address spec
2471>                    #                 >
2472# name and address
2473)
2474/x
2475    Alan Other <user\@dom.ain>
2476 0: Alan Other <user@dom.ain>
2477    <user\@dom.ain>
2478 0: user@dom.ain
2479 1: user@dom
2480    user\@dom.ain
2481 0: user@dom.ain
2482 1: user@dom
2483    \"A. Other\" <user.1234\@dom.ain> (a comment)
2484 0: "A. Other" <user.1234@dom.ain>
2485    A. Other <user.1234\@dom.ain> (a comment)
2486 0:  Other <user.1234@dom.ain>
2487    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
2488 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
2489 1: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re
2490    A missing angle <user\@some.where
2491 0: user@some.where
2492 1: user@some
2493\= Expect no match
2494    The quick brown fox
2495No match
2496
2497/abc\0def\00pqr\000xyz\0000AB/
2498    abc\0def\00pqr\000xyz\0000AB
2499 0: abc\x00def\x00pqr\x00xyz\x000AB
2500    abc456 abc\0def\00pqr\000xyz\0000ABCDE
2501 0: abc\x00def\x00pqr\x00xyz\x000AB
2502
2503/abc\x0def\x00pqr\x000xyz\x0000AB/
2504    abc\x0def\x00pqr\x000xyz\x0000AB
2505 0: abc\x0def\x00pqr\x000xyz\x0000AB
2506    abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
2507 0: abc\x0def\x00pqr\x000xyz\x0000AB
2508
2509/^[\000-\037]/
2510    \0A
2511 0: \x00
2512    \01B
2513 0: \x01
2514    \037C
2515 0: \x1f
2516
2517/\0*/
2518    \0\0\0\0
2519 0: \x00\x00\x00\x00
2520
2521/A\x0{2,3}Z/
2522    The A\x0\x0Z
2523 0: A\x00\x00Z
2524    An A\0\x0\0Z
2525 0: A\x00\x00\x00Z
2526\= Expect no match
2527    A\0Z
2528No match
2529    A\0\x0\0\x0Z
2530No match
2531
2532/^\s/
2533    \040abc
2534 0:
2535    \x0cabc
2536 0: \x0c
2537    \nabc
2538 0: \x0a
2539    \rabc
2540 0: \x0d
2541    \tabc
2542 0: \x09
2543\= Expect no match
2544    abc
2545No match
2546
2547/^a	b
2548      c/x
2549    abc
2550 0: abc
2551
2552/ab{1,3}bc/
2553    abbbbc
2554 0: abbbbc
2555    abbbc
2556 0: abbbc
2557    abbc
2558 0: abbc
2559\= Expect no match
2560    abc
2561No match
2562    abbbbbc
2563No match
2564
2565/([^.]*)\.([^:]*):[T ]+(.*)/
2566    track1.title:TBlah blah blah
2567 0: track1.title:TBlah blah blah
2568
2569/([^.]*)\.([^:]*):[T ]+(.*)/i
2570    track1.title:TBlah blah blah
2571 0: track1.title:TBlah blah blah
2572
2573/([^.]*)\.([^:]*):[t ]+(.*)/i
2574    track1.title:TBlah blah blah
2575 0: track1.title:TBlah blah blah
2576
2577/^[W-c]+$/
2578    WXY_^abc
2579 0: WXY_^abc
2580\= Expect no match
2581    wxy
2582No match
2583
2584/^[W-c]+$/i
2585    WXY_^abc
2586 0: WXY_^abc
2587    wxy_^ABC
2588 0: wxy_^ABC
2589
2590/^[\x3f-\x5F]+$/i
2591    WXY_^abc
2592 0: WXY_^abc
2593    wxy_^ABC
2594 0: wxy_^ABC
2595
2596/^abc$/m
2597    abc
2598 0: abc
2599    qqq\nabc
2600 0: abc
2601    abc\nzzz
2602 0: abc
2603    qqq\nabc\nzzz
2604 0: abc
2605
2606/^abc$/
2607    abc
2608 0: abc
2609\= Expect no match
2610    qqq\nabc
2611No match
2612    abc\nzzz
2613No match
2614    qqq\nabc\nzzz
2615No match
2616
2617/\Aabc\Z/m
2618    abc
2619 0: abc
2620    abc\n
2621 0: abc
2622\= Expect no match
2623    qqq\nabc
2624No match
2625    abc\nzzz
2626No match
2627    qqq\nabc\nzzz
2628No match
2629
2630/\A(.)*\Z/s
2631    abc\ndef
2632 0: abc\x0adef
2633
2634/\A(.)*\Z/m
2635\= Expect no match
2636    abc\ndef
2637No match
2638
2639/(?:b)|(?::+)/
2640    b::c
2641 0: b
2642    c::b
2643 0: ::
2644
2645/[-az]+/
2646    az-
2647 0: az-
2648\= Expect no match
2649    b
2650No match
2651
2652/[az-]+/
2653    za-
2654 0: za-
2655\= Expect no match
2656    b
2657No match
2658
2659/[a\-z]+/
2660    a-z
2661 0: a-z
2662\= Expect no match
2663    b
2664No match
2665
2666/[a-z]+/
2667    abcdxyz
2668 0: abcdxyz
2669
2670/[\d-]+/
2671    12-34
2672 0: 12-34
2673\= Expect no match
2674    aaa
2675No match
2676
2677/[\d-z]+/
2678    12-34z
2679 0: 12-34z
2680\= Expect no match
2681    aaa
2682No match
2683
2684/\x5c/
2685    \\
2686 0: \
2687
2688/\x20Z/
2689    the Zoo
2690 0:  Z
2691\= Expect no match
2692    Zulu
2693No match
2694
2695/ab{3cd/
2696    ab{3cd
2697 0: ab{3cd
2698
2699/ab{3,cd/
2700    ab{3,cd
2701 0: ab{3,cd
2702
2703/ab{3,4a}cd/
2704    ab{3,4a}cd
2705 0: ab{3,4a}cd
2706
2707/{4,5a}bc/
2708    {4,5a}bc
2709 0: {4,5a}bc
2710
2711/^a.b/newline=lf
2712    a\rb
2713 0: a\x0db
2714\= Expect no match
2715    a\nb
2716No match
2717
2718/abc$/
2719    abc
2720 0: abc
2721    abc\n
2722 0: abc
2723\= Expect no match
2724    abc\ndef
2725No match
2726
2727/(abc)\123/
2728    abc\x53
2729 0: abcS
2730
2731/(abc)\223/
2732    abc\x93
2733 0: abc\x93
2734
2735/(abc)\323/
2736    abc\xd3
2737 0: abc\xd3
2738
2739/(abc)\100/
2740    abc\x40
2741 0: abc@
2742    abc\100
2743 0: abc@
2744
2745/(abc)\1000/
2746    abc\x400
2747 0: abc@0
2748    abc\x40\x30
2749 0: abc@0
2750    abc\1000
2751 0: abc@0
2752    abc\100\x30
2753 0: abc@0
2754    abc\100\060
2755 0: abc@0
2756    abc\100\60
2757 0: abc@0
2758
2759/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
2760    abcdefghijk\12S
2761 0: abcdefghijk\x0aS
2762
2763/a{0}bc/
2764    bc
2765 0: bc
2766
2767/(a|(bc)){0,0}?xyz/
2768    xyz
2769 0: xyz
2770
2771/abc[\10]de/
2772    abc\010de
2773 0: abc\x08de
2774
2775/abc[\1]de/
2776    abc\1de
2777 0: abc\x01de
2778
2779/(abc)[\1]de/
2780    abc\1de
2781 0: abc\x01de
2782
2783/(?s)a.b/
2784    a\nb
2785 0: a\x0ab
2786
2787/^([^a])([^\b])([^c]*)([^d]{3,4})/
2788    baNOTccccd
2789 0: baNOTcccc
2790 1: baNOTccc
2791 2: baNOTcc
2792 3: baNOTc
2793    baNOTcccd
2794 0: baNOTccc
2795 1: baNOTcc
2796 2: baNOTc
2797    baNOTccd
2798 0: baNOTcc
2799 1: baNOTc
2800    bacccd
2801 0: baccc
2802\= Expect no match
2803    anything
2804No match
2805    b\bc
2806No match
2807    baccd
2808No match
2809
2810/[^a]/
2811    Abc
2812 0: A
2813
2814/[^a]/i
2815    Abc
2816 0: b
2817
2818/[^a]+/
2819    AAAaAbc
2820 0: AAA
2821
2822/[^a]+/i
2823    AAAaAbc
2824 0: bc
2825
2826/[^a]+/
2827    bbb\nccc
2828 0: bbb\x0accc
2829
2830/[^k]$/
2831    abc
2832 0: c
2833\= Expect no match
2834    abk
2835No match
2836
2837/[^k]{2,3}$/
2838    abc
2839 0: abc
2840    kbc
2841 0: bc
2842    kabc
2843 0: abc
2844\= Expect no match
2845    abk
2846No match
2847    akb
2848No match
2849    akk
2850No match
2851
2852/^\d{8,}\@.+[^k]$/
2853    12345678\@a.b.c.d
2854 0: 12345678@a.b.c.d
2855    123456789\@x.y.z
2856 0: 123456789@x.y.z
2857\= Expect no match
2858    12345678\@x.y.uk
2859No match
2860    1234567\@a.b.c.d
2861No match
2862
2863/[^a]/
2864    aaaabcd
2865 0: b
2866    aaAabcd
2867 0: A
2868
2869/[^a]/i
2870    aaaabcd
2871 0: b
2872    aaAabcd
2873 0: b
2874
2875/[^az]/
2876    aaaabcd
2877 0: b
2878    aaAabcd
2879 0: A
2880
2881/[^az]/i
2882    aaaabcd
2883 0: b
2884    aaAabcd
2885 0: b
2886
2887/\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/
2888 \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
2889 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
2890
2891/P[^*]TAIRE[^*]{1,6}?LL/
2892    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2893 0: PSTAIREISLL
2894
2895/P[^*]TAIRE[^*]{1,}?LL/
2896    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2897 0: PSTAIREISLL
2898
2899/(\.\d\d[1-9]?)\d+/
2900    1.230003938
2901 0: .230003938
2902    1.875000282
2903 0: .875000282
2904    1.235
2905 0: .235
2906
2907/(\.\d\d((?=0)|\d(?=\d)))/
2908    1.230003938
2909 0: .230
2910 1: .23
2911    1.875000282
2912 0: .875
2913\= Expect no match
2914    1.235
2915No match
2916
2917/a(?)b/
2918    ab
2919 0: ab
2920
2921/\b(foo)\s+(\w+)/i
2922    Food is on the foo table
2923 0: foo table
2924
2925/foo(.*)bar/
2926    The food is under the bar in the barn.
2927 0: food is under the bar in the bar
2928 1: food is under the bar
2929
2930/foo(.*?)bar/
2931    The food is under the bar in the barn.
2932 0: food is under the bar in the bar
2933 1: food is under the bar
2934
2935/(.*)(\d*)/no_auto_possess
2936    I have 2 numbers: 53147
2937Matched, but offsets vector is too small to show all matches
2938 0: I have 2 numbers: 53147
2939 1: I have 2 numbers: 5314
2940 2: I have 2 numbers: 531
2941 3: I have 2 numbers: 53
2942 4: I have 2 numbers: 5
2943 5: I have 2 numbers:
2944 6: I have 2 numbers:
2945 7: I have 2 numbers
2946 8: I have 2 number
2947 9: I have 2 numbe
294810: I have 2 numb
294911: I have 2 num
295012: I have 2 nu
295113: I have 2 n
295214: I have 2
2953
2954/(.*)(\d+)/
2955    I have 2 numbers: 53147
2956 0: I have 2 numbers: 53147
2957 1: I have 2
2958
2959/(.*?)(\d*)/no_auto_possess
2960    I have 2 numbers: 53147
2961Matched, but offsets vector is too small to show all matches
2962 0: I have 2 numbers: 53147
2963 1: I have 2 numbers: 5314
2964 2: I have 2 numbers: 531
2965 3: I have 2 numbers: 53
2966 4: I have 2 numbers: 5
2967 5: I have 2 numbers:
2968 6: I have 2 numbers:
2969 7: I have 2 numbers
2970 8: I have 2 number
2971 9: I have 2 numbe
297210: I have 2 numb
297311: I have 2 num
297412: I have 2 nu
297513: I have 2 n
297614: I have 2
2977
2978/(.*?)(\d+)/
2979    I have 2 numbers: 53147
2980 0: I have 2 numbers: 53147
2981 1: I have 2
2982
2983/(.*)(\d+)$/
2984    I have 2 numbers: 53147
2985 0: I have 2 numbers: 53147
2986
2987/(.*?)(\d+)$/
2988    I have 2 numbers: 53147
2989 0: I have 2 numbers: 53147
2990
2991/(.*)\b(\d+)$/
2992    I have 2 numbers: 53147
2993 0: I have 2 numbers: 53147
2994
2995/(.*\D)(\d+)$/
2996    I have 2 numbers: 53147
2997 0: I have 2 numbers: 53147
2998
2999/^\D*(?!123)/
3000    ABC123
3001 0: AB
3002 1: A
3003 2:
3004
3005/^(\D*)(?=\d)(?!123)/
3006    ABC445
3007 0: ABC
3008\= Expect no match
3009    ABC123
3010No match
3011
3012/^[W-]46]/
3013    W46]789
3014 0: W46]
3015    -46]789
3016 0: -46]
3017\= Expect no match
3018    Wall
3019No match
3020    Zebra
3021No match
3022    42
3023No match
3024    [abcd]
3025No match
3026    ]abcd[
3027No match
3028
3029/^[W-\]46]/
3030    W46]789
3031 0: W
3032    Wall
3033 0: W
3034    Zebra
3035 0: Z
3036    Xylophone
3037 0: X
3038    42
3039 0: 4
3040    [abcd]
3041 0: [
3042    ]abcd[
3043 0: ]
3044    \\backslash
3045 0: \
3046\= Expect no match
3047    -46]789
3048No match
3049    well
3050No match
3051
3052/\d\d\/\d\d\/\d\d\d\d/
3053    01/01/2000
3054 0: 01/01/2000
3055
3056/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
3057  word cat dog elephant mussel cow horse canary baboon snake shark otherword
3058 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
3059\= Expect no match
3060  word cat dog elephant mussel cow horse canary baboon snake shark
3061No match
3062
3063/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
3064\= Expect no match
3065  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
3066No match
3067
3068/^(a){0,0}/
3069    bcd
3070 0:
3071    abc
3072 0:
3073    aab
3074 0:
3075
3076/^(a){0,1}/
3077    bcd
3078 0:
3079    abc
3080 0: a
3081 1:
3082    aab
3083 0: a
3084 1:
3085
3086/^(a){0,2}/
3087    bcd
3088 0:
3089    abc
3090 0: a
3091 1:
3092    aab
3093 0: aa
3094 1: a
3095 2:
3096
3097/^(a){0,3}/
3098    bcd
3099 0:
3100    abc
3101 0: a
3102 1:
3103    aab
3104 0: aa
3105 1: a
3106 2:
3107    aaa
3108 0: aaa
3109 1: aa
3110 2: a
3111 3:
3112
3113/^(a){0,}/
3114    bcd
3115 0:
3116    abc
3117 0: a
3118 1:
3119    aab
3120 0: aa
3121 1: a
3122 2:
3123    aaa
3124 0: aaa
3125 1: aa
3126 2: a
3127 3:
3128    aaaaaaaa
3129 0: aaaaaaaa
3130 1: aaaaaaa
3131 2: aaaaaa
3132 3: aaaaa
3133 4: aaaa
3134 5: aaa
3135 6: aa
3136 7: a
3137 8:
3138
3139/^(a){1,1}/
3140    abc
3141 0: a
3142    aab
3143 0: a
3144\= Expect no match
3145    bcd
3146No match
3147
3148/^(a){1,2}/
3149    abc
3150 0: a
3151    aab
3152 0: aa
3153 1: a
3154\= Expect no match
3155    bcd
3156No match
3157
3158/^(a){1,3}/
3159    abc
3160 0: a
3161    aab
3162 0: aa
3163 1: a
3164    aaa
3165 0: aaa
3166 1: aa
3167 2: a
3168\= Expect no match
3169    bcd
3170No match
3171
3172/^(a){1,}/
3173    abc
3174 0: a
3175    aab
3176 0: aa
3177 1: a
3178    aaa
3179 0: aaa
3180 1: aa
3181 2: a
3182    aaaaaaaa
3183 0: aaaaaaaa
3184 1: aaaaaaa
3185 2: aaaaaa
3186 3: aaaaa
3187 4: aaaa
3188 5: aaa
3189 6: aa
3190 7: a
3191\= Expect no match
3192    bcd
3193No match
3194
3195/.*\.gif/
3196    borfle\nbib.gif\nno
3197 0: bib.gif
3198
3199/.{0,}\.gif/
3200    borfle\nbib.gif\nno
3201 0: bib.gif
3202
3203/.*\.gif/m
3204    borfle\nbib.gif\nno
3205 0: bib.gif
3206
3207/.*\.gif/s
3208    borfle\nbib.gif\nno
3209 0: borfle\x0abib.gif
3210
3211/.*\.gif/ms
3212    borfle\nbib.gif\nno
3213 0: borfle\x0abib.gif
3214
3215/.*$/
3216    borfle\nbib.gif\nno
3217 0: no
3218
3219/.*$/m
3220    borfle\nbib.gif\nno
3221 0: borfle
3222
3223/.*$/s
3224    borfle\nbib.gif\nno
3225 0: borfle\x0abib.gif\x0ano
3226
3227/.*$/ms
3228    borfle\nbib.gif\nno
3229 0: borfle\x0abib.gif\x0ano
3230 1: borfle\x0abib.gif
3231 2: borfle
3232
3233/.*$/
3234    borfle\nbib.gif\nno\n
3235 0: no
3236
3237/.*$/m
3238    borfle\nbib.gif\nno\n
3239 0: borfle
3240
3241/.*$/s
3242    borfle\nbib.gif\nno\n
3243 0: borfle\x0abib.gif\x0ano\x0a
3244 1: borfle\x0abib.gif\x0ano
3245
3246/.*$/ms
3247    borfle\nbib.gif\nno\n
3248 0: borfle\x0abib.gif\x0ano\x0a
3249 1: borfle\x0abib.gif\x0ano
3250 2: borfle\x0abib.gif
3251 3: borfle
3252
3253/(.*X|^B)/
3254    abcde\n1234Xyz
3255 0: 1234X
3256    BarFoo
3257 0: B
3258\= Expect no match
3259    abcde\nBar
3260No match
3261
3262/(.*X|^B)/m
3263    abcde\n1234Xyz
3264 0: 1234X
3265    BarFoo
3266 0: B
3267    abcde\nBar
3268 0: B
3269
3270/(.*X|^B)/s
3271    abcde\n1234Xyz
3272 0: abcde\x0a1234X
3273    BarFoo
3274 0: B
3275\= Expect no match
3276    abcde\nBar
3277No match
3278
3279/(.*X|^B)/ms
3280    abcde\n1234Xyz
3281 0: abcde\x0a1234X
3282    BarFoo
3283 0: B
3284    abcde\nBar
3285 0: B
3286
3287/(?s)(.*X|^B)/
3288    abcde\n1234Xyz
3289 0: abcde\x0a1234X
3290    BarFoo
3291 0: B
3292\= Expect no match
3293    abcde\nBar
3294No match
3295
3296/(?s:.*X|^B)/
3297    abcde\n1234Xyz
3298 0: abcde\x0a1234X
3299    BarFoo
3300 0: B
3301\= Expect no match
3302    abcde\nBar
3303No match
3304
3305/^.*B/
3306\= Expect no match
3307    abc\nB
3308No match
3309
3310/(?s)^.*B/
3311    abc\nB
3312 0: abc\x0aB
3313
3314/(?m)^.*B/
3315    abc\nB
3316 0: B
3317
3318/(?ms)^.*B/
3319    abc\nB
3320 0: abc\x0aB
3321
3322/(?ms)^B/
3323    abc\nB
3324 0: B
3325
3326/(?s)B$/
3327    B\n
3328 0: B
3329
3330/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
3331    123456654321
3332 0: 123456654321
3333
3334/^\d\d\d\d\d\d\d\d\d\d\d\d/
3335    123456654321
3336 0: 123456654321
3337
3338/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
3339    123456654321
3340 0: 123456654321
3341
3342/^[abc]{12}/
3343    abcabcabcabc
3344 0: abcabcabcabc
3345
3346/^[a-c]{12}/
3347    abcabcabcabc
3348 0: abcabcabcabc
3349
3350/^(a|b|c){12}/
3351    abcabcabcabc
3352 0: abcabcabcabc
3353
3354/^[abcdefghijklmnopqrstuvwxy0123456789]/
3355    n
3356 0: n
3357\= Expect no match
3358    z
3359No match
3360
3361/abcde{0,0}/
3362    abcd
3363 0: abcd
3364\= Expect no match
3365    abce
3366No match
3367
3368/ab[cd]{0,0}e/
3369    abe
3370 0: abe
3371\= Expect no match
3372    abcde
3373No match
3374
3375/ab(c){0,0}d/
3376    abd
3377 0: abd
3378\= Expect no match
3379    abcd
3380No match
3381
3382/a(b*)/
3383    a
3384 0: a
3385    ab
3386 0: ab
3387    abbbb
3388 0: abbbb
3389\= Expect no match
3390    bbbbb
3391No match
3392
3393/ab\d{0}e/
3394    abe
3395 0: abe
3396\= Expect no match
3397    ab1e
3398No match
3399
3400/"([^\\"]+|\\.)*"/
3401    the \"quick\" brown fox
3402 0: "quick"
3403    \"the \\\"quick\\\" brown fox\"
3404 0: "the \"quick\" brown fox"
3405
3406/.*?/g,aftertext
3407    abc
3408 0: abc
3409 0+
3410 1: ab
3411 2: a
3412 3:
3413 0:
3414 0+
3415
3416/\b/g,aftertext
3417    abc
3418 0:
3419 0+ abc
3420 0:
3421 0+
3422
3423/\b/g,aftertext
3424    abc
3425 0:
3426 0+ abc
3427 0:
3428 0+
3429
3430//g
3431    abc
3432 0:
3433 0:
3434 0:
3435 0:
3436
3437/<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
3438  <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>
3439 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>
3440
3441/a[^a]b/
3442    acb
3443 0: acb
3444    a\nb
3445 0: a\x0ab
3446
3447/a.b/
3448    acb
3449 0: acb
3450\= Expect no match
3451    a\nb
3452No match
3453
3454/a[^a]b/s
3455    acb
3456 0: acb
3457    a\nb
3458 0: a\x0ab
3459
3460/a.b/s
3461    acb
3462 0: acb
3463    a\nb
3464 0: a\x0ab
3465
3466/^(b+?|a){1,2}?c/
3467    bac
3468 0: bac
3469    bbac
3470 0: bbac
3471    bbbac
3472 0: bbbac
3473    bbbbac
3474 0: bbbbac
3475    bbbbbac
3476 0: bbbbbac
3477
3478/^(b+|a){1,2}?c/
3479    bac
3480 0: bac
3481    bbac
3482 0: bbac
3483    bbbac
3484 0: bbbac
3485    bbbbac
3486 0: bbbbac
3487    bbbbbac
3488 0: bbbbbac
3489
3490/(?!\A)x/m
3491    a\bx\n
3492 0: x
3493\= Expect no match
3494    x\nb\n
3495No match
3496
3497/\x0{ab}/
3498    \0{ab}
3499 0: \x00{ab}
3500
3501/(A|B)*?CD/
3502    CD
3503 0: CD
3504
3505/(A|B)*CD/
3506    CD
3507 0: CD
3508
3509/(?<!bar)foo/
3510    foo
3511 0: foo
3512    catfood
3513 0: foo
3514    arfootle
3515 0: foo
3516    rfoosh
3517 0: foo
3518\= Expect no match
3519    barfoo
3520No match
3521    towbarfoo
3522No match
3523
3524/\w{3}(?<!bar)foo/
3525    catfood
3526 0: catfoo
3527\= Expect no match
3528    foo
3529No match
3530    barfoo
3531No match
3532    towbarfoo
3533No match
3534
3535/(?<=(foo)a)bar/
3536    fooabar
3537 0: bar
3538\= Expect no match
3539    bar
3540No match
3541    foobbar
3542No match
3543
3544/\Aabc\z/m
3545    abc
3546 0: abc
3547\= Expect no match
3548    abc\n
3549No match
3550    qqq\nabc
3551No match
3552    abc\nzzz
3553No match
3554    qqq\nabc\nzzz
3555No match
3556
3557"(?>.*/)foo"
3558\= Expect no match
3559    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
3560No match
3561
3562"(?>.*/)foo"
3563    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
3564 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
3565
3566/(?>(\.\d\d[1-9]?))\d+/
3567    1.230003938
3568 0: .230003938
3569    1.875000282
3570 0: .875000282
3571\= Expect no match
3572    1.235
3573No match
3574
3575/^((?>\w+)|(?>\s+))*$/
3576    now is the time for all good men to come to the aid of the party
3577 0: now is the time for all good men to come to the aid of the party
3578\= Expect no match
3579    this is not a line with only words and spaces!
3580No match
3581
3582/(\d+)(\w)/
3583    12345a
3584 0: 12345a
3585 1: 12345
3586 2: 1234
3587 3: 123
3588 4: 12
3589    12345+
3590 0: 12345
3591 1: 1234
3592 2: 123
3593 3: 12
3594
3595/((?>\d+))(\w)/
3596    12345a
3597 0: 12345a
3598\= Expect no match
3599    12345+
3600No match
3601
3602/(?>a+)b/
3603    aaab
3604 0: aaab
3605
3606/((?>a+)b)/
3607    aaab
3608 0: aaab
3609
3610/(?>(a+))b/
3611    aaab
3612 0: aaab
3613
3614/(?>b)+/
3615    aaabbbccc
3616 0: bbb
3617 1: bb
3618 2: b
3619
3620/(?>a+|b+|c+)*c/
3621    aaabbbbccccd
3622 0: aaabbbbcccc
3623 1: aaabbbbc
3624
3625/(a+|b+|c+)*c/
3626    aaabbbbccccd
3627 0: aaabbbbcccc
3628 1: aaabbbbccc
3629 2: aaabbbbcc
3630 3: aaabbbbc
3631
3632/((?>[^()]+)|\([^()]*\))+/
3633    ((abc(ade)ufh()()x
3634 0: abc(ade)ufh()()x
3635 1: abc(ade)ufh()()
3636 2: abc(ade)ufh()
3637 3: abc(ade)ufh
3638 4: abc(ade)
3639 5: abc
3640
3641/\(((?>[^()]+)|\([^()]+\))+\)/
3642    (abc)
3643 0: (abc)
3644    (abc(def)xyz)
3645 0: (abc(def)xyz)
3646\= Expect no match
3647    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3648No match
3649
3650/a(?-i)b/i
3651    ab
3652 0: ab
3653    Ab
3654 0: Ab
3655\= Expect no match
3656    aB
3657No match
3658    AB
3659No match
3660
3661/(a (?x)b c)d e/
3662    a bcd e
3663 0: a bcd e
3664\= Expect no match
3665    a b cd e
3666No match
3667    abcd e
3668No match
3669    a bcde
3670No match
3671
3672/(a b(?x)c d (?-x)e f)/
3673    a bcde f
3674 0: a bcde f
3675\= Expect no match
3676    abcdef
3677No match
3678
3679/(a(?i)b)c/
3680    abc
3681 0: abc
3682    aBc
3683 0: aBc
3684\= Expect no match
3685    abC
3686No match
3687    aBC
3688No match
3689    Abc
3690No match
3691    ABc
3692No match
3693    ABC
3694No match
3695    AbC
3696No match
3697
3698/a(?i:b)c/
3699    abc
3700 0: abc
3701    aBc
3702 0: aBc
3703\= Expect no match
3704    ABC
3705No match
3706    abC
3707No match
3708    aBC
3709No match
3710
3711/a(?i:b)*c/
3712    aBc
3713 0: aBc
3714    aBBc
3715 0: aBBc
3716\= Expect no match
3717    aBC
3718No match
3719    aBBC
3720No match
3721
3722/a(?=b(?i)c)\w\wd/
3723    abcd
3724 0: abcd
3725    abCd
3726 0: abCd
3727\= Expect no match
3728    aBCd
3729No match
3730    abcD
3731No match
3732
3733/(?s-i:more.*than).*million/i
3734    more than million
3735 0: more than million
3736    more than MILLION
3737 0: more than MILLION
3738    more \n than Million
3739 0: more \x0a than Million
3740\= Expect no match
3741    MORE THAN MILLION
3742No match
3743    more \n than \n million
3744No match
3745
3746/(?:(?s-i)more.*than).*million/i
3747    more than million
3748 0: more than million
3749    more than MILLION
3750 0: more than MILLION
3751    more \n than Million
3752 0: more \x0a than Million
3753\= Expect no match
3754    MORE THAN MILLION
3755No match
3756    more \n than \n million
3757No match
3758
3759/(?>a(?i)b+)+c/
3760    abc
3761 0: abc
3762    aBbc
3763 0: aBbc
3764    aBBc
3765 0: aBBc
3766\= Expect no match
3767    Abc
3768No match
3769    abAb
3770No match
3771    abbC
3772No match
3773
3774/(?=a(?i)b)\w\wc/
3775    abc
3776 0: abc
3777    aBc
3778 0: aBc
3779\= Expect no match
3780    Ab
3781No match
3782    abC
3783No match
3784    aBC
3785No match
3786
3787/(?<=a(?i)b)(\w\w)c/
3788    abxxc
3789 0: xxc
3790    aBxxc
3791 0: xxc
3792\= Expect no match
3793    Abxxc
3794No match
3795    ABxxc
3796No match
3797    abxxC
3798No match
3799
3800/^(?(?=abc)\w{3}:|\d\d)$/
3801    abc:
3802 0: abc:
3803    12
3804 0: 12
3805\= Expect no match
3806    123
3807No match
3808    xyz
3809No match
3810
3811/^(?(?!abc)\d\d|\w{3}:)$/
3812    abc:
3813 0: abc:
3814    12
3815 0: 12
3816\= Expect no match
3817    123
3818No match
3819    xyz
3820No match
3821
3822/(?(?<=foo)bar|cat)/
3823    foobar
3824 0: bar
3825    cat
3826 0: cat
3827    fcat
3828 0: cat
3829    focat
3830 0: cat
3831\= Expect no match
3832    foocat
3833No match
3834
3835/(?(?<!foo)cat|bar)/
3836    foobar
3837 0: bar
3838    cat
3839 0: cat
3840    fcat
3841 0: cat
3842    focat
3843 0: cat
3844\= Expect no match
3845    foocat
3846No match
3847
3848/(?>a*)*/
3849    a
3850 0: a
3851 1:
3852    aa
3853 0: aa
3854 1:
3855    aaaa
3856 0: aaaa
3857 1:
3858
3859/(abc|)+/
3860    abc
3861 0: abc
3862 1:
3863    abcabc
3864 0: abcabc
3865 1: abc
3866 2:
3867    abcabcabc
3868 0: abcabcabc
3869 1: abcabc
3870 2: abc
3871 3:
3872    xyz
3873 0:
3874
3875/([a]*)*/
3876    a
3877 0: a
3878 1:
3879    aaaaa
3880 0: aaaaa
3881 1: aaaa
3882 2: aaa
3883 3: aa
3884 4: a
3885 5:
3886
3887/([ab]*)*/
3888    a
3889 0: a
3890 1:
3891    b
3892 0: b
3893 1:
3894    ababab
3895 0: ababab
3896 1: ababa
3897 2: abab
3898 3: aba
3899 4: ab
3900 5: a
3901 6:
3902    aaaabcde
3903 0: aaaab
3904 1: aaaa
3905 2: aaa
3906 3: aa
3907 4: a
3908 5:
3909    bbbb
3910 0: bbbb
3911 1: bbb
3912 2: bb
3913 3: b
3914 4:
3915
3916/([^a]*)*/
3917    b
3918 0: b
3919 1:
3920    bbbb
3921 0: bbbb
3922 1: bbb
3923 2: bb
3924 3: b
3925 4:
3926    aaa
3927 0:
3928
3929/([^ab]*)*/
3930    cccc
3931 0: cccc
3932 1: ccc
3933 2: cc
3934 3: c
3935 4:
3936    abab
3937 0:
3938
3939/([a]*?)*/
3940    a
3941 0: a
3942 1:
3943    aaaa
3944 0: aaaa
3945 1: aaa
3946 2: aa
3947 3: a
3948 4:
3949
3950/([ab]*?)*/
3951    a
3952 0: a
3953 1:
3954    b
3955 0: b
3956 1:
3957    abab
3958 0: abab
3959 1: aba
3960 2: ab
3961 3: a
3962 4:
3963    baba
3964 0: baba
3965 1: bab
3966 2: ba
3967 3: b
3968 4:
3969
3970/([^a]*?)*/
3971    b
3972 0: b
3973 1:
3974    bbbb
3975 0: bbbb
3976 1: bbb
3977 2: bb
3978 3: b
3979 4:
3980    aaa
3981 0:
3982
3983/([^ab]*?)*/
3984    c
3985 0: c
3986 1:
3987    cccc
3988 0: cccc
3989 1: ccc
3990 2: cc
3991 3: c
3992 4:
3993    baba
3994 0:
3995
3996/(?>a*)*/
3997    a
3998 0: a
3999 1:
4000    aaabcde
4001 0: aaa
4002 1:
4003
4004/((?>a*))*/
4005    aaaaa
4006 0: aaaaa
4007 1:
4008    aabbaa
4009 0: aa
4010 1:
4011
4012/((?>a*?))*/
4013    aaaaa
4014 0: aaaaa
4015 1:
4016    aabbaa
4017 0: aa
4018 1:
4019
4020/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
4021    12-sep-98
4022 0: 12-sep-98
4023    12-09-98
4024 0: 12-09-98
4025\= Expect no match
4026    sep-12-98
4027No match
4028
4029/(?i:saturday|sunday)/
4030    saturday
4031 0: saturday
4032    sunday
4033 0: sunday
4034    Saturday
4035 0: Saturday
4036    Sunday
4037 0: Sunday
4038    SATURDAY
4039 0: SATURDAY
4040    SUNDAY
4041 0: SUNDAY
4042    SunDay
4043 0: SunDay
4044
4045/(a(?i)bc|BB)x/
4046    abcx
4047 0: abcx
4048    aBCx
4049 0: aBCx
4050    bbx
4051 0: bbx
4052    BBx
4053 0: BBx
4054\= Expect no match
4055    abcX
4056No match
4057    aBCX
4058No match
4059    bbX
4060No match
4061    BBX
4062No match
4063
4064/^([ab](?i)[cd]|[ef])/
4065    ac
4066 0: ac
4067    aC
4068 0: aC
4069    bD
4070 0: bD
4071    elephant
4072 0: e
4073    Europe
4074 0: E
4075    frog
4076 0: f
4077    France
4078 0: F
4079\= Expect no match
4080    Africa
4081No match
4082
4083/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
4084    ab
4085 0: ab
4086    aBd
4087 0: aBd
4088    xy
4089 0: xy
4090    xY
4091 0: xY
4092    zebra
4093 0: z
4094    Zambesi
4095 0: Z
4096\= Expect no match
4097    aCD
4098No match
4099    XY
4100No match
4101
4102/(?<=foo\n)^bar/m
4103    foo\nbar
4104 0: bar
4105\= Expect no match
4106    bar
4107No match
4108    baz\nbar
4109No match
4110
4111/(?<=(?<!foo)bar)baz/
4112    barbaz
4113 0: baz
4114    barbarbaz
4115 0: baz
4116    koobarbaz
4117 0: baz
4118\= Expect no match
4119    baz
4120No match
4121    foobarbaz
4122No match
4123
4124# The following tests are taken from the Perl 5.005 test suite; some of them
4125# are compatible with 5.004, but I'd rather not have to sort them out.
4126
4127/abc/
4128    abc
4129 0: abc
4130    xabcy
4131 0: abc
4132    ababc
4133 0: abc
4134\= Expect no match
4135    xbc
4136No match
4137    axc
4138No match
4139    abx
4140No match
4141
4142/ab*c/
4143    abc
4144 0: abc
4145
4146/ab*bc/
4147    abc
4148 0: abc
4149    abbc
4150 0: abbc
4151    abbbbc
4152 0: abbbbc
4153
4154/.{1}/
4155    abbbbc
4156 0: a
4157
4158/.{3,4}/
4159    abbbbc
4160 0: abbb
4161
4162/ab{0,}bc/
4163    abbbbc
4164 0: abbbbc
4165
4166/ab+bc/
4167    abbc
4168 0: abbc
4169\= Expect no match
4170    abc
4171No match
4172    abq
4173No match
4174
4175/ab+bc/
4176    abbbbc
4177 0: abbbbc
4178
4179/ab{1,}bc/
4180    abbbbc
4181 0: abbbbc
4182
4183/ab{1,3}bc/
4184    abbbbc
4185 0: abbbbc
4186
4187/ab{3,4}bc/
4188    abbbbc
4189 0: abbbbc
4190
4191/ab{4,5}bc/
4192\= Expect no match
4193    abq
4194No match
4195    abbbbc
4196No match
4197
4198/ab?bc/
4199    abbc
4200 0: abbc
4201    abc
4202 0: abc
4203
4204/ab{0,1}bc/
4205    abc
4206 0: abc
4207
4208/ab?bc/
4209
4210/ab?c/
4211    abc
4212 0: abc
4213
4214/ab{0,1}c/
4215    abc
4216 0: abc
4217
4218/^abc$/
4219    abc
4220 0: abc
4221\= Expect no match
4222    abbbbc
4223No match
4224    abcc
4225No match
4226
4227/^abc/
4228    abcc
4229 0: abc
4230
4231/^abc$/
4232
4233/abc$/
4234    aabc
4235 0: abc
4236    aabc
4237 0: abc
4238\= Expect no match
4239    aabcd
4240No match
4241
4242/^/
4243    abc
4244 0:
4245
4246/$/
4247    abc
4248 0:
4249
4250/a.c/
4251    abc
4252 0: abc
4253    axc
4254 0: axc
4255
4256/a.*c/
4257    axyzc
4258 0: axyzc
4259
4260/a[bc]d/
4261    abd
4262 0: abd
4263\= Expect no match
4264    axyzd
4265No match
4266    abc
4267No match
4268
4269/a[b-d]e/
4270    ace
4271 0: ace
4272
4273/a[b-d]/
4274    aac
4275 0: ac
4276
4277/a[-b]/
4278    a-
4279 0: a-
4280
4281/a[b-]/
4282    a-
4283 0: a-
4284
4285/a]/
4286    a]
4287 0: a]
4288
4289/a[]]b/
4290    a]b
4291 0: a]b
4292
4293/a[^bc]d/
4294    aed
4295 0: aed
4296\= Expect no match
4297    abd
4298No match
4299    abd
4300No match
4301
4302/a[^-b]c/
4303    adc
4304 0: adc
4305
4306/a[^]b]c/
4307    adc
4308 0: adc
4309    a-c
4310 0: a-c
4311\= Expect no match
4312    a]c
4313No match
4314
4315/\ba\b/
4316    a-
4317 0: a
4318    -a
4319 0: a
4320    -a-
4321 0: a
4322
4323/\by\b/
4324\= Expect no match
4325    xy
4326No match
4327    yz
4328No match
4329    xyz
4330No match
4331
4332/\Ba\B/
4333\= Expect no match
4334    a-
4335No match
4336    -a
4337No match
4338    -a-
4339No match
4340
4341/\By\b/
4342    xy
4343 0: y
4344
4345/\by\B/
4346    yz
4347 0: y
4348
4349/\By\B/
4350    xyz
4351 0: y
4352
4353/\w/
4354    a
4355 0: a
4356
4357/\W/
4358    -
4359 0: -
4360\= Expect no match
4361    a
4362No match
4363
4364/a\sb/
4365    a b
4366 0: a b
4367
4368/a\Sb/
4369    a-b
4370 0: a-b
4371\= Expect no match
4372    a b
4373No match
4374
4375/\d/
4376    1
4377 0: 1
4378
4379/\D/
4380    -
4381 0: -
4382\= Expect no match
4383    1
4384No match
4385
4386/[\w]/
4387    a
4388 0: a
4389
4390/[\W]/
4391    -
4392 0: -
4393\= Expect no match
4394    a
4395No match
4396
4397/a[\s]b/
4398    a b
4399 0: a b
4400
4401/a[\S]b/
4402    a-b
4403 0: a-b
4404\= Expect no match
4405    a b
4406No match
4407
4408/[\d]/
4409    1
4410 0: 1
4411
4412/[\D]/
4413    -
4414 0: -
4415\= Expect no match
4416    1
4417No match
4418
4419/ab|cd/
4420    abc
4421 0: ab
4422    abcd
4423 0: ab
4424
4425/()ef/
4426    def
4427 0: ef
4428
4429/$b/
4430
4431/a\(b/
4432    a(b
4433 0: a(b
4434
4435/a\(*b/
4436    ab
4437 0: ab
4438    a((b
4439 0: a((b
4440
4441/a\\b/
4442    a\\b
4443 0: a\b
4444\= Expect no match
4445    a\b
4446No match
4447
4448/((a))/
4449    abc
4450 0: a
4451
4452/(a)b(c)/
4453    abc
4454 0: abc
4455
4456/a+b+c/
4457    aabbabc
4458 0: abc
4459
4460/a{1,}b{1,}c/
4461    aabbabc
4462 0: abc
4463
4464/a.+?c/
4465    abcabc
4466 0: abcabc
4467 1: abc
4468
4469/(a+|b)*/
4470    ab
4471 0: ab
4472 1: a
4473 2:
4474
4475/(a+|b){0,}/
4476    ab
4477 0: ab
4478 1: a
4479 2:
4480
4481/(a+|b)+/
4482    ab
4483 0: ab
4484 1: a
4485
4486/(a+|b){1,}/
4487    ab
4488 0: ab
4489 1: a
4490
4491/(a+|b)?/
4492    ab
4493 0: a
4494 1:
4495
4496/(a+|b){0,1}/
4497    ab
4498 0: a
4499 1:
4500
4501/[^ab]*/
4502    cde
4503 0: cde
4504
4505/abc/
4506\= Expect no match
4507    b
4508No match
4509
4510/a*/
4511
4512/([abc])*d/
4513    abbbcd
4514 0: abbbcd
4515
4516/([abc])*bcd/
4517    abcd
4518 0: abcd
4519
4520/a|b|c|d|e/
4521    e
4522 0: e
4523
4524/(a|b|c|d|e)f/
4525    ef
4526 0: ef
4527
4528/abcd*efg/
4529    abcdefg
4530 0: abcdefg
4531
4532/ab*/
4533    xabyabbbz
4534 0: ab
4535    xayabbbz
4536 0: a
4537
4538/(ab|cd)e/
4539    abcde
4540 0: cde
4541
4542/[abhgefdc]ij/
4543    hij
4544 0: hij
4545
4546/^(ab|cd)e/
4547
4548/(abc|)ef/
4549    abcdef
4550 0: ef
4551
4552/(a|b)c*d/
4553    abcd
4554 0: bcd
4555
4556/(ab|ab*)bc/
4557    abc
4558 0: abc
4559
4560/a([bc]*)c*/
4561    abc
4562 0: abc
4563 1: a
4564
4565/a([bc]*)(c*d)/
4566    abcd
4567 0: abcd
4568
4569/a([bc]+)(c*d)/
4570    abcd
4571 0: abcd
4572
4573/a([bc]*)(c+d)/
4574    abcd
4575 0: abcd
4576
4577/a[bcd]*dcdcde/
4578    adcdcde
4579 0: adcdcde
4580
4581/a[bcd]+dcdcde/
4582\= Expect no match
4583    abcde
4584No match
4585    adcdcde
4586No match
4587
4588/(ab|a)b*c/
4589    abc
4590 0: abc
4591
4592/((a)(b)c)(d)/
4593    abcd
4594 0: abcd
4595
4596/[a-zA-Z_][a-zA-Z0-9_]*/
4597    alpha
4598 0: alpha
4599
4600/^a(bc+|b[eh])g|.h$/
4601    abh
4602 0: bh
4603
4604/(bc+d$|ef*g.|h?i(j|k))/
4605    effgz
4606 0: effgz
4607    ij
4608 0: ij
4609    reffgz
4610 0: effgz
4611\= Expect no match
4612    effg
4613No match
4614    bcdd
4615No match
4616
4617/((((((((((a))))))))))/
4618    a
4619 0: a
4620
4621/(((((((((a)))))))))/
4622    a
4623 0: a
4624
4625/multiple words of text/
4626\= Expect no match
4627    aa
4628No match
4629    uh-uh
4630No match
4631
4632/multiple words/
4633    multiple words, yeah
4634 0: multiple words
4635
4636/(.*)c(.*)/
4637    abcde
4638 0: abcde
4639
4640/\((.*), (.*)\)/
4641    (a, b)
4642 0: (a, b)
4643
4644/[k]/
4645
4646/abcd/
4647    abcd
4648 0: abcd
4649
4650/a(bc)d/
4651    abcd
4652 0: abcd
4653
4654/a[-]?c/
4655    ac
4656 0: ac
4657
4658/abc/i
4659    ABC
4660 0: ABC
4661    XABCY
4662 0: ABC
4663    ABABC
4664 0: ABC
4665\= Expect no match
4666    aaxabxbaxbbx
4667No match
4668    XBC
4669No match
4670    AXC
4671No match
4672    ABX
4673No match
4674
4675/ab*c/i
4676    ABC
4677 0: ABC
4678
4679/ab*bc/i
4680    ABC
4681 0: ABC
4682    ABBC
4683 0: ABBC
4684
4685/ab*?bc/i
4686    ABBBBC
4687 0: ABBBBC
4688
4689/ab{0,}?bc/i
4690    ABBBBC
4691 0: ABBBBC
4692
4693/ab+?bc/i
4694    ABBC
4695 0: ABBC
4696
4697/ab+bc/i
4698\= Expect no match
4699    ABC
4700No match
4701    ABQ
4702No match
4703
4704/ab{1,}bc/i
4705
4706/ab+bc/i
4707    ABBBBC
4708 0: ABBBBC
4709
4710/ab{1,}?bc/i
4711    ABBBBC
4712 0: ABBBBC
4713
4714/ab{1,3}?bc/i
4715    ABBBBC
4716 0: ABBBBC
4717
4718/ab{3,4}?bc/i
4719    ABBBBC
4720 0: ABBBBC
4721
4722/ab{4,5}?bc/i
4723\= Expect no match
4724    ABQ
4725No match
4726    ABBBBC
4727No match
4728
4729/ab??bc/i
4730    ABBC
4731 0: ABBC
4732    ABC
4733 0: ABC
4734
4735/ab{0,1}?bc/i
4736    ABC
4737 0: ABC
4738
4739/ab??bc/i
4740
4741/ab??c/i
4742    ABC
4743 0: ABC
4744
4745/ab{0,1}?c/i
4746    ABC
4747 0: ABC
4748
4749/^abc$/i
4750    ABC
4751 0: ABC
4752\= Expect no match
4753    ABBBBC
4754No match
4755    ABCC
4756No match
4757
4758/^abc/i
4759    ABCC
4760 0: ABC
4761
4762/^abc$/i
4763
4764/abc$/i
4765    AABC
4766 0: ABC
4767
4768/^/i
4769    ABC
4770 0:
4771
4772/$/i
4773    ABC
4774 0:
4775
4776/a.c/i
4777    ABC
4778 0: ABC
4779    AXC
4780 0: AXC
4781
4782/a.*?c/i
4783    AXYZC
4784 0: AXYZC
4785
4786/a.*c/i
4787    AABC
4788 0: AABC
4789\= Expect no match
4790    AXYZD
4791No match
4792
4793/a[bc]d/i
4794    ABD
4795 0: ABD
4796
4797/a[b-d]e/i
4798    ACE
4799 0: ACE
4800\= Expect no match
4801    ABC
4802No match
4803    ABD
4804No match
4805
4806/a[b-d]/i
4807    AAC
4808 0: AC
4809
4810/a[-b]/i
4811    A-
4812 0: A-
4813
4814/a[b-]/i
4815    A-
4816 0: A-
4817
4818/a]/i
4819    A]
4820 0: A]
4821
4822/a[]]b/i
4823    A]B
4824 0: A]B
4825
4826/a[^bc]d/i
4827    AED
4828 0: AED
4829
4830/a[^-b]c/i
4831    ADC
4832 0: ADC
4833\= Expect no match
4834    ABD
4835No match
4836    A-C
4837No match
4838
4839/a[^]b]c/i
4840    ADC
4841 0: ADC
4842
4843/ab|cd/i
4844    ABC
4845 0: AB
4846    ABCD
4847 0: AB
4848
4849/()ef/i
4850    DEF
4851 0: EF
4852
4853/$b/i
4854\= Expect no match
4855    A]C
4856No match
4857    B
4858No match
4859
4860/a\(b/i
4861    A(B
4862 0: A(B
4863
4864/a\(*b/i
4865    AB
4866 0: AB
4867    A((B
4868 0: A((B
4869
4870/a\\b/i
4871\= Expect no match
4872    A\=notbol
4873No match
4874
4875/((a))/i
4876    ABC
4877 0: A
4878
4879/(a)b(c)/i
4880    ABC
4881 0: ABC
4882
4883/a+b+c/i
4884    AABBABC
4885 0: ABC
4886
4887/a{1,}b{1,}c/i
4888    AABBABC
4889 0: ABC
4890
4891/a.+?c/i
4892    ABCABC
4893 0: ABCABC
4894 1: ABC
4895
4896/a.*?c/i
4897    ABCABC
4898 0: ABCABC
4899 1: ABC
4900
4901/a.{0,5}?c/i
4902    ABCABC
4903 0: ABCABC
4904 1: ABC
4905
4906/(a+|b)*/i
4907    AB
4908 0: AB
4909 1: A
4910 2:
4911
4912/(a+|b){0,}/i
4913    AB
4914 0: AB
4915 1: A
4916 2:
4917
4918/(a+|b)+/i
4919    AB
4920 0: AB
4921 1: A
4922
4923/(a+|b){1,}/i
4924    AB
4925 0: AB
4926 1: A
4927
4928/(a+|b)?/i
4929    AB
4930 0: A
4931 1:
4932
4933/(a+|b){0,1}/i
4934    AB
4935 0: A
4936 1:
4937
4938/(a+|b){0,1}?/i
4939    AB
4940 0: A
4941 1:
4942
4943/[^ab]*/i
4944    CDE
4945 0: CDE
4946
4947/abc/i
4948
4949/a*/i
4950
4951/([abc])*d/i
4952    ABBBCD
4953 0: ABBBCD
4954
4955/([abc])*bcd/i
4956    ABCD
4957 0: ABCD
4958
4959/a|b|c|d|e/i
4960    E
4961 0: E
4962
4963/(a|b|c|d|e)f/i
4964    EF
4965 0: EF
4966
4967/abcd*efg/i
4968    ABCDEFG
4969 0: ABCDEFG
4970
4971/ab*/i
4972    XABYABBBZ
4973 0: AB
4974    XAYABBBZ
4975 0: A
4976
4977/(ab|cd)e/i
4978    ABCDE
4979 0: CDE
4980
4981/[abhgefdc]ij/i
4982    HIJ
4983 0: HIJ
4984
4985/^(ab|cd)e/i
4986\= Expect no match
4987    ABCDE
4988No match
4989
4990/(abc|)ef/i
4991    ABCDEF
4992 0: EF
4993
4994/(a|b)c*d/i
4995    ABCD
4996 0: BCD
4997
4998/(ab|ab*)bc/i
4999    ABC
5000 0: ABC
5001
5002/a([bc]*)c*/i
5003    ABC
5004 0: ABC
5005 1: A
5006
5007/a([bc]*)(c*d)/i
5008    ABCD
5009 0: ABCD
5010
5011/a([bc]+)(c*d)/i
5012    ABCD
5013 0: ABCD
5014
5015/a([bc]*)(c+d)/i
5016    ABCD
5017 0: ABCD
5018
5019/a[bcd]*dcdcde/i
5020    ADCDCDE
5021 0: ADCDCDE
5022
5023/a[bcd]+dcdcde/i
5024
5025/(ab|a)b*c/i
5026    ABC
5027 0: ABC
5028
5029/((a)(b)c)(d)/i
5030    ABCD
5031 0: ABCD
5032
5033/[a-zA-Z_][a-zA-Z0-9_]*/i
5034    ALPHA
5035 0: ALPHA
5036
5037/^a(bc+|b[eh])g|.h$/i
5038    ABH
5039 0: BH
5040
5041/(bc+d$|ef*g.|h?i(j|k))/i
5042    EFFGZ
5043 0: EFFGZ
5044    IJ
5045 0: IJ
5046    REFFGZ
5047 0: EFFGZ
5048\= Expect no match
5049    ADCDCDE
5050No match
5051    EFFG
5052No match
5053    BCDD
5054No match
5055
5056/((((((((((a))))))))))/i
5057    A
5058 0: A
5059
5060/(((((((((a)))))))))/i
5061    A
5062 0: A
5063
5064/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
5065    A
5066 0: A
5067
5068/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
5069    C
5070 0: C
5071
5072/multiple words of text/i
5073\= Expect no match
5074    AA
5075No match
5076    UH-UH
5077No match
5078
5079/multiple words/i
5080    MULTIPLE WORDS, YEAH
5081 0: MULTIPLE WORDS
5082
5083/(.*)c(.*)/i
5084    ABCDE
5085 0: ABCDE
5086
5087/\((.*), (.*)\)/i
5088    (A, B)
5089 0: (A, B)
5090
5091/[k]/i
5092
5093/abcd/i
5094    ABCD
5095 0: ABCD
5096
5097/a(bc)d/i
5098    ABCD
5099 0: ABCD
5100
5101/a[-]?c/i
5102    AC
5103 0: AC
5104
5105/a(?!b)./
5106    abad
5107 0: ad
5108
5109/a(?=d)./
5110    abad
5111 0: ad
5112
5113/a(?=c|d)./
5114    abad
5115 0: ad
5116
5117/a(?:b|c|d)(.)/
5118    ace
5119 0: ace
5120
5121/a(?:b|c|d)*(.)/
5122    ace
5123 0: ace
5124 1: ac
5125
5126/a(?:b|c|d)+?(.)/
5127    ace
5128 0: ace
5129    acdbcdbe
5130 0: acdbcdbe
5131 1: acdbcdb
5132 2: acdbcd
5133 3: acdbc
5134 4: acdb
5135 5: acd
5136
5137/a(?:b|c|d)+(.)/
5138    acdbcdbe
5139 0: acdbcdbe
5140 1: acdbcdb
5141 2: acdbcd
5142 3: acdbc
5143 4: acdb
5144 5: acd
5145
5146/a(?:b|c|d){2}(.)/
5147    acdbcdbe
5148 0: acdb
5149
5150/a(?:b|c|d){4,5}(.)/
5151    acdbcdbe
5152 0: acdbcdb
5153 1: acdbcd
5154
5155/a(?:b|c|d){4,5}?(.)/
5156    acdbcdbe
5157 0: acdbcdb
5158 1: acdbcd
5159
5160/((foo)|(bar))*/
5161    foobar
5162 0: foobar
5163 1: foo
5164 2:
5165
5166/a(?:b|c|d){6,7}(.)/
5167    acdbcdbe
5168 0: acdbcdbe
5169
5170/a(?:b|c|d){6,7}?(.)/
5171    acdbcdbe
5172 0: acdbcdbe
5173
5174/a(?:b|c|d){5,6}(.)/
5175    acdbcdbe
5176 0: acdbcdbe
5177 1: acdbcdb
5178
5179/a(?:b|c|d){5,6}?(.)/
5180    acdbcdbe
5181 0: acdbcdbe
5182 1: acdbcdb
5183
5184/a(?:b|c|d){5,7}(.)/
5185    acdbcdbe
5186 0: acdbcdbe
5187 1: acdbcdb
5188
5189/a(?:b|c|d){5,7}?(.)/
5190    acdbcdbe
5191 0: acdbcdbe
5192 1: acdbcdb
5193
5194/a(?:b|(c|e){1,2}?|d)+?(.)/
5195    ace
5196 0: ace
5197
5198/^(.+)?B/
5199    AB
5200 0: AB
5201
5202/^([^a-z])|(\^)$/
5203    .
5204 0: .
5205
5206/^[<>]&/
5207    <&OUT
5208 0: <&
5209
5210/(?:(f)(o)(o)|(b)(a)(r))*/
5211    foobar
5212 0: foobar
5213 1: foo
5214 2:
5215
5216/(?<=a)b/
5217    ab
5218 0: b
5219\= Expect no 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 1: a
5237
5238/(?:..)*?a/
5239    aba
5240 0: aba
5241 1: a
5242
5243/^(){3,5}/
5244    abc
5245 0:
5246
5247/^(a+)*ax/
5248    aax
5249 0: aax
5250
5251/^((a|b)+)*ax/
5252    aax
5253 0: aax
5254
5255/^((a|bc)+)*ax/
5256    aax
5257 0: aax
5258
5259/(a|x)*ab/
5260    cab
5261 0: ab
5262
5263/(a)*ab/
5264    cab
5265 0: ab
5266
5267/(?:(?i)a)b/
5268    ab
5269 0: ab
5270
5271/((?i)a)b/
5272    ab
5273 0: ab
5274
5275/(?:(?i)a)b/
5276    Ab
5277 0: Ab
5278
5279/((?i)a)b/
5280    Ab
5281 0: Ab
5282
5283/(?:(?i)a)b/
5284\= Expect no match
5285    cb
5286No match
5287    aB
5288No match
5289
5290/((?i)a)b/
5291
5292/(?i:a)b/
5293    ab
5294 0: ab
5295
5296/((?i:a))b/
5297    ab
5298 0: ab
5299
5300/(?i:a)b/
5301    Ab
5302 0: Ab
5303
5304/((?i:a))b/
5305    Ab
5306 0: Ab
5307
5308/(?i:a)b/
5309\= Expect no match
5310    aB
5311No match
5312    aB
5313No match
5314
5315/((?i:a))b/
5316
5317/(?:(?-i)a)b/i
5318    ab
5319 0: ab
5320
5321/((?-i)a)b/i
5322    ab
5323 0: ab
5324
5325/(?:(?-i)a)b/i
5326    aB
5327 0: aB
5328
5329/((?-i)a)b/i
5330    aB
5331 0: aB
5332
5333/(?:(?-i)a)b/i
5334    aB
5335 0: aB
5336\= Expect no match
5337    Ab
5338No match
5339
5340/((?-i)a)b/i
5341
5342/(?:(?-i)a)b/i
5343    aB
5344 0: aB
5345
5346/((?-i)a)b/i
5347    aB
5348 0: aB
5349
5350/(?:(?-i)a)b/i
5351\= Expect no match
5352    Ab
5353No match
5354    AB
5355No match
5356
5357/((?-i)a)b/i
5358
5359/(?-i:a)b/i
5360    ab
5361 0: ab
5362
5363/((?-i:a))b/i
5364    ab
5365 0: ab
5366
5367/(?-i:a)b/i
5368    aB
5369 0: aB
5370
5371/((?-i:a))b/i
5372    aB
5373 0: aB
5374
5375/(?-i:a)b/i
5376\= Expect no match
5377    AB
5378No match
5379    Ab
5380No match
5381
5382/((?-i:a))b/i
5383
5384/(?-i:a)b/i
5385    aB
5386 0: aB
5387
5388/((?-i:a))b/i
5389    aB
5390 0: aB
5391
5392/(?-i:a)b/i
5393\= Expect no match
5394    Ab
5395No match
5396    AB
5397No match
5398
5399/((?-i:a))b/i
5400
5401/((?-i:a.))b/i
5402\= Expect no match
5403    AB
5404No match
5405    a\nB
5406No match
5407
5408/((?s-i:a.))b/i
5409    a\nB
5410 0: a\x0aB
5411
5412/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
5413    cabbbb
5414 0: cabbbb
5415
5416/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
5417    caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
5418 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
5419
5420/foo\w*\d{4}baz/
5421    foobar1234baz
5422 0: foobar1234baz
5423
5424/x(~~)*(?:(?:F)?)?/
5425    x~~
5426 0: x~~
5427 1: x
5428
5429/^a(?#xxx){3}c/
5430    aaac
5431 0: aaac
5432
5433/^a (?#xxx) (?#yyy) {3}c/x
5434    aaac
5435 0: aaac
5436
5437/(?<![cd])b/
5438\= Expect no match
5439    B\nB
5440No match
5441    dbcb
5442No match
5443
5444/(?<![cd])[ab]/
5445    dbaacb
5446 0: a
5447
5448/(?<!(c|d))b/
5449
5450/(?<!(c|d))[ab]/
5451    dbaacb
5452 0: a
5453
5454/(?<!cd)[ab]/
5455    cdaccb
5456 0: b
5457
5458/^(?:a?b?)*$/
5459\= Expect no match
5460    dbcb
5461No match
5462    a--
5463No match
5464
5465/((?s)^a(.))((?m)^b$)/
5466    a\nb\nc\n
5467 0: a\x0ab
5468
5469/((?m)^b$)/
5470    a\nb\nc\n
5471 0: b
5472
5473/(?m)^b/
5474    a\nb\n
5475 0: b
5476
5477/(?m)^(b)/
5478    a\nb\n
5479 0: b
5480
5481/((?m)^b)/
5482    a\nb\n
5483 0: b
5484
5485/\n((?m)^b)/
5486    a\nb\n
5487 0: \x0ab
5488
5489/((?s).)c(?!.)/
5490    a\nb\nc\n
5491 0: \x0ac
5492    a\nb\nc\n
5493 0: \x0ac
5494
5495/((?s)b.)c(?!.)/
5496    a\nb\nc\n
5497 0: b\x0ac
5498    a\nb\nc\n
5499 0: b\x0ac
5500
5501/^b/
5502
5503/()^b/
5504\= Expect no match
5505    a\nb\nc\n
5506No match
5507    a\nb\nc\n
5508No match
5509
5510/((?m)^b)/
5511    a\nb\nc\n
5512 0: b
5513
5514/(?(?!a)a|b)/
5515
5516/(?(?!a)b|a)/
5517    a
5518 0: a
5519
5520/(?(?=a)b|a)/
5521\= Expect no match
5522    a
5523No match
5524    a
5525No match
5526
5527/(?(?=a)a|b)/
5528    a
5529 0: a
5530
5531/(\w+:)+/
5532    one:
5533 0: one:
5534
5535/$(?<=^(a))/
5536    a
5537 0:
5538
5539/([\w:]+::)?(\w+)$/
5540    abcd
5541 0: abcd
5542    xy:z:::abcd
5543 0: xy:z:::abcd
5544
5545/^[^bcd]*(c+)/
5546    aexycd
5547 0: aexyc
5548
5549/(a*)b+/
5550    caab
5551 0: aab
5552
5553/([\w:]+::)?(\w+)$/
5554    abcd
5555 0: abcd
5556    xy:z:::abcd
5557 0: xy:z:::abcd
5558\= Expect no match
5559    abcd:
5560No match
5561    abcd:
5562No match
5563
5564/^[^bcd]*(c+)/
5565    aexycd
5566 0: aexyc
5567
5568/(>a+)ab/
5569
5570/(?>a+)b/
5571    aaab
5572 0: aaab
5573
5574/([[:]+)/
5575    a:[b]:
5576 0: :[
5577
5578/([[=]+)/
5579    a=[b]=
5580 0: =[
5581
5582/([[.]+)/
5583    a.[b].
5584 0: .[
5585
5586/((?>a+)b)/
5587    aaab
5588 0: aaab
5589
5590/(?>(a+))b/
5591    aaab
5592 0: aaab
5593
5594/((?>[^()]+)|\([^()]*\))+/
5595    ((abc(ade)ufh()()x
5596 0: abc(ade)ufh()()x
5597 1: abc(ade)ufh()()
5598 2: abc(ade)ufh()
5599 3: abc(ade)ufh
5600 4: abc(ade)
5601 5: abc
5602
5603/a\Z/
5604\= Expect no match
5605    aaab
5606No match
5607    a\nb\n
5608No match
5609
5610/b\Z/
5611    a\nb\n
5612 0: b
5613
5614/b\z/
5615
5616/b\Z/
5617    a\nb
5618 0: b
5619
5620/b\z/
5621    a\nb
5622 0: b
5623
5624/(?>.*)(?<=(abcd|wxyz))/
5625    alphabetabcd
5626 0: alphabetabcd
5627    endingwxyz
5628 0: endingwxyz
5629\= Expect no match
5630    a rather long string that doesn't end with one of them
5631No match
5632
5633/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
5634    word cat dog elephant mussel cow horse canary baboon snake shark otherword
5635 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
5636\= Expect no match
5637    word cat dog elephant mussel cow horse canary baboon snake shark
5638No match
5639
5640/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
5641\= Expect no match
5642    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
5643No match
5644
5645/(?<=\d{3}(?!999))foo/
5646    999foo
5647 0: foo
5648    123999foo
5649 0: foo
5650\= Expect no match
5651    123abcfoo
5652No match
5653
5654/(?<=(?!...999)\d{3})foo/
5655    999foo
5656 0: foo
5657    123999foo
5658 0: foo
5659\= Expect no match
5660    123abcfoo
5661No match
5662
5663/(?<=\d{3}(?!999)...)foo/
5664    123abcfoo
5665 0: foo
5666    123456foo
5667 0: foo
5668\= Expect no match
5669    123999foo
5670No match
5671
5672/(?<=\d{3}...)(?<!999)foo/
5673    123abcfoo
5674 0: foo
5675    123456foo
5676 0: foo
5677\= Expect no match
5678    123999foo
5679No match
5680
5681/((Z)+|A)*/
5682    ZABCDEFG
5683 0: ZA
5684 1: Z
5685 2:
5686
5687/(Z()|A)*/
5688    ZABCDEFG
5689 0: ZA
5690 1: Z
5691 2:
5692
5693/(Z(())|A)*/
5694    ZABCDEFG
5695 0: ZA
5696 1: Z
5697 2:
5698
5699/((?>Z)+|A)*/
5700    ZABCDEFG
5701 0: ZA
5702 1: Z
5703 2:
5704
5705/((?>)+|A)*/
5706    ZABCDEFG
5707 0:
5708
5709/a*/g
5710    abbab
5711 0: a
5712 0:
5713 0:
5714 0: a
5715 0:
5716 0:
5717
5718/^[\d-a]/
5719    abcde
5720 0: a
5721    -things
5722 0: -
5723    0digit
5724 0: 0
5725\= Expect no match
5726    bcdef
5727No match
5728
5729/[[:space:]]+/
5730    > \x09\x0a\x0c\x0d\x0b<
5731 0:  \x09\x0a\x0c\x0d\x0b
5732
5733/[[:blank:]]+/
5734    > \x09\x0a\x0c\x0d\x0b<
5735 0:  \x09
5736
5737/[\s]+/
5738    > \x09\x0a\x0c\x0d\x0b<
5739 0:  \x09\x0a\x0c\x0d\x0b
5740
5741/\s+/
5742    > \x09\x0a\x0c\x0d\x0b<
5743 0:  \x09\x0a\x0c\x0d\x0b
5744
5745/ab/x
5746    ab
5747 0: ab
5748
5749/(?!\A)x/m
5750  a\nxb\n
5751 0: x
5752
5753/(?!^)x/m
5754\= Expect no match
5755    a\nxb\n
5756No match
5757
5758/abc\Qabc\Eabc/
5759    abcabcabc
5760 0: abcabcabc
5761
5762/abc\Q(*+|\Eabc/
5763    abc(*+|abc
5764 0: abc(*+|abc
5765
5766/   abc\Q abc\Eabc/x
5767    abc abcabc
5768 0: abc abcabc
5769\= Expect no match
5770    abcabcabc
5771No match
5772
5773/abc#comment
5774    \Q#not comment
5775    literal\E/x
5776    abc#not comment\n    literal
5777 0: abc#not comment\x0a    literal
5778
5779/abc#comment
5780    \Q#not comment
5781    literal/x
5782    abc#not comment\n    literal
5783 0: abc#not comment\x0a    literal
5784
5785/abc#comment
5786    \Q#not comment
5787    literal\E #more comment
5788    /x
5789    abc#not comment\n    literal
5790 0: abc#not comment\x0a    literal
5791
5792/abc#comment
5793    \Q#not comment
5794    literal\E #more comment/x
5795    abc#not comment\n    literal
5796 0: abc#not comment\x0a    literal
5797
5798/\Qabc\$xyz\E/
5799    abc\\\$xyz
5800 0: abc\$xyz
5801
5802/\Qabc\E\$\Qxyz\E/
5803    abc\$xyz
5804 0: abc$xyz
5805
5806/\Gabc/
5807    abc
5808 0: abc
5809\= Expect no match
5810    xyzabc
5811No match
5812
5813/\Gabc./g
5814    abc1abc2xyzabc3
5815 0: abc1
5816 0: abc2
5817
5818/abc./g
5819    abc1abc2xyzabc3
5820 0: abc1
5821 0: abc2
5822 0: abc3
5823
5824/a(?x: b c )d/
5825    XabcdY
5826 0: abcd
5827\= Expect no match
5828    Xa b c d Y
5829No match
5830
5831/((?x)x y z | a b c)/
5832    XabcY
5833 0: abc
5834    AxyzB
5835 0: xyz
5836
5837/(?i)AB(?-i)C/
5838    XabCY
5839 0: abC
5840\= Expect no match
5841    XabcY
5842No match
5843
5844/((?i)AB(?-i)C|D)E/
5845    abCE
5846 0: abCE
5847    DE
5848 0: DE
5849\= Expect no match
5850    abcE
5851No match
5852    abCe
5853No match
5854    dE
5855No match
5856    De
5857No match
5858
5859/[z\Qa-d]\E]/
5860    z
5861 0: z
5862    a
5863 0: a
5864    -
5865 0: -
5866    d
5867 0: d
5868    ]
5869 0: ]
5870\= Expect no match
5871    b
5872No match
5873
5874/(a+)*b/
5875\= Expect no match
5876    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
5877No match
5878
5879/(?i)reg(?:ul(?:[a�]|ae)r|ex)/
5880    REGular
5881 0: REGular
5882    regulaer
5883 0: regulaer
5884    Regex
5885 0: Regex
5886    regul�r
5887 0: regul\xe4r
5888
5889/����[�-��-�]+/
5890    �����
5891 0: \xc5\xe6\xe5\xe4\xe0
5892    �����
5893 0: \xc5\xe6\xe5\xe4\xff
5894    �����
5895 0: \xc5\xe6\xe5\xe4\xc0
5896    �����
5897 0: \xc5\xe6\xe5\xe4\xdf
5898
5899/(?<=Z)X./
5900    \x84XAZXB
5901 0: XB
5902
5903/^(?(2)a|(1)(2))+$/
5904    123a
5905Failed: error -40: backreference condition or recursion test is not supported for DFA matching
5906
5907/(?<=a|bbbb)c/
5908    ac
5909 0: c
5910    bbbbc
5911 0: c
5912
5913/line\nbreak/
5914    this is a line\nbreak
5915 0: line\x0abreak
5916    line one\nthis is a line\nbreak in the second line
5917 0: line\x0abreak
5918
5919/line\nbreak/firstline
5920    this is a line\nbreak
5921 0: line\x0abreak
5922\= Expect no match
5923    line one\nthis is a line\nbreak in the second line
5924No match
5925
5926/line\nbreak/m,firstline
5927    this is a line\nbreak
5928 0: line\x0abreak
5929\= Expect no match
5930    line one\nthis is a line\nbreak in the second line
5931No match
5932
5933/1234/
5934    123\=ps
5935Partial match: 123
5936\= Expect no match
5937    a4\=ps,dfa_restart
5938No match
5939
5940/1234/
5941    123\=ps
5942Partial match: 123
5943    4\=ps,dfa_restart
5944 0: 4
5945
5946/^/gm
5947    a\nb\nc\n
5948 0:
5949 0:
5950 0:
5951    \
5952 0:
5953
5954/(?<=C\n)^/gm
5955    A\nC\nC\n
5956 0:
5957
5958/(?s)A?B/
5959    AB
5960 0: AB
5961    aB
5962 0: B
5963
5964/(?s)A*B/
5965    AB
5966 0: AB
5967    aB
5968 0: B
5969
5970/(?m)A?B/
5971    AB
5972 0: AB
5973    aB
5974 0: B
5975
5976/(?m)A*B/
5977    AB
5978 0: AB
5979    aB
5980 0: B
5981
5982/Content-Type\x3A[^\r\n]{6,}/
5983    Content-Type:xxxxxyyy
5984 0: Content-Type:xxxxxyyy
5985
5986/Content-Type\x3A[^\r\n]{6,}z/
5987    Content-Type:xxxxxyyyz
5988 0: Content-Type:xxxxxyyyz
5989
5990/Content-Type\x3A[^a]{6,}/
5991    Content-Type:xxxyyy
5992 0: Content-Type:xxxyyy
5993
5994/Content-Type\x3A[^a]{6,}z/
5995    Content-Type:xxxyyyz
5996 0: Content-Type:xxxyyyz
5997
5998/^abc/Im,newline=lf
5999Capturing subpattern count = 0
6000Options: multiline
6001Forced newline is LF
6002First code unit at start or follows newline
6003Last code unit = 'c'
6004Subject length lower bound = 3
6005    xyz\nabc
6006 0: abc
6007    xyz\r\nabc
6008 0: abc
6009\= Expect no match
6010    xyz\rabc
6011No match
6012    xyzabc\r
6013No match
6014    xyzabc\rpqr
6015No match
6016    xyzabc\r\n
6017No match
6018    xyzabc\r\npqr
6019No match
6020
6021/^abc/Im,newline=crlf
6022Capturing subpattern count = 0
6023Options: multiline
6024Forced newline is CRLF
6025First code unit at start or follows newline
6026Last code unit = 'c'
6027Subject length lower bound = 3
6028    xyz\r\nabclf>
6029 0: abc
6030\= Expect no match
6031    xyz\nabclf
6032No match
6033    xyz\rabclf
6034No match
6035
6036/^abc/Im,newline=cr
6037Capturing subpattern count = 0
6038Options: multiline
6039Forced newline is CR
6040First code unit at start or follows newline
6041Last code unit = 'c'
6042Subject length lower bound = 3
6043    xyz\rabc
6044 0: abc
6045\= Expect no match
6046    xyz\nabc
6047No match
6048    xyz\r\nabc
6049No match
6050
6051/.*/I,newline=lf
6052Capturing subpattern count = 0
6053May match empty string
6054Forced newline is LF
6055First code unit at start or follows newline
6056Subject length lower bound = 0
6057    abc\ndef
6058 0: abc
6059    abc\rdef
6060 0: abc\x0ddef
6061    abc\r\ndef
6062 0: abc\x0d
6063
6064/.*/I,newline=cr
6065Capturing subpattern count = 0
6066May match empty string
6067Forced newline is CR
6068First code unit at start or follows newline
6069Subject length lower bound = 0
6070    abc\ndef
6071 0: abc\x0adef
6072    abc\rdef
6073 0: abc
6074    abc\r\ndef
6075 0: abc
6076
6077/.*/I,newline=crlf
6078Capturing subpattern count = 0
6079May match empty string
6080Forced newline is CRLF
6081First code unit at start or follows newline
6082Subject length lower bound = 0
6083    abc\ndef
6084 0: abc\x0adef
6085    abc\rdef
6086 0: abc\x0ddef
6087    abc\r\ndef
6088 0: abc
6089
6090/\w+(.)(.)?def/Is
6091Capturing subpattern count = 2
6092Options: dotall
6093Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
6094  Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
6095Last code unit = 'f'
6096Subject length lower bound = 5
6097    abc\ndef
6098 0: abc\x0adef
6099    abc\rdef
6100 0: abc\x0ddef
6101    abc\r\ndef
6102 0: abc\x0d\x0adef
6103
6104/\w+(.)(.)?def/s
6105    abc\ndef
6106 0: abc\x0adef
6107    abc\rdef
6108 0: abc\x0ddef
6109    abc\r\ndef
6110 0: abc\x0d\x0adef
6111
6112/^\w+=.*(\\\n.*)*/
6113    abc=xyz\\\npqr
6114 0: abc=xyz\\x0apqr
6115 1: abc=xyz\\x0apq
6116 2: abc=xyz\\x0ap
6117 3: abc=xyz\\x0a
6118 4: abc=xyz\
6119 5: abc=xyz
6120 6: abc=xy
6121 7: abc=x
6122 8: abc=
6123
6124/^(a()*)*/
6125    aaaa
6126 0: aaaa
6127 1: aaa
6128 2: aa
6129 3: a
6130 4:
6131
6132/^(?:a(?:(?:))*)*/
6133    aaaa
6134 0: aaaa
6135 1: aaa
6136 2: aa
6137 3: a
6138 4:
6139
6140/^(a()+)+/
6141    aaaa
6142 0: aaaa
6143 1: aaa
6144 2: aa
6145 3: a
6146
6147/^(?:a(?:(?:))+)+/
6148    aaaa
6149 0: aaaa
6150 1: aaa
6151 2: aa
6152 3: a
6153
6154/(a|)*\d/
6155  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6156 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6157\= Expect no match
6158  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6159No match
6160
6161/(?>a|)*\d/
6162  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6163 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6164\= Expect no match
6165  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6166No match
6167
6168/(?:a|)*\d/
6169  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6170 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6171\= Expect no match
6172  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6173No match
6174
6175/^a.b/newline=lf
6176    a\rb
6177 0: a\x0db
6178\= Expect no match
6179    a\nb
6180No match
6181
6182/^a.b/newline=cr
6183    a\nb
6184 0: a\x0ab
6185\= Expect no match
6186    a\rb
6187No match
6188
6189/^a.b/newline=anycrlf
6190    a\x85b
6191 0: a\x85b
6192\= Expect no match
6193    a\rb
6194No match
6195
6196/^a.b/newline=any
6197\= Expect no match
6198    a\nb
6199No match
6200    a\rb
6201No match
6202    a\x85b
6203No match
6204
6205/^abc./gmx,newline=any
6206    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
6207 0: abc1
6208 0: abc2
6209 0: abc3
6210 0: abc4
6211 0: abc5
6212 0: abc6
6213 0: abc7
6214
6215/abc.$/gmx,newline=any
6216    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
6217 0: abc1
6218 0: abc2
6219 0: abc3
6220 0: abc4
6221 0: abc5
6222 0: abc6
6223 0: abc9
6224
6225/^a\Rb/bsr=unicode
6226    a\nb
6227 0: a\x0ab
6228    a\rb
6229 0: a\x0db
6230    a\r\nb
6231 0: a\x0d\x0ab
6232    a\x0bb
6233 0: a\x0bb
6234    a\x0cb
6235 0: a\x0cb
6236    a\x85b
6237 0: a\x85b
6238\= Expect no match
6239    a\n\rb
6240No match
6241
6242/^a\R*b/bsr=unicode
6243    ab
6244 0: ab
6245    a\nb
6246 0: a\x0ab
6247    a\rb
6248 0: a\x0db
6249    a\r\nb
6250 0: a\x0d\x0ab
6251    a\x0bb
6252 0: a\x0bb
6253    a\x0cb
6254 0: a\x0cb
6255    a\x85b
6256 0: a\x85b
6257    a\n\rb
6258 0: a\x0a\x0db
6259    a\n\r\x85\x0cb
6260 0: a\x0a\x0d\x85\x0cb
6261
6262/^a\R+b/bsr=unicode
6263    a\nb
6264 0: a\x0ab
6265    a\rb
6266 0: a\x0db
6267    a\r\nb
6268 0: a\x0d\x0ab
6269    a\x0bb
6270 0: a\x0bb
6271    a\x0cb
6272 0: a\x0cb
6273    a\x85b
6274 0: a\x85b
6275    a\n\rb
6276 0: a\x0a\x0db
6277    a\n\r\x85\x0cb
6278 0: a\x0a\x0d\x85\x0cb
6279\= Expect no match
6280    ab
6281No match
6282
6283/^a\R{1,3}b/bsr=unicode
6284    a\nb
6285 0: a\x0ab
6286    a\n\rb
6287 0: a\x0a\x0db
6288    a\n\r\x85b
6289 0: a\x0a\x0d\x85b
6290    a\r\n\r\nb
6291 0: a\x0d\x0a\x0d\x0ab
6292    a\r\n\r\n\r\nb
6293 0: a\x0d\x0a\x0d\x0a\x0d\x0ab
6294    a\n\r\n\rb
6295 0: a\x0a\x0d\x0a\x0db
6296    a\n\n\r\nb
6297 0: a\x0a\x0a\x0d\x0ab
6298\= Expect no match
6299    a\n\n\n\rb
6300No match
6301    a\r
6302No match
6303
6304/.+foo/
6305    afoo
6306 0: afoo
6307\= Expect no match
6308    \r\nfoo
6309No match
6310    \nfoo
6311No match
6312
6313/.+foo/newline=crlf
6314    afoo
6315 0: afoo
6316    \nfoo
6317 0: \x0afoo
6318\= Expect no match
6319    \r\nfoo
6320No match
6321
6322/.+foo/newline=any
6323    afoo
6324 0: afoo
6325\= Expect no match
6326    \nfoo
6327No match
6328    \r\nfoo
6329No match
6330
6331/.+foo/s
6332    afoo
6333 0: afoo
6334    \r\nfoo
6335 0: \x0d\x0afoo
6336    \nfoo
6337 0: \x0afoo
6338
6339/^$/gm,newline=any
6340    abc\r\rxyz
6341 0:
6342    abc\n\rxyz
6343 0:
6344\= Expect no match
6345    abc\r\nxyz
6346No match
6347
6348/^X/m
6349    XABC
6350 0: X
6351\= Expect no match
6352    XABC\=notbol
6353No match
6354
6355/(?m)^$/g,newline=any,aftertext
6356    abc\r\n\r\n
6357 0:
6358 0+ \x0d\x0a
6359
6360/(?m)^$|^\r\n/g,newline=any,aftertext
6361    abc\r\n\r\n
6362 0: \x0d\x0a
6363 0+
6364 1:
6365
6366/(?m)$/g,newline=any,aftertext
6367    abc\r\n\r\n
6368 0:
6369 0+ \x0d\x0a\x0d\x0a
6370 0:
6371 0+ \x0d\x0a
6372 0:
6373 0+
6374
6375/(?|(abc)|(xyz))/
6376   >abc<
6377 0: abc
6378   >xyz<
6379 0: xyz
6380
6381/(x)(?|(abc)|(xyz))(x)/
6382    xabcx
6383 0: xabcx
6384    xxyzx
6385 0: xxyzx
6386
6387/(x)(?|(abc)(pqr)|(xyz))(x)/
6388    xabcpqrx
6389 0: xabcpqrx
6390    xxyzx
6391 0: xxyzx
6392
6393/(?|(abc)|(xyz))(?1)/
6394    abcabc
6395 0: abcabc
6396    xyzabc
6397 0: xyzabc
6398\= Expect no match
6399    xyzxyz
6400No match
6401
6402/\H\h\V\v/
6403    X X\x0a
6404 0: X X\x0a
6405    X\x09X\x0b
6406 0: X\x09X\x0b
6407\= Expect no match
6408    \xa0 X\x0a
6409No match
6410
6411/\H*\h+\V?\v{3,4}/
6412    \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
6413 0: \x09 \xa0X\x0a\x0b\x0c\x0d
6414    \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
6415 0: \x09 \xa0\x0a\x0b\x0c\x0d
6416    \x09\x20\xa0\x0a\x0b\x0c
6417 0: \x09 \xa0\x0a\x0b\x0c
6418\= Expect no match
6419    \x09\x20\xa0\x0a\x0b
6420No match
6421
6422/\H{3,4}/
6423    XY  ABCDE
6424 0: ABCD
6425    XY  PQR ST
6426 0: PQR
6427
6428/.\h{3,4}./
6429    XY  AB    PQRS
6430 0: B    P
6431 1: B
6432
6433/\h*X\h?\H+Y\H?Z/
6434    >XNNNYZ
6435 0: XNNNYZ
6436    >  X NYQZ
6437 0:   X NYQZ
6438\= Expect no match
6439    >XYZ
6440No match
6441    >  X NY Z
6442No match
6443
6444/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
6445    >XY\x0aZ\x0aA\x0bNN\x0c
6446 0: XY\x0aZ\x0aA\x0bNN\x0c
6447    >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
6448 0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
6449
6450/.+A/newline=crlf
6451\= Expect no match
6452    \r\nA
6453No match
6454
6455/\nA/newline=crlf
6456    \r\nA
6457 0: \x0aA
6458
6459/[\r\n]A/newline=crlf
6460    \r\nA
6461 0: \x0aA
6462
6463/(\r|\n)A/newline=crlf
6464    \r\nA
6465 0: \x0aA
6466
6467/a\Rb/I,bsr=anycrlf
6468Capturing subpattern count = 0
6469\R matches CR, LF, or CRLF
6470First code unit = 'a'
6471Last code unit = 'b'
6472Subject length lower bound = 3
6473    a\rb
6474 0: a\x0db
6475    a\nb
6476 0: a\x0ab
6477    a\r\nb
6478 0: a\x0d\x0ab
6479\= Expect no match
6480    a\x85b
6481No match
6482    a\x0bb
6483No match
6484
6485/a\Rb/I,bsr=unicode
6486Capturing subpattern count = 0
6487\R matches any Unicode newline
6488First code unit = 'a'
6489Last code unit = 'b'
6490Subject length lower bound = 3
6491    a\rb
6492 0: a\x0db
6493    a\nb
6494 0: a\x0ab
6495    a\r\nb
6496 0: a\x0d\x0ab
6497    a\x85b
6498 0: a\x85b
6499    a\x0bb
6500 0: a\x0bb
6501
6502/a\R?b/I,bsr=anycrlf
6503Capturing subpattern count = 0
6504\R matches CR, LF, or CRLF
6505First code unit = 'a'
6506Last code unit = 'b'
6507Subject length lower bound = 2
6508    a\rb
6509 0: a\x0db
6510    a\nb
6511 0: a\x0ab
6512    a\r\nb
6513 0: a\x0d\x0ab
6514\= Expect no match
6515    a\x85b
6516No match
6517    a\x0bb
6518No match
6519
6520/a\R?b/I,bsr=unicode
6521Capturing subpattern count = 0
6522\R matches any Unicode newline
6523First code unit = 'a'
6524Last code unit = 'b'
6525Subject length lower bound = 2
6526    a\rb
6527 0: a\x0db
6528    a\nb
6529 0: a\x0ab
6530    a\r\nb
6531 0: a\x0d\x0ab
6532    a\x85b
6533 0: a\x85b
6534    a\x0bb
6535 0: a\x0bb
6536
6537/a\R{2,4}b/I,bsr=anycrlf
6538Capturing subpattern count = 0
6539\R matches CR, LF, or CRLF
6540First code unit = 'a'
6541Last code unit = 'b'
6542Subject length lower bound = 4
6543    a\r\n\nb
6544 0: a\x0d\x0a\x0ab
6545    a\n\r\rb
6546 0: a\x0a\x0d\x0db
6547    a\r\n\r\n\r\n\r\nb
6548 0: a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0ab
6549\= Expect no match
6550    a\x0b\x0bb
6551No match
6552    a\x85\x85b
6553No match
6554
6555/a\R{2,4}b/I,bsr=unicode
6556Capturing subpattern count = 0
6557\R matches any Unicode newline
6558First code unit = 'a'
6559Last code unit = 'b'
6560Subject length lower bound = 4
6561    a\r\rb
6562 0: a\x0d\x0db
6563    a\n\n\nb
6564 0: a\x0a\x0a\x0ab
6565    a\r\n\n\r\rb
6566 0: a\x0d\x0a\x0a\x0d\x0db
6567    a\x85\x85b
6568 0: a\x85\x85b
6569    a\x0b\x0bb
6570 0: a\x0b\x0bb
6571\= Expect no match
6572    a\r\r\r\r\rb
6573No match
6574
6575/a(?!)|\wbc/
6576    abc
6577 0: abc
6578
6579/a[]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
6580\= Expect no match
6581    ab
6582No match
6583
6584/a[]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
6585\= Expect no match
6586    ab
6587No match
6588
6589/a[]*+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
6590\= Expect no match
6591    ab
6592No match
6593
6594/a[^]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
6595    aXb
6596 0: aXb
6597    a\nb
6598 0: a\x0ab
6599\= Expect no match
6600    ab
6601No match
6602
6603/a[^]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
6604    aXb
6605 0: aXb
6606    a\nX\nXb
6607 0: a\x0aX\x0aXb
6608\= Expect no match
6609    ab
6610No match
6611
6612/X$/dollar_endonly
6613    X
6614 0: X
6615\= Expect no match
6616    X\n
6617No match
6618
6619/X$/
6620    X
6621 0: X
6622    X\n
6623 0: X
6624
6625/xyz/auto_callout
6626  xyz
6627--->xyz
6628 +0 ^       x
6629 +1 ^^      y
6630 +2 ^ ^     z
6631 +3 ^  ^
6632 0: xyz
6633  abcxyz
6634--->abcxyz
6635 +0    ^       x
6636 +1    ^^      y
6637 +2    ^ ^     z
6638 +3    ^  ^
6639 0: xyz
6640\= Expect no match
6641  abc
6642No match
6643  abcxypqr
6644No match
6645
6646/xyz/auto_callout,no_start_optimize
6647  abcxyz
6648--->abcxyz
6649 +0 ^          x
6650 +0  ^         x
6651 +0   ^        x
6652 +0    ^       x
6653 +1    ^^      y
6654 +2    ^ ^     z
6655 +3    ^  ^
6656 0: xyz
6657\= Expect no match
6658  abc
6659--->abc
6660 +0 ^       x
6661 +0  ^      x
6662 +0   ^     x
6663 +0    ^    x
6664No match
6665  abcxypqr
6666--->abcxypqr
6667 +0 ^            x
6668 +0  ^           x
6669 +0   ^          x
6670 +0    ^         x
6671 +1    ^^        y
6672 +2    ^ ^       z
6673 +0     ^        x
6674 +0      ^       x
6675 +0       ^      x
6676 +0        ^     x
6677 +0         ^    x
6678No match
6679
6680/(*NO_START_OPT)xyz/auto_callout
6681  abcxyz
6682--->abcxyz
6683+15 ^          x
6684+15  ^         x
6685+15   ^        x
6686+15    ^       x
6687+16    ^^      y
6688+17    ^ ^     z
6689+18    ^  ^
6690 0: xyz
6691
6692/(?C)ab/
6693  ab
6694--->ab
6695  0 ^      a
6696 0: ab
6697  ab\=callout_none
6698 0: ab
6699
6700/ab/auto_callout
6701  ab
6702--->ab
6703 +0 ^      a
6704 +1 ^^     b
6705 +2 ^ ^
6706 0: ab
6707  ab\=callout_none
6708 0: ab
6709
6710/^"((?(?=[a])[^"])|b)*"$/auto_callout
6711    "ab"
6712--->"ab"
6713 +0 ^        ^
6714 +1 ^        "
6715 +2 ^^       ((?(?=[a])[^"])|b)*
6716+21 ^^       "
6717 +3 ^^       (?(?=[a])[^"])
6718+18 ^^       b
6719 +5 ^^       (?=[a])
6720 +8  ^       [a]
6721+11  ^^      )
6722+12 ^^       [^"]
6723+16 ^ ^      )
6724+17 ^ ^      |
6725+21 ^ ^      "
6726 +3 ^ ^      (?(?=[a])[^"])
6727+18 ^ ^      b
6728 +5 ^ ^      (?=[a])
6729 +8   ^      [a]
6730+19 ^  ^     )
6731+21 ^  ^     "
6732 +3 ^  ^     (?(?=[a])[^"])
6733+18 ^  ^     b
6734 +5 ^  ^     (?=[a])
6735 +8    ^     [a]
6736+17 ^  ^     |
6737+22 ^   ^    $
6738+23 ^   ^
6739 0: "ab"
6740    "ab"\=callout_none
6741 0: "ab"
6742
6743/\d+X|9+Y/
6744    ++++123999\=ps
6745Partial match: 123999
6746    ++++123999Y\=ps
6747 0: 999Y
6748
6749/Z(*F)/
6750\= Expect no match
6751    Z\=ps
6752No match
6753    ZA\=ps
6754No match
6755
6756/Z(?!)/
6757\= Expect no match
6758    Z\=ps
6759No match
6760    ZA\=ps
6761No match
6762
6763/dog(sbody)?/
6764    dogs\=ps
6765 0: dog
6766    dogs\=ph
6767Partial match: dogs
6768
6769/dog(sbody)??/
6770    dogs\=ps
6771 0: dog
6772    dogs\=ph
6773Partial match: dogs
6774
6775/dog|dogsbody/
6776    dogs\=ps
6777 0: dog
6778    dogs\=ph
6779Partial match: dogs
6780
6781/dogsbody|dog/
6782    dogs\=ps
6783 0: dog
6784    dogs\=ph
6785Partial match: dogs
6786
6787/Z(*F)Q|ZXY/
6788    Z\=ps
6789Partial match: Z
6790\= Expect no match
6791    ZA\=ps
6792No match
6793    X\=ps
6794No match
6795
6796/\bthe cat\b/
6797    the cat\=ps
6798 0: the cat
6799    the cat\=ph
6800Partial match: the cat
6801
6802/dog(sbody)?/
6803    dogs\=ps
6804 0: dog
6805    body\=dfa_restart
6806 0: body
6807
6808/dog(sbody)?/
6809    dogs\=ph
6810Partial match: dogs
6811    body\=dfa_restart
6812 0: body
6813
6814/abc/
6815   abc\=ps
6816 0: abc
6817   abc\=ph
6818 0: abc
6819
6820/abc\K123/
6821    xyzabc123pqr
6822Failed: error -42: pattern contains an item that is not supported for DFA matching
6823
6824/(?<=abc)123/
6825    xyzabc123pqr
6826 0: 123
6827    xyzabc12\=ps
6828Partial match: abc12
6829               <<<
6830    xyzabc12\=ph
6831Partial match: abc12
6832               <<<
6833
6834/\babc\b/
6835    +++abc+++
6836 0: abc
6837    +++ab\=ps
6838Partial match: +ab
6839               <
6840    +++ab\=ph
6841Partial match: +ab
6842               <
6843
6844/(?=C)/g,aftertext
6845    ABCDECBA
6846 0:
6847 0+ CDECBA
6848 0:
6849 0+ CBA
6850
6851/(abc|def|xyz)/I
6852Capturing subpattern count = 1
6853Starting code units: a d x
6854Subject length lower bound = 3
6855    terhjk;abcdaadsfe
6856 0: abc
6857    the quick xyz brown fox
6858 0: xyz
6859\= Expect no match
6860    thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
6861No match
6862
6863/(abc|def|xyz)/I,no_start_optimize
6864Capturing subpattern count = 1
6865Options: no_start_optimize
6866Subject length lower bound = 0
6867    terhjk;abcdaadsfe
6868 0: abc
6869    the quick xyz brown fox
6870 0: xyz
6871\= Expect no match
6872    thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
6873No match
6874
6875/abcd*/aftertext
6876    xxxxabcd\=ps
6877 0: abcd
6878 0+
6879    xxxxabcd\=ph
6880Partial match: abcd
6881    dddxxx\=dfa_restart
6882 0: ddd
6883 0+ xxx
6884    xxxxabcd\=ph
6885Partial match: abcd
6886    xxx\=dfa_restart
6887 0:
6888 0+ xxx
6889
6890/abcd*/i
6891    xxxxabcd\=ps
6892 0: abcd
6893    xxxxabcd\=ph
6894Partial match: abcd
6895    XXXXABCD\=ps
6896 0: ABCD
6897    XXXXABCD\=ph
6898Partial match: ABCD
6899
6900/abc\d*/
6901    xxxxabc1\=ps
6902 0: abc1
6903    xxxxabc1\=ph
6904Partial match: abc1
6905
6906/abc[de]*/
6907    xxxxabcde\=ps
6908 0: abcde
6909    xxxxabcde\=ph
6910Partial match: abcde
6911
6912/(?:(?1)|B)(A(*F)|C)/
6913    ABCD
6914 0: BC
6915    CCD
6916 0: CC
6917\= Expect no match
6918    CAD
6919No match
6920
6921/^(?:(?1)|B)(A(*F)|C)/
6922    CCD
6923 0: CC
6924    BCD
6925 0: BC
6926\= Expect no match
6927    ABCD
6928No match
6929    CAD
6930No match
6931    BAD
6932No match
6933
6934/^(?!a(*SKIP)b)/
6935    ac
6936Failed: error -42: pattern contains an item that is not supported for DFA matching
6937
6938/^(?=a(*SKIP)b|ac)/
6939    ac
6940Failed: error -42: pattern contains an item that is not supported for DFA matching
6941
6942/^(?=a(*THEN)b|ac)/
6943    ac
6944Failed: error -42: pattern contains an item that is not supported for DFA matching
6945
6946/^(?=a(*PRUNE)b)/
6947    ab
6948Failed: error -42: pattern contains an item that is not supported for DFA matching
6949
6950/^(?(?!a(*SKIP)b))/
6951    ac
6952Failed: error -42: pattern contains an item that is not supported for DFA matching
6953
6954/(?<=abc)def/
6955    abc\=ph
6956Partial match: abc
6957               <<<
6958
6959/abc$/
6960    abc
6961 0: abc
6962    abc\=ps
6963 0: abc
6964    abc\=ph
6965Partial match: abc
6966
6967/abc$/m
6968    abc
6969 0: abc
6970    abc\n
6971 0: abc
6972    abc\=ph
6973Partial match: abc
6974    abc\n\=ph
6975 0: abc
6976    abc\=ps
6977 0: abc
6978    abc\n\=ps
6979 0: abc
6980
6981/abc\z/
6982    abc
6983 0: abc
6984    abc\=ps
6985 0: abc
6986    abc\=ph
6987Partial match: abc
6988
6989/abc\Z/
6990    abc
6991 0: abc
6992    abc\=ps
6993 0: abc
6994    abc\=ph
6995Partial match: abc
6996
6997/abc\b/
6998    abc
6999 0: abc
7000    abc\=ps
7001 0: abc
7002    abc\=ph
7003Partial match: abc
7004
7005/abc\B/
7006    abc\=ps
7007Partial match: abc
7008    abc\=ph
7009Partial match: abc
7010\= Expect no match
7011    abc
7012No match
7013
7014/.+/
7015    abc\=offset=0
7016 0: abc
7017    abc\=offset=1
7018 0: bc
7019    abc\=offset=2
7020 0: c
7021\= Bad offsets
7022    abc\=offset=4
7023Failed: error -33: bad offset value
7024    abc\=offset=-4
7025** Invalid value in 'offset=-4'
7026\= Expect no match
7027    abc\=offset=3
7028No match
7029
7030/^(?:a)++\w/
7031     aaaab
7032 0: aaaab
7033\= Expect no match
7034     aaaa
7035No match
7036     bbb
7037No match
7038
7039/^(?:aa|(?:a)++\w)/
7040     aaaab
7041 0: aaaab
7042 1: aa
7043     aaaa
7044 0: aa
7045\= Expect no match
7046     bbb
7047No match
7048
7049/^(?:a)*+\w/
7050     aaaab
7051 0: aaaab
7052     bbb
7053 0: b
7054\= Expect no match
7055     aaaa
7056No match
7057
7058/^(a)++\w/
7059     aaaab
7060 0: aaaab
7061\= Expect no match
7062     aaaa
7063No match
7064     bbb
7065No match
7066
7067/^(a|)++\w/
7068     aaaab
7069 0: aaaab
7070\= Expect no match
7071     aaaa
7072No match
7073     bbb
7074No match
7075
7076/(?=abc){3}abc/aftertext
7077    abcabcabc
7078 0: abc
7079 0+ abcabc
7080\= Expect no match
7081    xyz
7082No match
7083
7084/(?=abc)+abc/aftertext
7085    abcabcabc
7086 0: abc
7087 0+ abcabc
7088\= Expect no match
7089    xyz
7090No match
7091
7092/(?=abc)++abc/aftertext
7093    abcabcabc
7094 0: abc
7095 0+ abcabc
7096\= Expect no match
7097    xyz
7098No match
7099
7100/(?=abc){0}xyz/
7101    xyz
7102 0: xyz
7103
7104/(?=abc){1}xyz/
7105\= Expect no match
7106    xyz
7107No match
7108
7109/(?=(a))?./
7110    ab
7111 0: a
7112    bc
7113 0: b
7114
7115/(?=(a))??./
7116    ab
7117 0: a
7118    bc
7119 0: b
7120
7121/^(?=(a)){0}b(?1)/
7122    backgammon
7123 0: ba
7124
7125/^(?=(?1))?[az]([abc])d/
7126    abd
7127 0: abd
7128    zcdxx
7129 0: zcd
7130
7131/^(?!a){0}\w+/
7132    aaaaa
7133 0: aaaaa
7134
7135/(?<=(abc))?xyz/
7136    abcxyz
7137 0: xyz
7138    pqrxyz
7139 0: xyz
7140
7141/((?2))((?1))/
7142    abc
7143Failed: error -52: nested recursion at the same subject position
7144
7145/(?(R)a+|(?R)b)/
7146    aaaabcde
7147 0: aaaab
7148
7149/(?(R)a+|((?R))b)/
7150    aaaabcde
7151 0: aaaab
7152
7153/((?(R)a+|(?1)b))/
7154    aaaabcde
7155 0: aaaab
7156
7157/((?(R2)a+|(?1)b))/
7158    aaaabcde
7159Failed: error -40: backreference condition or recursion test is not supported for DFA matching
7160
7161/(?(R)a*(?1)|((?R))b)/
7162    aaaabcde
7163Failed: error -52: nested recursion at the same subject position
7164
7165/(a+)/no_auto_possess
7166    aaaa\=ovector=3
7167Matched, but offsets vector is too small to show all matches
7168 0: aaaa
7169 1: aaa
7170 2: aa
7171    aaaa\=ovector=4
7172 0: aaaa
7173 1: aaa
7174 2: aa
7175 3: a
7176
7177/^\R/
7178    \r\=ps
7179 0: \x0d
7180    \r\=ph
7181Partial match: \x0d
7182
7183/^\R{2,3}x/
7184    \r\=ps
7185Partial match: \x0d
7186    \r\=ph
7187Partial match: \x0d
7188    \r\r\=ps
7189Partial match: \x0d\x0d
7190    \r\r\=ph
7191Partial match: \x0d\x0d
7192    \r\r\r\=ps
7193Partial match: \x0d\x0d\x0d
7194    \r\r\r\=ph
7195Partial match: \x0d\x0d\x0d
7196    \r\rx
7197 0: \x0d\x0dx
7198    \r\r\rx
7199 0: \x0d\x0d\x0dx
7200
7201/^\R{2,3}?x/
7202    \r\=ps
7203Partial match: \x0d
7204    \r\=ph
7205Partial match: \x0d
7206    \r\r\=ps
7207Partial match: \x0d\x0d
7208    \r\r\=ph
7209Partial match: \x0d\x0d
7210    \r\r\r\=ps
7211Partial match: \x0d\x0d\x0d
7212    \r\r\r\=ph
7213Partial match: \x0d\x0d\x0d
7214    \r\rx
7215 0: \x0d\x0dx
7216    \r\r\rx
7217 0: \x0d\x0d\x0dx
7218
7219/^\R?x/
7220    \r\=ps
7221Partial match: \x0d
7222    \r\=ph
7223Partial match: \x0d
7224    x
7225 0: x
7226    \rx
7227 0: \x0dx
7228
7229/^\R+x/
7230    \r\=ps
7231Partial match: \x0d
7232    \r\=ph
7233Partial match: \x0d
7234    \r\n\=ps
7235Partial match: \x0d\x0a
7236    \r\n\=ph
7237Partial match: \x0d\x0a
7238    \rx
7239 0: \x0dx
7240
7241/^a$/newline=crlf
7242    a\r\=ps
7243Partial match: a\x0d
7244    a\r\=ph
7245Partial match: a\x0d
7246
7247/^a$/m,newline=crlf
7248    a\r\=ps
7249Partial match: a\x0d
7250    a\r\=ph
7251Partial match: a\x0d
7252
7253/^(a$|a\r)/newline=crlf
7254    a\r\=ps
7255 0: a\x0d
7256    a\r\=ph
7257Partial match: a\x0d
7258
7259/^(a$|a\r)/m,newline=crlf
7260    a\r\=ps
7261 0: a\x0d
7262    a\r\=ph
7263Partial match: a\x0d
7264
7265/./newline=crlf
7266    \r\=ps
7267 0: \x0d
7268    \r\=ph
7269Partial match: \x0d
7270
7271/.{2,3}/newline=crlf
7272    \r\=ps
7273Partial match: \x0d
7274    \r\=ph
7275Partial match: \x0d
7276    \r\r\=ps
7277 0: \x0d\x0d
7278    \r\r\=ph
7279Partial match: \x0d\x0d
7280    \r\r\r\=ps
7281 0: \x0d\x0d\x0d
7282    \r\r\r\=ph
7283Partial match: \x0d\x0d\x0d
7284
7285/.{2,3}?/newline=crlf
7286    \r\=ps
7287Partial match: \x0d
7288    \r\=ph
7289Partial match: \x0d
7290    \r\r\=ps
7291 0: \x0d\x0d
7292    \r\r\=ph
7293Partial match: \x0d\x0d
7294    \r\r\r\=ps
7295 0: \x0d\x0d\x0d
7296 1: \x0d\x0d
7297    \r\r\r\=ph
7298Partial match: \x0d\x0d\x0d
7299
7300# Test simple validity check for restarts
7301
7302/abcdef/
7303   abc\=dfa_restart
7304Failed: error -38: invalid data in workspace for DFA restart
7305
7306/<H((?(?!<H|F>)(.)|(?R))++)*F>/
7307    text <H more text <H texting more  hexA0-"\xA0"    hex above 7F-"\xBC" F> text xxxxx <H text F> text F> text2 <H text sample F> more text.
7308 0: <H more text <H texting more  hexA0-"\xa0"    hex above 7F-"\xbc" F> text xxxxx <H text F> text F>
7309
7310/^(?>.{4})abc|^\w\w.xabcd/
7311    xxxxabcd
7312 0: xxxxabcd
7313 1: xxxxabc
7314    xx\xa0xabcd
7315 0: xx\xa0xabcd
7316 1: xx\xa0xabc
7317
7318/^(.{4}){2}+abc|^\w\w.x\w\w\w\wabcd/
7319    xxxxxxxxabcd
7320 0: xxxxxxxxabcd
7321 1: xxxxxxxxabc
7322    xx\xa0xxxxxabcd
7323 0: xx\xa0xxxxxabcd
7324 1: xx\xa0xxxxxabc
7325
7326/abcd/
7327    abcd\=ovector=0
7328 0: abcd
7329
7330# These tests show up auto-possessification
7331
7332/[ab]*/
7333    aaaa
7334 0: aaaa
7335
7336/[ab]*?/
7337    aaaa
7338 0: aaaa
7339 1: aaa
7340 2: aa
7341 3: a
7342 4:
7343
7344/[ab]?/
7345    aaaa
7346 0: a
7347
7348/[ab]??/
7349    aaaa
7350 0: a
7351 1:
7352
7353/[ab]+/
7354    aaaa
7355 0: aaaa
7356
7357/[ab]+?/
7358    aaaa
7359 0: aaaa
7360 1: aaa
7361 2: aa
7362 3: a
7363
7364/[ab]{2,3}/
7365    aaaa
7366 0: aaa
7367
7368/[ab]{2,3}?/
7369    aaaa
7370 0: aaa
7371 1: aa
7372
7373/[ab]{2,}/
7374    aaaa
7375 0: aaaa
7376
7377/[ab]{2,}?/
7378    aaaa
7379 0: aaaa
7380 1: aaa
7381 2: aa
7382
7383'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++'
7384    NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
7385 0: NON QUOTED "QUOT""ED" AFTER
7386
7387'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
7388    NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
7389 0: NON QUOTED "QUOT""ED" AFTER
7390
7391/abc(?=xyz)/allusedtext
7392    abcxyzpqr
7393 0: abcxyz
7394       >>>
7395    abcxyzpqr\=aftertext
7396 0: abcxyz
7397       >>>
7398 0+ xyzpqr
7399
7400/(?<=pqr)abc(?=xyz)/allusedtext
7401    xyzpqrabcxyzpqr
7402 0: pqrabcxyz
7403    <<<   >>>
7404    xyzpqrabcxyzpqr\=aftertext
7405 0: pqrabcxyz
7406    <<<   >>>
7407 0+ xyzpqr
7408
7409/a\b/
7410    a.\=allusedtext
7411 0: a.
7412     >
7413    a\=allusedtext
7414 0: a
7415
7416/abc(?=abcde)(?=ab)/allusedtext
7417    abcabcdefg
7418 0: abcabcde
7419       >>>>>
7420
7421/a*?b*?/
7422    ab
7423 0: ab
7424 1: a
7425 2:
7426
7427/(*NOTEMPTY)a*?b*?/
7428    ab
7429 0: ab
7430 1: a
7431    ba
7432 0: b
7433    cb
7434 0: b
7435
7436/(*NOTEMPTY_ATSTART)a*?b*?/aftertext
7437    ab
7438 0: ab
7439 0+
7440 1: a
7441    cdab
7442 0:
7443 0+ dab
7444
7445/(a)(b)|(c)/
7446    XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
7447 0: c
7448Get substring 1 failed (-55): requested value is not set
7449Get substring 2 failed (-54): requested value is not available
7450Get substring 3 failed (-54): requested value is not available
7451Get substring 4 failed (-54): requested value is not available
7452 0L c
7453
7454/(?<A>aa)/
7455    aa\=get=A
7456 0: aa
7457Get substring 'A' failed (-41): function is not supported for DFA matching
7458    aa\=copy=A
7459 0: aa
7460Copy substring 'A' failed (-41): function is not supported for DFA matching
7461
7462/a+/no_auto_possess
7463    a\=ovector=2,get=1,get=2,getall
7464 0: a
7465Get substring 1 failed (-55): requested value is not set
7466Get substring 2 failed (-54): requested value is not available
7467 0L a
7468    aaa\=ovector=2,get=1,get=2,getall
7469Matched, but offsets vector is too small to show all matches
7470 0: aaa
7471 1: aa
7472 1G aa (2)
7473Get substring 2 failed (-54): requested value is not available
7474 0L aaa
7475 1L aa
7476
7477/a(b)c(d)/
7478    abc\=ph,copy=0,copy=1,getall
7479Partial match: abc
7480 0C abc (3)
7481Copy substring 1 failed (-2): partial match
7482get substring list failed (-2): partial match
7483
7484/ab(?C" any text with spaces ")cde/B
7485------------------------------------------------------------------
7486        Bra
7487        ab
7488        CalloutStr " any text with spaces " 6 30 1
7489        cde
7490        Ket
7491        End
7492------------------------------------------------------------------
7493    abcde
7494Callout (6): " any text with spaces "
7495--->abcde
7496    ^ ^       c
7497 0: abcde
7498    12abcde
7499Callout (6): " any text with spaces "
7500--->12abcde
7501      ^ ^       c
7502 0: abcde
7503
7504/^a(b)c(?C1)def/
7505      abcdef
7506--->abcdef
7507  1 ^  ^       d
7508 0: abcdef
7509
7510/^a(b)c(?C"AB")def/
7511      abcdef
7512Callout (10): "AB"
7513--->abcdef
7514    ^  ^       d
7515 0: abcdef
7516
7517/^a(b)c(?C1)def/
7518      abcdef\=callout_capture
7519Callout 1: last capture = 0
7520 0:
7521--->abcdef
7522    ^  ^       d
7523 0: abcdef
7524
7525/^a(b)c(?C{AB})def/B
7526------------------------------------------------------------------
7527        Bra
7528        ^
7529        a
7530        CBra 1
7531        b
7532        Ket
7533        c
7534        CalloutStr {AB} 10 14 1
7535        def
7536        Ket
7537        End
7538------------------------------------------------------------------
7539      abcdef\=callout_capture
7540Callout (10): {AB} last capture = 0
7541 0:
7542--->abcdef
7543    ^  ^       d
7544 0: abcdef
7545
7546/^(?(?C25)(?=abc)abcd|xyz)/B
7547------------------------------------------------------------------
7548        Bra
7549        ^
7550        Cond
7551        Callout 25 9 7
7552        Assert
7553        abc
7554        Ket
7555        abcd
7556        Alt
7557        xyz
7558        Ket
7559        Ket
7560        End
7561------------------------------------------------------------------
7562    abcdefg
7563--->abcdefg
7564 25 ^           (?=abc)
7565 0: abcd
7566    xyz123
7567--->xyz123
7568 25 ^          (?=abc)
7569 0: xyz
7570
7571/^(?(?C$abc$)(?=abc)abcd|xyz)/B
7572------------------------------------------------------------------
7573        Bra
7574        ^
7575        Cond
7576        CalloutStr $abc$ 7 12 7
7577        Assert
7578        abc
7579        Ket
7580        abcd
7581        Alt
7582        xyz
7583        Ket
7584        Ket
7585        End
7586------------------------------------------------------------------
7587    abcdefg
7588Callout (7): $abc$
7589--->abcdefg
7590    ^           (?=abc)
7591 0: abcd
7592    xyz123
7593Callout (7): $abc$
7594--->xyz123
7595    ^          (?=abc)
7596 0: xyz
7597
7598/^ab(?C'first')cd(?C"second")ef/
7599    abcdefg
7600Callout (7): 'first'
7601--->abcdefg
7602    ^ ^         c
7603Callout (20): "second"
7604--->abcdefg
7605    ^   ^       e
7606 0: abcdef
7607
7608/(?:a(?C`code`)){3}X/
7609    aaaXY
7610Callout (8): `code`
7611--->aaaXY
7612    ^^        )
7613Callout (8): `code`
7614--->aaaXY
7615    ^ ^       )
7616Callout (8): `code`
7617--->aaaXY
7618    ^  ^      )
7619 0: aaaX
7620
7621# Binary zero in callout string
7622/"a(?C'x" 00 "z')b"/hex
7623    abcdefgh
7624Callout (5): 'x\x00z'
7625--->abcdefgh
7626    ^^           b
7627 0: ab
7628
7629/(?(?!)a|b)/
7630    bbb
7631 0: b
7632\= Expect no match
7633    aaa
7634No match
7635
7636/^/gm
7637    \n\n\n
7638 0:
7639 0:
7640 0:
7641
7642/^/gm,alt_circumflex
7643    \n\n\n
7644 0:
7645 0:
7646 0:
7647 0:
7648
7649/abc/use_offset_limit
7650    1234abcde\=offset_limit=100
7651 0: abc
7652    1234abcde\=offset_limit=9
7653 0: abc
7654    1234abcde\=offset_limit=4
7655 0: abc
7656    1234abcde\=offset_limit=4,offset=4
7657 0: abc
7658\= Expect no match
7659    1234abcde\=offset_limit=4,offset=5
7660No match
7661    1234abcde\=offset_limit=3
7662No match
7663
7664/(?<=abc)/use_offset_limit
7665    1234abc\=offset_limit=7
7666 0:
7667\= Expect no match
7668    1234abc\=offset_limit=6
7669No match
7670
7671/abcd/null_context
7672    abcd\=null_context
7673 0: abcd
7674
7675/()()a+/no_auto_possess
7676    aaa\=dfa,allcaptures
7677** Ignored after DFA matching: allcaptures
7678 0: aaa
7679 1: aa
7680 2: a
7681    a\=dfa,allcaptures
7682** Ignored after DFA matching: allcaptures
7683 0: a
7684
7685# End of testinput6
7686