• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ^          (
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 ^     ^    End of pattern
730 +1 ^     ^    a
731 +4 ^     ^    c
732 0: ababab
733  abcdabcd
734--->abcdabcd
735 +0 ^            (
736 +1 ^            a
737 +4 ^            c
738 +2 ^^           b
739 +3 ^ ^          |
740 +1 ^ ^          a
741 +4 ^ ^          c
742 +5 ^  ^         d
743 +6 ^   ^        ){3,4}
744 +1 ^   ^        a
745 +4 ^   ^        c
746 +2 ^    ^       b
747 +3 ^     ^      |
748+12 ^     ^      End of pattern
749 +1 ^     ^      a
750 +4 ^     ^      c
751 +5 ^      ^     d
752 +6 ^       ^    ){3,4}
753+12 ^       ^    End of pattern
754 0: abcdabcd
755 1: abcdab
756  abcdcdcdcdcd
757--->abcdcdcdcdcd
758 +0 ^                (
759 +1 ^                a
760 +4 ^                c
761 +2 ^^               b
762 +3 ^ ^              |
763 +1 ^ ^              a
764 +4 ^ ^              c
765 +5 ^  ^             d
766 +6 ^   ^            ){3,4}
767 +1 ^   ^            a
768 +4 ^   ^            c
769 +5 ^    ^           d
770 +6 ^     ^          ){3,4}
771+12 ^     ^          End of pattern
772 +1 ^     ^          a
773 +4 ^     ^          c
774 +5 ^      ^         d
775 +6 ^       ^        ){3,4}
776+12 ^       ^        End of pattern
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,allusedtext
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/\x5c/
2678    \\
2679 0: \
2680
2681/\x20Z/
2682    the Zoo
2683 0:  Z
2684\= Expect no match
2685    Zulu
2686No match
2687
2688/ab{3cd/
2689    ab{3cd
2690 0: ab{3cd
2691
2692/ab{3,cd/
2693    ab{3,cd
2694 0: ab{3,cd
2695
2696/ab{3,4a}cd/
2697    ab{3,4a}cd
2698 0: ab{3,4a}cd
2699
2700/{4,5a}bc/
2701    {4,5a}bc
2702 0: {4,5a}bc
2703
2704/^a.b/newline=lf
2705    a\rb
2706 0: a\x0db
2707\= Expect no match
2708    a\nb
2709No match
2710
2711/abc$/
2712    abc
2713 0: abc
2714    abc\n
2715 0: abc
2716\= Expect no match
2717    abc\ndef
2718No match
2719
2720/(abc)\123/
2721    abc\x53
2722 0: abcS
2723
2724/(abc)\223/
2725    abc\x93
2726 0: abc\x93
2727
2728/(abc)\323/
2729    abc\xd3
2730 0: abc\xd3
2731
2732/(abc)\100/
2733    abc\x40
2734 0: abc@
2735    abc\100
2736 0: abc@
2737
2738/(abc)\1000/
2739    abc\x400
2740 0: abc@0
2741    abc\x40\x30
2742 0: abc@0
2743    abc\1000
2744 0: abc@0
2745    abc\100\x30
2746 0: abc@0
2747    abc\100\060
2748 0: abc@0
2749    abc\100\60
2750 0: abc@0
2751
2752/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
2753    abcdefghijk\12S
2754 0: abcdefghijk\x0aS
2755
2756/a{0}bc/
2757    bc
2758 0: bc
2759
2760/(a|(bc)){0,0}?xyz/
2761    xyz
2762 0: xyz
2763
2764/abc[\10]de/
2765    abc\010de
2766 0: abc\x08de
2767
2768/abc[\1]de/
2769    abc\1de
2770 0: abc\x01de
2771
2772/(abc)[\1]de/
2773    abc\1de
2774 0: abc\x01de
2775
2776/(?s)a.b/
2777    a\nb
2778 0: a\x0ab
2779
2780/^([^a])([^\b])([^c]*)([^d]{3,4})/
2781    baNOTccccd
2782 0: baNOTcccc
2783 1: baNOTccc
2784 2: baNOTcc
2785 3: baNOTc
2786    baNOTcccd
2787 0: baNOTccc
2788 1: baNOTcc
2789 2: baNOTc
2790    baNOTccd
2791 0: baNOTcc
2792 1: baNOTc
2793    bacccd
2794 0: baccc
2795\= Expect no match
2796    anything
2797No match
2798    b\bc
2799No match
2800    baccd
2801No match
2802
2803/[^a]/
2804    Abc
2805 0: A
2806
2807/[^a]/i
2808    Abc
2809 0: b
2810
2811/[^a]+/
2812    AAAaAbc
2813 0: AAA
2814
2815/[^a]+/i
2816    AAAaAbc
2817 0: bc
2818
2819/[^a]+/
2820    bbb\nccc
2821 0: bbb\x0accc
2822
2823/[^k]$/
2824    abc
2825 0: c
2826\= Expect no match
2827    abk
2828No match
2829
2830/[^k]{2,3}$/
2831    abc
2832 0: abc
2833    kbc
2834 0: bc
2835    kabc
2836 0: abc
2837\= Expect no match
2838    abk
2839No match
2840    akb
2841No match
2842    akk
2843No match
2844
2845/^\d{8,}\@.+[^k]$/
2846    12345678\@a.b.c.d
2847 0: 12345678@a.b.c.d
2848    123456789\@x.y.z
2849 0: 123456789@x.y.z
2850\= Expect no match
2851    12345678\@x.y.uk
2852No match
2853    1234567\@a.b.c.d
2854No match
2855
2856/[^a]/
2857    aaaabcd
2858 0: b
2859    aaAabcd
2860 0: A
2861
2862/[^a]/i
2863    aaaabcd
2864 0: b
2865    aaAabcd
2866 0: b
2867
2868/[^az]/
2869    aaaabcd
2870 0: b
2871    aaAabcd
2872 0: A
2873
2874/[^az]/i
2875    aaaabcd
2876 0: b
2877    aaAabcd
2878 0: b
2879
2880/\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/
2881 \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
2882 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
2883
2884/P[^*]TAIRE[^*]{1,6}?LL/
2885    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2886 0: PSTAIREISLL
2887
2888/P[^*]TAIRE[^*]{1,}?LL/
2889    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2890 0: PSTAIREISLL
2891
2892/(\.\d\d[1-9]?)\d+/
2893    1.230003938
2894 0: .230003938
2895    1.875000282
2896 0: .875000282
2897    1.235
2898 0: .235
2899
2900/(\.\d\d((?=0)|\d(?=\d)))/
2901    1.230003938
2902 0: .230
2903 1: .23
2904    1.875000282
2905 0: .875
2906\= Expect no match
2907    1.235
2908No match
2909
2910/a(?)b/
2911    ab
2912 0: ab
2913
2914/\b(foo)\s+(\w+)/i
2915    Food is on the foo table
2916 0: foo table
2917
2918/foo(.*)bar/
2919    The food is under the bar in the barn.
2920 0: food is under the bar in the bar
2921 1: food is under the bar
2922
2923/foo(.*?)bar/
2924    The food is under the bar in the barn.
2925 0: food is under the bar in the bar
2926 1: food is under the bar
2927
2928/(.*)(\d*)/no_auto_possess
2929    I have 2 numbers: 53147
2930Matched, but offsets vector is too small to show all matches
2931 0: I have 2 numbers: 53147
2932 1: I have 2 numbers: 5314
2933 2: I have 2 numbers: 531
2934 3: I have 2 numbers: 53
2935 4: I have 2 numbers: 5
2936 5: I have 2 numbers:
2937 6: I have 2 numbers:
2938 7: I have 2 numbers
2939 8: I have 2 number
2940 9: I have 2 numbe
294110: I have 2 numb
294211: I have 2 num
294312: I have 2 nu
294413: I have 2 n
294514: I have 2
2946
2947/(.*)(\d+)/
2948    I have 2 numbers: 53147
2949 0: I have 2 numbers: 53147
2950 1: I have 2
2951
2952/(.*?)(\d*)/no_auto_possess
2953    I have 2 numbers: 53147
2954Matched, but offsets vector is too small to show all matches
2955 0: I have 2 numbers: 53147
2956 1: I have 2 numbers: 5314
2957 2: I have 2 numbers: 531
2958 3: I have 2 numbers: 53
2959 4: I have 2 numbers: 5
2960 5: I have 2 numbers:
2961 6: I have 2 numbers:
2962 7: I have 2 numbers
2963 8: I have 2 number
2964 9: I have 2 numbe
296510: I have 2 numb
296611: I have 2 num
296712: I have 2 nu
296813: I have 2 n
296914: I have 2
2970
2971/(.*?)(\d+)/
2972    I have 2 numbers: 53147
2973 0: I have 2 numbers: 53147
2974 1: I have 2
2975
2976/(.*)(\d+)$/
2977    I have 2 numbers: 53147
2978 0: I have 2 numbers: 53147
2979
2980/(.*?)(\d+)$/
2981    I have 2 numbers: 53147
2982 0: I have 2 numbers: 53147
2983
2984/(.*)\b(\d+)$/
2985    I have 2 numbers: 53147
2986 0: I have 2 numbers: 53147
2987
2988/(.*\D)(\d+)$/
2989    I have 2 numbers: 53147
2990 0: I have 2 numbers: 53147
2991
2992/^\D*(?!123)/
2993    ABC123
2994 0: AB
2995 1: A
2996 2:
2997
2998/^(\D*)(?=\d)(?!123)/
2999    ABC445
3000 0: ABC
3001\= Expect no match
3002    ABC123
3003No match
3004
3005/^[W-]46]/
3006    W46]789
3007 0: W46]
3008    -46]789
3009 0: -46]
3010\= Expect no match
3011    Wall
3012No match
3013    Zebra
3014No match
3015    42
3016No match
3017    [abcd]
3018No match
3019    ]abcd[
3020No match
3021
3022/^[W-\]46]/
3023    W46]789
3024 0: W
3025    Wall
3026 0: W
3027    Zebra
3028 0: Z
3029    Xylophone
3030 0: X
3031    42
3032 0: 4
3033    [abcd]
3034 0: [
3035    ]abcd[
3036 0: ]
3037    \\backslash
3038 0: \
3039\= Expect no match
3040    -46]789
3041No match
3042    well
3043No match
3044
3045/\d\d\/\d\d\/\d\d\d\d/
3046    01/01/2000
3047 0: 01/01/2000
3048
3049/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
3050  word cat dog elephant mussel cow horse canary baboon snake shark otherword
3051 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
3052\= Expect no match
3053  word cat dog elephant mussel cow horse canary baboon snake shark
3054No match
3055
3056/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
3057\= Expect no match
3058  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
3059No match
3060
3061/^(a){0,0}/
3062    bcd
3063 0:
3064    abc
3065 0:
3066    aab
3067 0:
3068
3069/^(a){0,1}/
3070    bcd
3071 0:
3072    abc
3073 0: a
3074 1:
3075    aab
3076 0: a
3077 1:
3078
3079/^(a){0,2}/
3080    bcd
3081 0:
3082    abc
3083 0: a
3084 1:
3085    aab
3086 0: aa
3087 1: a
3088 2:
3089
3090/^(a){0,3}/
3091    bcd
3092 0:
3093    abc
3094 0: a
3095 1:
3096    aab
3097 0: aa
3098 1: a
3099 2:
3100    aaa
3101 0: aaa
3102 1: aa
3103 2: a
3104 3:
3105
3106/^(a){0,}/
3107    bcd
3108 0:
3109    abc
3110 0: a
3111 1:
3112    aab
3113 0: aa
3114 1: a
3115 2:
3116    aaa
3117 0: aaa
3118 1: aa
3119 2: a
3120 3:
3121    aaaaaaaa
3122 0: aaaaaaaa
3123 1: aaaaaaa
3124 2: aaaaaa
3125 3: aaaaa
3126 4: aaaa
3127 5: aaa
3128 6: aa
3129 7: a
3130 8:
3131
3132/^(a){1,1}/
3133    abc
3134 0: a
3135    aab
3136 0: a
3137\= Expect no match
3138    bcd
3139No match
3140
3141/^(a){1,2}/
3142    abc
3143 0: a
3144    aab
3145 0: aa
3146 1: a
3147\= Expect no match
3148    bcd
3149No match
3150
3151/^(a){1,3}/
3152    abc
3153 0: a
3154    aab
3155 0: aa
3156 1: a
3157    aaa
3158 0: aaa
3159 1: aa
3160 2: a
3161\= Expect no match
3162    bcd
3163No match
3164
3165/^(a){1,}/
3166    abc
3167 0: a
3168    aab
3169 0: aa
3170 1: a
3171    aaa
3172 0: aaa
3173 1: aa
3174 2: a
3175    aaaaaaaa
3176 0: aaaaaaaa
3177 1: aaaaaaa
3178 2: aaaaaa
3179 3: aaaaa
3180 4: aaaa
3181 5: aaa
3182 6: aa
3183 7: a
3184\= Expect no match
3185    bcd
3186No match
3187
3188/.*\.gif/
3189    borfle\nbib.gif\nno
3190 0: bib.gif
3191
3192/.{0,}\.gif/
3193    borfle\nbib.gif\nno
3194 0: bib.gif
3195
3196/.*\.gif/m
3197    borfle\nbib.gif\nno
3198 0: bib.gif
3199
3200/.*\.gif/s
3201    borfle\nbib.gif\nno
3202 0: borfle\x0abib.gif
3203
3204/.*\.gif/ms
3205    borfle\nbib.gif\nno
3206 0: borfle\x0abib.gif
3207
3208/.*$/
3209    borfle\nbib.gif\nno
3210 0: no
3211
3212/.*$/m
3213    borfle\nbib.gif\nno
3214 0: borfle
3215
3216/.*$/s
3217    borfle\nbib.gif\nno
3218 0: borfle\x0abib.gif\x0ano
3219
3220/.*$/ms
3221    borfle\nbib.gif\nno
3222 0: borfle\x0abib.gif\x0ano
3223 1: borfle\x0abib.gif
3224 2: borfle
3225
3226/.*$/
3227    borfle\nbib.gif\nno\n
3228 0: no
3229
3230/.*$/m
3231    borfle\nbib.gif\nno\n
3232 0: borfle
3233
3234/.*$/s
3235    borfle\nbib.gif\nno\n
3236 0: borfle\x0abib.gif\x0ano\x0a
3237 1: borfle\x0abib.gif\x0ano
3238
3239/.*$/ms
3240    borfle\nbib.gif\nno\n
3241 0: borfle\x0abib.gif\x0ano\x0a
3242 1: borfle\x0abib.gif\x0ano
3243 2: borfle\x0abib.gif
3244 3: borfle
3245
3246/(.*X|^B)/
3247    abcde\n1234Xyz
3248 0: 1234X
3249    BarFoo
3250 0: B
3251\= Expect no match
3252    abcde\nBar
3253No match
3254
3255/(.*X|^B)/m
3256    abcde\n1234Xyz
3257 0: 1234X
3258    BarFoo
3259 0: B
3260    abcde\nBar
3261 0: B
3262
3263/(.*X|^B)/s
3264    abcde\n1234Xyz
3265 0: abcde\x0a1234X
3266    BarFoo
3267 0: B
3268\= Expect no match
3269    abcde\nBar
3270No match
3271
3272/(.*X|^B)/ms
3273    abcde\n1234Xyz
3274 0: abcde\x0a1234X
3275    BarFoo
3276 0: B
3277    abcde\nBar
3278 0: B
3279
3280/(?s)(.*X|^B)/
3281    abcde\n1234Xyz
3282 0: abcde\x0a1234X
3283    BarFoo
3284 0: B
3285\= Expect no match
3286    abcde\nBar
3287No match
3288
3289/(?s:.*X|^B)/
3290    abcde\n1234Xyz
3291 0: abcde\x0a1234X
3292    BarFoo
3293 0: B
3294\= Expect no match
3295    abcde\nBar
3296No match
3297
3298/^.*B/
3299\= Expect no match
3300    abc\nB
3301No match
3302
3303/(?s)^.*B/
3304    abc\nB
3305 0: abc\x0aB
3306
3307/(?m)^.*B/
3308    abc\nB
3309 0: B
3310
3311/(?ms)^.*B/
3312    abc\nB
3313 0: abc\x0aB
3314
3315/(?ms)^B/
3316    abc\nB
3317 0: B
3318
3319/(?s)B$/
3320    B\n
3321 0: B
3322
3323/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
3324    123456654321
3325 0: 123456654321
3326
3327/^\d\d\d\d\d\d\d\d\d\d\d\d/
3328    123456654321
3329 0: 123456654321
3330
3331/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
3332    123456654321
3333 0: 123456654321
3334
3335/^[abc]{12}/
3336    abcabcabcabc
3337 0: abcabcabcabc
3338
3339/^[a-c]{12}/
3340    abcabcabcabc
3341 0: abcabcabcabc
3342
3343/^(a|b|c){12}/
3344    abcabcabcabc
3345 0: abcabcabcabc
3346
3347/^[abcdefghijklmnopqrstuvwxy0123456789]/
3348    n
3349 0: n
3350\= Expect no match
3351    z
3352No match
3353
3354/abcde{0,0}/
3355    abcd
3356 0: abcd
3357\= Expect no match
3358    abce
3359No match
3360
3361/ab[cd]{0,0}e/
3362    abe
3363 0: abe
3364\= Expect no match
3365    abcde
3366No match
3367
3368/ab(c){0,0}d/
3369    abd
3370 0: abd
3371\= Expect no match
3372    abcd
3373No match
3374
3375/a(b*)/
3376    a
3377 0: a
3378    ab
3379 0: ab
3380    abbbb
3381 0: abbbb
3382\= Expect no match
3383    bbbbb
3384No match
3385
3386/ab\d{0}e/
3387    abe
3388 0: abe
3389\= Expect no match
3390    ab1e
3391No match
3392
3393/"([^\\"]+|\\.)*"/
3394    the \"quick\" brown fox
3395 0: "quick"
3396    \"the \\\"quick\\\" brown fox\"
3397 0: "the \"quick\" brown fox"
3398
3399/.*?/g,aftertext
3400    abc
3401 0: abc
3402 0+
3403 1: ab
3404 2: a
3405 3:
3406 0:
3407 0+
3408
3409/\b/g,aftertext
3410    abc
3411 0:
3412 0+ abc
3413 0:
3414 0+
3415
3416/\b/g,aftertext
3417    abc
3418 0:
3419 0+ abc
3420 0:
3421 0+
3422
3423//g
3424    abc
3425 0:
3426 0:
3427 0:
3428 0:
3429
3430/<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
3431  <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>
3432 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>
3433
3434/a[^a]b/
3435    acb
3436 0: acb
3437    a\nb
3438 0: a\x0ab
3439
3440/a.b/
3441    acb
3442 0: acb
3443\= Expect no match
3444    a\nb
3445No match
3446
3447/a[^a]b/s
3448    acb
3449 0: acb
3450    a\nb
3451 0: a\x0ab
3452
3453/a.b/s
3454    acb
3455 0: acb
3456    a\nb
3457 0: a\x0ab
3458
3459/^(b+?|a){1,2}?c/
3460    bac
3461 0: bac
3462    bbac
3463 0: bbac
3464    bbbac
3465 0: bbbac
3466    bbbbac
3467 0: bbbbac
3468    bbbbbac
3469 0: bbbbbac
3470
3471/^(b+|a){1,2}?c/
3472    bac
3473 0: bac
3474    bbac
3475 0: bbac
3476    bbbac
3477 0: bbbac
3478    bbbbac
3479 0: bbbbac
3480    bbbbbac
3481 0: bbbbbac
3482
3483/(?!\A)x/m
3484    a\bx\n
3485 0: x
3486\= Expect no match
3487    x\nb\n
3488No match
3489
3490/\x0{ab}/
3491    \0{ab}
3492 0: \x00{ab}
3493
3494/(A|B)*?CD/
3495    CD
3496 0: CD
3497
3498/(A|B)*CD/
3499    CD
3500 0: CD
3501
3502/(?<!bar)foo/
3503    foo
3504 0: foo
3505    catfood
3506 0: foo
3507    arfootle
3508 0: foo
3509    rfoosh
3510 0: foo
3511\= Expect no match
3512    barfoo
3513No match
3514    towbarfoo
3515No match
3516
3517/\w{3}(?<!bar)foo/
3518    catfood
3519 0: catfoo
3520\= Expect no match
3521    foo
3522No match
3523    barfoo
3524No match
3525    towbarfoo
3526No match
3527
3528/(?<=(foo)a)bar/
3529    fooabar
3530 0: bar
3531\= Expect no match
3532    bar
3533No match
3534    foobbar
3535No match
3536
3537/\Aabc\z/m
3538    abc
3539 0: abc
3540\= Expect no match
3541    abc\n
3542No match
3543    qqq\nabc
3544No match
3545    abc\nzzz
3546No match
3547    qqq\nabc\nzzz
3548No match
3549
3550"(?>.*/)foo"
3551\= Expect no match
3552    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
3553No match
3554
3555"(?>.*/)foo"
3556    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
3557 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
3558
3559/(?>(\.\d\d[1-9]?))\d+/
3560    1.230003938
3561 0: .230003938
3562    1.875000282
3563 0: .875000282
3564\= Expect no match
3565    1.235
3566No match
3567
3568/^((?>\w+)|(?>\s+))*$/
3569    now is the time for all good men to come to the aid of the party
3570 0: now is the time for all good men to come to the aid of the party
3571\= Expect no match
3572    this is not a line with only words and spaces!
3573No match
3574
3575/(\d+)(\w)/
3576    12345a
3577 0: 12345a
3578 1: 12345
3579 2: 1234
3580 3: 123
3581 4: 12
3582    12345+
3583 0: 12345
3584 1: 1234
3585 2: 123
3586 3: 12
3587
3588/((?>\d+))(\w)/
3589    12345a
3590 0: 12345a
3591\= Expect no match
3592    12345+
3593No match
3594
3595/(?>a+)b/
3596    aaab
3597 0: aaab
3598
3599/((?>a+)b)/
3600    aaab
3601 0: aaab
3602
3603/(?>(a+))b/
3604    aaab
3605 0: aaab
3606
3607/(?>b)+/
3608    aaabbbccc
3609 0: bbb
3610 1: bb
3611 2: b
3612
3613/(?>a+|b+|c+)*c/
3614    aaabbbbccccd
3615 0: aaabbbbcccc
3616 1: aaabbbbc
3617
3618/(a+|b+|c+)*c/
3619    aaabbbbccccd
3620 0: aaabbbbcccc
3621 1: aaabbbbccc
3622 2: aaabbbbcc
3623 3: aaabbbbc
3624
3625/((?>[^()]+)|\([^()]*\))+/
3626    ((abc(ade)ufh()()x
3627 0: abc(ade)ufh()()x
3628 1: abc(ade)ufh()()
3629 2: abc(ade)ufh()
3630 3: abc(ade)ufh
3631 4: abc(ade)
3632 5: abc
3633
3634/\(((?>[^()]+)|\([^()]+\))+\)/
3635    (abc)
3636 0: (abc)
3637    (abc(def)xyz)
3638 0: (abc(def)xyz)
3639\= Expect no match
3640    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3641No match
3642
3643/a(?-i)b/i
3644    ab
3645 0: ab
3646    Ab
3647 0: Ab
3648\= Expect no match
3649    aB
3650No match
3651    AB
3652No match
3653
3654/(a (?x)b c)d e/
3655    a bcd e
3656 0: a bcd e
3657\= Expect no match
3658    a b cd e
3659No match
3660    abcd e
3661No match
3662    a bcde
3663No match
3664
3665/(a b(?x)c d (?-x)e f)/
3666    a bcde f
3667 0: a bcde f
3668\= Expect no match
3669    abcdef
3670No match
3671
3672/(a(?i)b)c/
3673    abc
3674 0: abc
3675    aBc
3676 0: aBc
3677\= Expect no match
3678    abC
3679No match
3680    aBC
3681No match
3682    Abc
3683No match
3684    ABc
3685No match
3686    ABC
3687No match
3688    AbC
3689No match
3690
3691/a(?i:b)c/
3692    abc
3693 0: abc
3694    aBc
3695 0: aBc
3696\= Expect no match
3697    ABC
3698No match
3699    abC
3700No match
3701    aBC
3702No match
3703
3704/a(?i:b)*c/
3705    aBc
3706 0: aBc
3707    aBBc
3708 0: aBBc
3709\= Expect no match
3710    aBC
3711No match
3712    aBBC
3713No match
3714
3715/a(?=b(?i)c)\w\wd/
3716    abcd
3717 0: abcd
3718    abCd
3719 0: abCd
3720\= Expect no match
3721    aBCd
3722No match
3723    abcD
3724No match
3725
3726/(?s-i:more.*than).*million/i
3727    more than million
3728 0: more than million
3729    more than MILLION
3730 0: more than MILLION
3731    more \n than Million
3732 0: more \x0a than Million
3733\= Expect no match
3734    MORE THAN MILLION
3735No match
3736    more \n than \n million
3737No match
3738
3739/(?:(?s-i)more.*than).*million/i
3740    more than million
3741 0: more than million
3742    more than MILLION
3743 0: more than MILLION
3744    more \n than Million
3745 0: more \x0a than Million
3746\= Expect no match
3747    MORE THAN MILLION
3748No match
3749    more \n than \n million
3750No match
3751
3752/(?>a(?i)b+)+c/
3753    abc
3754 0: abc
3755    aBbc
3756 0: aBbc
3757    aBBc
3758 0: aBBc
3759\= Expect no match
3760    Abc
3761No match
3762    abAb
3763No match
3764    abbC
3765No match
3766
3767/(?=a(?i)b)\w\wc/
3768    abc
3769 0: abc
3770    aBc
3771 0: aBc
3772\= Expect no match
3773    Ab
3774No match
3775    abC
3776No match
3777    aBC
3778No match
3779
3780/(?<=a(?i)b)(\w\w)c/
3781    abxxc
3782 0: xxc
3783    aBxxc
3784 0: xxc
3785\= Expect no match
3786    Abxxc
3787No match
3788    ABxxc
3789No match
3790    abxxC
3791No match
3792
3793/^(?(?=abc)\w{3}:|\d\d)$/
3794    abc:
3795 0: abc:
3796    12
3797 0: 12
3798\= Expect no match
3799    123
3800No match
3801    xyz
3802No match
3803
3804/^(?(?!abc)\d\d|\w{3}:)$/
3805    abc:
3806 0: abc:
3807    12
3808 0: 12
3809\= Expect no match
3810    123
3811No match
3812    xyz
3813No match
3814
3815/(?(?<=foo)bar|cat)/
3816    foobar
3817 0: bar
3818    cat
3819 0: cat
3820    fcat
3821 0: cat
3822    focat
3823 0: cat
3824\= Expect no match
3825    foocat
3826No match
3827
3828/(?(?<!foo)cat|bar)/
3829    foobar
3830 0: bar
3831    cat
3832 0: cat
3833    fcat
3834 0: cat
3835    focat
3836 0: cat
3837\= Expect no match
3838    foocat
3839No match
3840
3841/(?>a*)*/
3842    a
3843 0: a
3844 1:
3845    aa
3846 0: aa
3847 1:
3848    aaaa
3849 0: aaaa
3850 1:
3851
3852/(abc|)+/
3853    abc
3854 0: abc
3855 1:
3856    abcabc
3857 0: abcabc
3858 1: abc
3859 2:
3860    abcabcabc
3861 0: abcabcabc
3862 1: abcabc
3863 2: abc
3864 3:
3865    xyz
3866 0:
3867
3868/([a]*)*/
3869    a
3870 0: a
3871 1:
3872    aaaaa
3873 0: aaaaa
3874 1: aaaa
3875 2: aaa
3876 3: aa
3877 4: a
3878 5:
3879
3880/([ab]*)*/
3881    a
3882 0: a
3883 1:
3884    b
3885 0: b
3886 1:
3887    ababab
3888 0: ababab
3889 1: ababa
3890 2: abab
3891 3: aba
3892 4: ab
3893 5: a
3894 6:
3895    aaaabcde
3896 0: aaaab
3897 1: aaaa
3898 2: aaa
3899 3: aa
3900 4: a
3901 5:
3902    bbbb
3903 0: bbbb
3904 1: bbb
3905 2: bb
3906 3: b
3907 4:
3908
3909/([^a]*)*/
3910    b
3911 0: b
3912 1:
3913    bbbb
3914 0: bbbb
3915 1: bbb
3916 2: bb
3917 3: b
3918 4:
3919    aaa
3920 0:
3921
3922/([^ab]*)*/
3923    cccc
3924 0: cccc
3925 1: ccc
3926 2: cc
3927 3: c
3928 4:
3929    abab
3930 0:
3931
3932/([a]*?)*/
3933    a
3934 0: a
3935 1:
3936    aaaa
3937 0: aaaa
3938 1: aaa
3939 2: aa
3940 3: a
3941 4:
3942
3943/([ab]*?)*/
3944    a
3945 0: a
3946 1:
3947    b
3948 0: b
3949 1:
3950    abab
3951 0: abab
3952 1: aba
3953 2: ab
3954 3: a
3955 4:
3956    baba
3957 0: baba
3958 1: bab
3959 2: ba
3960 3: b
3961 4:
3962
3963/([^a]*?)*/
3964    b
3965 0: b
3966 1:
3967    bbbb
3968 0: bbbb
3969 1: bbb
3970 2: bb
3971 3: b
3972 4:
3973    aaa
3974 0:
3975
3976/([^ab]*?)*/
3977    c
3978 0: c
3979 1:
3980    cccc
3981 0: cccc
3982 1: ccc
3983 2: cc
3984 3: c
3985 4:
3986    baba
3987 0:
3988
3989/(?>a*)*/
3990    a
3991 0: a
3992 1:
3993    aaabcde
3994 0: aaa
3995 1:
3996
3997/((?>a*))*/
3998    aaaaa
3999 0: aaaaa
4000 1:
4001    aabbaa
4002 0: aa
4003 1:
4004
4005/((?>a*?))*/
4006    aaaaa
4007 0: aaaaa
4008 1:
4009    aabbaa
4010 0: aa
4011 1:
4012
4013/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
4014    12-sep-98
4015 0: 12-sep-98
4016    12-09-98
4017 0: 12-09-98
4018\= Expect no match
4019    sep-12-98
4020No match
4021
4022/(?i:saturday|sunday)/
4023    saturday
4024 0: saturday
4025    sunday
4026 0: sunday
4027    Saturday
4028 0: Saturday
4029    Sunday
4030 0: Sunday
4031    SATURDAY
4032 0: SATURDAY
4033    SUNDAY
4034 0: SUNDAY
4035    SunDay
4036 0: SunDay
4037
4038/(a(?i)bc|BB)x/
4039    abcx
4040 0: abcx
4041    aBCx
4042 0: aBCx
4043    bbx
4044 0: bbx
4045    BBx
4046 0: BBx
4047\= Expect no match
4048    abcX
4049No match
4050    aBCX
4051No match
4052    bbX
4053No match
4054    BBX
4055No match
4056
4057/^([ab](?i)[cd]|[ef])/
4058    ac
4059 0: ac
4060    aC
4061 0: aC
4062    bD
4063 0: bD
4064    elephant
4065 0: e
4066    Europe
4067 0: E
4068    frog
4069 0: f
4070    France
4071 0: F
4072\= Expect no match
4073    Africa
4074No match
4075
4076/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
4077    ab
4078 0: ab
4079    aBd
4080 0: aBd
4081    xy
4082 0: xy
4083    xY
4084 0: xY
4085    zebra
4086 0: z
4087    Zambesi
4088 0: Z
4089\= Expect no match
4090    aCD
4091No match
4092    XY
4093No match
4094
4095/(?<=foo\n)^bar/m
4096    foo\nbar
4097 0: bar
4098\= Expect no match
4099    bar
4100No match
4101    baz\nbar
4102No match
4103
4104/(?<=(?<!foo)bar)baz/
4105    barbaz
4106 0: baz
4107    barbarbaz
4108 0: baz
4109    koobarbaz
4110 0: baz
4111\= Expect no match
4112    baz
4113No match
4114    foobarbaz
4115No match
4116
4117# The following tests are taken from the Perl 5.005 test suite; some of them
4118# are compatible with 5.004, but I'd rather not have to sort them out.
4119
4120/abc/
4121    abc
4122 0: abc
4123    xabcy
4124 0: abc
4125    ababc
4126 0: abc
4127\= Expect no match
4128    xbc
4129No match
4130    axc
4131No match
4132    abx
4133No match
4134
4135/ab*c/
4136    abc
4137 0: abc
4138
4139/ab*bc/
4140    abc
4141 0: abc
4142    abbc
4143 0: abbc
4144    abbbbc
4145 0: abbbbc
4146
4147/.{1}/
4148    abbbbc
4149 0: a
4150
4151/.{3,4}/
4152    abbbbc
4153 0: abbb
4154
4155/ab{0,}bc/
4156    abbbbc
4157 0: abbbbc
4158
4159/ab+bc/
4160    abbc
4161 0: abbc
4162\= Expect no match
4163    abc
4164No match
4165    abq
4166No match
4167
4168/ab+bc/
4169    abbbbc
4170 0: abbbbc
4171
4172/ab{1,}bc/
4173    abbbbc
4174 0: abbbbc
4175
4176/ab{1,3}bc/
4177    abbbbc
4178 0: abbbbc
4179
4180/ab{3,4}bc/
4181    abbbbc
4182 0: abbbbc
4183
4184/ab{4,5}bc/
4185\= Expect no match
4186    abq
4187No match
4188    abbbbc
4189No match
4190
4191/ab?bc/
4192    abbc
4193 0: abbc
4194    abc
4195 0: abc
4196
4197/ab{0,1}bc/
4198    abc
4199 0: abc
4200
4201/ab?bc/
4202
4203/ab?c/
4204    abc
4205 0: abc
4206
4207/ab{0,1}c/
4208    abc
4209 0: abc
4210
4211/^abc$/
4212    abc
4213 0: abc
4214\= Expect no match
4215    abbbbc
4216No match
4217    abcc
4218No match
4219
4220/^abc/
4221    abcc
4222 0: abc
4223
4224/^abc$/
4225
4226/abc$/
4227    aabc
4228 0: abc
4229    aabc
4230 0: abc
4231\= Expect no match
4232    aabcd
4233No match
4234
4235/^/
4236    abc
4237 0:
4238
4239/$/
4240    abc
4241 0:
4242
4243/a.c/
4244    abc
4245 0: abc
4246    axc
4247 0: axc
4248
4249/a.*c/
4250    axyzc
4251 0: axyzc
4252
4253/a[bc]d/
4254    abd
4255 0: abd
4256\= Expect no match
4257    axyzd
4258No match
4259    abc
4260No match
4261
4262/a[b-d]e/
4263    ace
4264 0: ace
4265
4266/a[b-d]/
4267    aac
4268 0: ac
4269
4270/a[-b]/
4271    a-
4272 0: a-
4273
4274/a[b-]/
4275    a-
4276 0: a-
4277
4278/a]/
4279    a]
4280 0: a]
4281
4282/a[]]b/
4283    a]b
4284 0: a]b
4285
4286/a[^bc]d/
4287    aed
4288 0: aed
4289\= Expect no match
4290    abd
4291No match
4292    abd
4293No match
4294
4295/a[^-b]c/
4296    adc
4297 0: adc
4298
4299/a[^]b]c/
4300    adc
4301 0: adc
4302    a-c
4303 0: a-c
4304\= Expect no match
4305    a]c
4306No match
4307
4308/\ba\b/
4309    a-
4310 0: a
4311    -a
4312 0: a
4313    -a-
4314 0: a
4315
4316/\by\b/
4317\= Expect no match
4318    xy
4319No match
4320    yz
4321No match
4322    xyz
4323No match
4324
4325/\Ba\B/
4326\= Expect no match
4327    a-
4328No match
4329    -a
4330No match
4331    -a-
4332No match
4333
4334/\By\b/
4335    xy
4336 0: y
4337
4338/\by\B/
4339    yz
4340 0: y
4341
4342/\By\B/
4343    xyz
4344 0: y
4345
4346/\w/
4347    a
4348 0: a
4349
4350/\W/
4351    -
4352 0: -
4353\= Expect no match
4354    a
4355No match
4356
4357/a\sb/
4358    a b
4359 0: a b
4360
4361/a\Sb/
4362    a-b
4363 0: a-b
4364\= Expect no match
4365    a b
4366No match
4367
4368/\d/
4369    1
4370 0: 1
4371
4372/\D/
4373    -
4374 0: -
4375\= Expect no match
4376    1
4377No match
4378
4379/[\w]/
4380    a
4381 0: a
4382
4383/[\W]/
4384    -
4385 0: -
4386\= Expect no match
4387    a
4388No match
4389
4390/a[\s]b/
4391    a b
4392 0: a b
4393
4394/a[\S]b/
4395    a-b
4396 0: a-b
4397\= Expect no match
4398    a b
4399No match
4400
4401/[\d]/
4402    1
4403 0: 1
4404
4405/[\D]/
4406    -
4407 0: -
4408\= Expect no match
4409    1
4410No match
4411
4412/ab|cd/
4413    abc
4414 0: ab
4415    abcd
4416 0: ab
4417
4418/()ef/
4419    def
4420 0: ef
4421
4422/$b/
4423
4424/a\(b/
4425    a(b
4426 0: a(b
4427
4428/a\(*b/
4429    ab
4430 0: ab
4431    a((b
4432 0: a((b
4433
4434/a\\b/
4435    a\\b
4436 0: a\b
4437\= Expect no match
4438    a\b
4439No match
4440
4441/((a))/
4442    abc
4443 0: a
4444
4445/(a)b(c)/
4446    abc
4447 0: abc
4448
4449/a+b+c/
4450    aabbabc
4451 0: abc
4452
4453/a{1,}b{1,}c/
4454    aabbabc
4455 0: abc
4456
4457/a.+?c/
4458    abcabc
4459 0: abcabc
4460 1: abc
4461
4462/(a+|b)*/
4463    ab
4464 0: ab
4465 1: a
4466 2:
4467
4468/(a+|b){0,}/
4469    ab
4470 0: ab
4471 1: a
4472 2:
4473
4474/(a+|b)+/
4475    ab
4476 0: ab
4477 1: a
4478
4479/(a+|b){1,}/
4480    ab
4481 0: ab
4482 1: a
4483
4484/(a+|b)?/
4485    ab
4486 0: a
4487 1:
4488
4489/(a+|b){0,1}/
4490    ab
4491 0: a
4492 1:
4493
4494/[^ab]*/
4495    cde
4496 0: cde
4497
4498/abc/
4499\= Expect no match
4500    b
4501No match
4502
4503/a*/
4504
4505/([abc])*d/
4506    abbbcd
4507 0: abbbcd
4508
4509/([abc])*bcd/
4510    abcd
4511 0: abcd
4512
4513/a|b|c|d|e/
4514    e
4515 0: e
4516
4517/(a|b|c|d|e)f/
4518    ef
4519 0: ef
4520
4521/abcd*efg/
4522    abcdefg
4523 0: abcdefg
4524
4525/ab*/
4526    xabyabbbz
4527 0: ab
4528    xayabbbz
4529 0: a
4530
4531/(ab|cd)e/
4532    abcde
4533 0: cde
4534
4535/[abhgefdc]ij/
4536    hij
4537 0: hij
4538
4539/^(ab|cd)e/
4540
4541/(abc|)ef/
4542    abcdef
4543 0: ef
4544
4545/(a|b)c*d/
4546    abcd
4547 0: bcd
4548
4549/(ab|ab*)bc/
4550    abc
4551 0: abc
4552
4553/a([bc]*)c*/
4554    abc
4555 0: abc
4556 1: a
4557
4558/a([bc]*)(c*d)/
4559    abcd
4560 0: abcd
4561
4562/a([bc]+)(c*d)/
4563    abcd
4564 0: abcd
4565
4566/a([bc]*)(c+d)/
4567    abcd
4568 0: abcd
4569
4570/a[bcd]*dcdcde/
4571    adcdcde
4572 0: adcdcde
4573
4574/a[bcd]+dcdcde/
4575\= Expect no match
4576    abcde
4577No match
4578    adcdcde
4579No match
4580
4581/(ab|a)b*c/
4582    abc
4583 0: abc
4584
4585/((a)(b)c)(d)/
4586    abcd
4587 0: abcd
4588
4589/[a-zA-Z_][a-zA-Z0-9_]*/
4590    alpha
4591 0: alpha
4592
4593/^a(bc+|b[eh])g|.h$/
4594    abh
4595 0: bh
4596
4597/(bc+d$|ef*g.|h?i(j|k))/
4598    effgz
4599 0: effgz
4600    ij
4601 0: ij
4602    reffgz
4603 0: effgz
4604\= Expect no match
4605    effg
4606No match
4607    bcdd
4608No match
4609
4610/((((((((((a))))))))))/
4611    a
4612 0: a
4613
4614/(((((((((a)))))))))/
4615    a
4616 0: a
4617
4618/multiple words of text/
4619\= Expect no match
4620    aa
4621No match
4622    uh-uh
4623No match
4624
4625/multiple words/
4626    multiple words, yeah
4627 0: multiple words
4628
4629/(.*)c(.*)/
4630    abcde
4631 0: abcde
4632
4633/\((.*), (.*)\)/
4634    (a, b)
4635 0: (a, b)
4636
4637/[k]/
4638
4639/abcd/
4640    abcd
4641 0: abcd
4642
4643/a(bc)d/
4644    abcd
4645 0: abcd
4646
4647/a[-]?c/
4648    ac
4649 0: ac
4650
4651/abc/i
4652    ABC
4653 0: ABC
4654    XABCY
4655 0: ABC
4656    ABABC
4657 0: ABC
4658\= Expect no match
4659    aaxabxbaxbbx
4660No match
4661    XBC
4662No match
4663    AXC
4664No match
4665    ABX
4666No match
4667
4668/ab*c/i
4669    ABC
4670 0: ABC
4671
4672/ab*bc/i
4673    ABC
4674 0: ABC
4675    ABBC
4676 0: ABBC
4677
4678/ab*?bc/i
4679    ABBBBC
4680 0: ABBBBC
4681
4682/ab{0,}?bc/i
4683    ABBBBC
4684 0: ABBBBC
4685
4686/ab+?bc/i
4687    ABBC
4688 0: ABBC
4689
4690/ab+bc/i
4691\= Expect no match
4692    ABC
4693No match
4694    ABQ
4695No match
4696
4697/ab{1,}bc/i
4698
4699/ab+bc/i
4700    ABBBBC
4701 0: ABBBBC
4702
4703/ab{1,}?bc/i
4704    ABBBBC
4705 0: ABBBBC
4706
4707/ab{1,3}?bc/i
4708    ABBBBC
4709 0: ABBBBC
4710
4711/ab{3,4}?bc/i
4712    ABBBBC
4713 0: ABBBBC
4714
4715/ab{4,5}?bc/i
4716\= Expect no match
4717    ABQ
4718No match
4719    ABBBBC
4720No match
4721
4722/ab??bc/i
4723    ABBC
4724 0: ABBC
4725    ABC
4726 0: ABC
4727
4728/ab{0,1}?bc/i
4729    ABC
4730 0: ABC
4731
4732/ab??bc/i
4733
4734/ab??c/i
4735    ABC
4736 0: ABC
4737
4738/ab{0,1}?c/i
4739    ABC
4740 0: ABC
4741
4742/^abc$/i
4743    ABC
4744 0: ABC
4745\= Expect no match
4746    ABBBBC
4747No match
4748    ABCC
4749No match
4750
4751/^abc/i
4752    ABCC
4753 0: ABC
4754
4755/^abc$/i
4756
4757/abc$/i
4758    AABC
4759 0: ABC
4760
4761/^/i
4762    ABC
4763 0:
4764
4765/$/i
4766    ABC
4767 0:
4768
4769/a.c/i
4770    ABC
4771 0: ABC
4772    AXC
4773 0: AXC
4774
4775/a.*?c/i
4776    AXYZC
4777 0: AXYZC
4778
4779/a.*c/i
4780    AABC
4781 0: AABC
4782\= Expect no match
4783    AXYZD
4784No match
4785
4786/a[bc]d/i
4787    ABD
4788 0: ABD
4789
4790/a[b-d]e/i
4791    ACE
4792 0: ACE
4793\= Expect no match
4794    ABC
4795No match
4796    ABD
4797No match
4798
4799/a[b-d]/i
4800    AAC
4801 0: AC
4802
4803/a[-b]/i
4804    A-
4805 0: A-
4806
4807/a[b-]/i
4808    A-
4809 0: A-
4810
4811/a]/i
4812    A]
4813 0: A]
4814
4815/a[]]b/i
4816    A]B
4817 0: A]B
4818
4819/a[^bc]d/i
4820    AED
4821 0: AED
4822
4823/a[^-b]c/i
4824    ADC
4825 0: ADC
4826\= Expect no match
4827    ABD
4828No match
4829    A-C
4830No match
4831
4832/a[^]b]c/i
4833    ADC
4834 0: ADC
4835
4836/ab|cd/i
4837    ABC
4838 0: AB
4839    ABCD
4840 0: AB
4841
4842/()ef/i
4843    DEF
4844 0: EF
4845
4846/$b/i
4847\= Expect no match
4848    A]C
4849No match
4850    B
4851No match
4852
4853/a\(b/i
4854    A(B
4855 0: A(B
4856
4857/a\(*b/i
4858    AB
4859 0: AB
4860    A((B
4861 0: A((B
4862
4863/a\\b/i
4864\= Expect no match
4865    A\=notbol
4866No match
4867
4868/((a))/i
4869    ABC
4870 0: A
4871
4872/(a)b(c)/i
4873    ABC
4874 0: ABC
4875
4876/a+b+c/i
4877    AABBABC
4878 0: ABC
4879
4880/a{1,}b{1,}c/i
4881    AABBABC
4882 0: ABC
4883
4884/a.+?c/i
4885    ABCABC
4886 0: ABCABC
4887 1: ABC
4888
4889/a.*?c/i
4890    ABCABC
4891 0: ABCABC
4892 1: ABC
4893
4894/a.{0,5}?c/i
4895    ABCABC
4896 0: ABCABC
4897 1: ABC
4898
4899/(a+|b)*/i
4900    AB
4901 0: AB
4902 1: A
4903 2:
4904
4905/(a+|b){0,}/i
4906    AB
4907 0: AB
4908 1: A
4909 2:
4910
4911/(a+|b)+/i
4912    AB
4913 0: AB
4914 1: A
4915
4916/(a+|b){1,}/i
4917    AB
4918 0: AB
4919 1: A
4920
4921/(a+|b)?/i
4922    AB
4923 0: A
4924 1:
4925
4926/(a+|b){0,1}/i
4927    AB
4928 0: A
4929 1:
4930
4931/(a+|b){0,1}?/i
4932    AB
4933 0: A
4934 1:
4935
4936/[^ab]*/i
4937    CDE
4938 0: CDE
4939
4940/abc/i
4941
4942/a*/i
4943
4944/([abc])*d/i
4945    ABBBCD
4946 0: ABBBCD
4947
4948/([abc])*bcd/i
4949    ABCD
4950 0: ABCD
4951
4952/a|b|c|d|e/i
4953    E
4954 0: E
4955
4956/(a|b|c|d|e)f/i
4957    EF
4958 0: EF
4959
4960/abcd*efg/i
4961    ABCDEFG
4962 0: ABCDEFG
4963
4964/ab*/i
4965    XABYABBBZ
4966 0: AB
4967    XAYABBBZ
4968 0: A
4969
4970/(ab|cd)e/i
4971    ABCDE
4972 0: CDE
4973
4974/[abhgefdc]ij/i
4975    HIJ
4976 0: HIJ
4977
4978/^(ab|cd)e/i
4979\= Expect no match
4980    ABCDE
4981No match
4982
4983/(abc|)ef/i
4984    ABCDEF
4985 0: EF
4986
4987/(a|b)c*d/i
4988    ABCD
4989 0: BCD
4990
4991/(ab|ab*)bc/i
4992    ABC
4993 0: ABC
4994
4995/a([bc]*)c*/i
4996    ABC
4997 0: ABC
4998 1: A
4999
5000/a([bc]*)(c*d)/i
5001    ABCD
5002 0: ABCD
5003
5004/a([bc]+)(c*d)/i
5005    ABCD
5006 0: ABCD
5007
5008/a([bc]*)(c+d)/i
5009    ABCD
5010 0: ABCD
5011
5012/a[bcd]*dcdcde/i
5013    ADCDCDE
5014 0: ADCDCDE
5015
5016/a[bcd]+dcdcde/i
5017
5018/(ab|a)b*c/i
5019    ABC
5020 0: ABC
5021
5022/((a)(b)c)(d)/i
5023    ABCD
5024 0: ABCD
5025
5026/[a-zA-Z_][a-zA-Z0-9_]*/i
5027    ALPHA
5028 0: ALPHA
5029
5030/^a(bc+|b[eh])g|.h$/i
5031    ABH
5032 0: BH
5033
5034/(bc+d$|ef*g.|h?i(j|k))/i
5035    EFFGZ
5036 0: EFFGZ
5037    IJ
5038 0: IJ
5039    REFFGZ
5040 0: EFFGZ
5041\= Expect no match
5042    ADCDCDE
5043No match
5044    EFFG
5045No match
5046    BCDD
5047No match
5048
5049/((((((((((a))))))))))/i
5050    A
5051 0: A
5052
5053/(((((((((a)))))))))/i
5054    A
5055 0: A
5056
5057/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
5058    A
5059 0: A
5060
5061/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
5062    C
5063 0: C
5064
5065/multiple words of text/i
5066\= Expect no match
5067    AA
5068No match
5069    UH-UH
5070No match
5071
5072/multiple words/i
5073    MULTIPLE WORDS, YEAH
5074 0: MULTIPLE WORDS
5075
5076/(.*)c(.*)/i
5077    ABCDE
5078 0: ABCDE
5079
5080/\((.*), (.*)\)/i
5081    (A, B)
5082 0: (A, B)
5083
5084/[k]/i
5085
5086/abcd/i
5087    ABCD
5088 0: ABCD
5089
5090/a(bc)d/i
5091    ABCD
5092 0: ABCD
5093
5094/a[-]?c/i
5095    AC
5096 0: AC
5097
5098/a(?!b)./
5099    abad
5100 0: ad
5101
5102/a(?=d)./
5103    abad
5104 0: ad
5105
5106/a(?=c|d)./
5107    abad
5108 0: ad
5109
5110/a(?:b|c|d)(.)/
5111    ace
5112 0: ace
5113
5114/a(?:b|c|d)*(.)/
5115    ace
5116 0: ace
5117 1: ac
5118
5119/a(?:b|c|d)+?(.)/
5120    ace
5121 0: ace
5122    acdbcdbe
5123 0: acdbcdbe
5124 1: acdbcdb
5125 2: acdbcd
5126 3: acdbc
5127 4: acdb
5128 5: acd
5129
5130/a(?:b|c|d)+(.)/
5131    acdbcdbe
5132 0: acdbcdbe
5133 1: acdbcdb
5134 2: acdbcd
5135 3: acdbc
5136 4: acdb
5137 5: acd
5138
5139/a(?:b|c|d){2}(.)/
5140    acdbcdbe
5141 0: acdb
5142
5143/a(?:b|c|d){4,5}(.)/
5144    acdbcdbe
5145 0: acdbcdb
5146 1: acdbcd
5147
5148/a(?:b|c|d){4,5}?(.)/
5149    acdbcdbe
5150 0: acdbcdb
5151 1: acdbcd
5152
5153/((foo)|(bar))*/
5154    foobar
5155 0: foobar
5156 1: foo
5157 2:
5158
5159/a(?:b|c|d){6,7}(.)/
5160    acdbcdbe
5161 0: acdbcdbe
5162
5163/a(?:b|c|d){6,7}?(.)/
5164    acdbcdbe
5165 0: acdbcdbe
5166
5167/a(?:b|c|d){5,6}(.)/
5168    acdbcdbe
5169 0: acdbcdbe
5170 1: acdbcdb
5171
5172/a(?:b|c|d){5,6}?(.)/
5173    acdbcdbe
5174 0: acdbcdbe
5175 1: acdbcdb
5176
5177/a(?:b|c|d){5,7}(.)/
5178    acdbcdbe
5179 0: acdbcdbe
5180 1: acdbcdb
5181
5182/a(?:b|c|d){5,7}?(.)/
5183    acdbcdbe
5184 0: acdbcdbe
5185 1: acdbcdb
5186
5187/a(?:b|(c|e){1,2}?|d)+?(.)/
5188    ace
5189 0: ace
5190
5191/^(.+)?B/
5192    AB
5193 0: AB
5194
5195/^([^a-z])|(\^)$/
5196    .
5197 0: .
5198
5199/^[<>]&/
5200    <&OUT
5201 0: <&
5202
5203/(?:(f)(o)(o)|(b)(a)(r))*/
5204    foobar
5205 0: foobar
5206 1: foo
5207 2:
5208
5209/(?<=a)b/
5210    ab
5211 0: b
5212\= Expect no match
5213    cb
5214No match
5215    b
5216No match
5217
5218/(?<!c)b/
5219    ab
5220 0: b
5221    b
5222 0: b
5223    b
5224 0: b
5225
5226/(?:..)*a/
5227    aba
5228 0: aba
5229 1: a
5230
5231/(?:..)*?a/
5232    aba
5233 0: aba
5234 1: a
5235
5236/^(){3,5}/
5237    abc
5238 0:
5239
5240/^(a+)*ax/
5241    aax
5242 0: aax
5243
5244/^((a|b)+)*ax/
5245    aax
5246 0: aax
5247
5248/^((a|bc)+)*ax/
5249    aax
5250 0: aax
5251
5252/(a|x)*ab/
5253    cab
5254 0: ab
5255
5256/(a)*ab/
5257    cab
5258 0: ab
5259
5260/(?:(?i)a)b/
5261    ab
5262 0: ab
5263
5264/((?i)a)b/
5265    ab
5266 0: ab
5267
5268/(?:(?i)a)b/
5269    Ab
5270 0: Ab
5271
5272/((?i)a)b/
5273    Ab
5274 0: Ab
5275
5276/(?:(?i)a)b/
5277\= Expect no match
5278    cb
5279No match
5280    aB
5281No match
5282
5283/((?i)a)b/
5284
5285/(?i:a)b/
5286    ab
5287 0: ab
5288
5289/((?i:a))b/
5290    ab
5291 0: ab
5292
5293/(?i:a)b/
5294    Ab
5295 0: Ab
5296
5297/((?i:a))b/
5298    Ab
5299 0: Ab
5300
5301/(?i:a)b/
5302\= Expect no match
5303    aB
5304No match
5305    aB
5306No match
5307
5308/((?i:a))b/
5309
5310/(?:(?-i)a)b/i
5311    ab
5312 0: ab
5313
5314/((?-i)a)b/i
5315    ab
5316 0: ab
5317
5318/(?:(?-i)a)b/i
5319    aB
5320 0: aB
5321
5322/((?-i)a)b/i
5323    aB
5324 0: aB
5325
5326/(?:(?-i)a)b/i
5327    aB
5328 0: aB
5329\= Expect no match
5330    Ab
5331No match
5332
5333/((?-i)a)b/i
5334
5335/(?:(?-i)a)b/i
5336    aB
5337 0: aB
5338
5339/((?-i)a)b/i
5340    aB
5341 0: aB
5342
5343/(?:(?-i)a)b/i
5344\= Expect no match
5345    Ab
5346No match
5347    AB
5348No match
5349
5350/((?-i)a)b/i
5351
5352/(?-i:a)b/i
5353    ab
5354 0: ab
5355
5356/((?-i:a))b/i
5357    ab
5358 0: ab
5359
5360/(?-i:a)b/i
5361    aB
5362 0: aB
5363
5364/((?-i:a))b/i
5365    aB
5366 0: aB
5367
5368/(?-i:a)b/i
5369\= Expect no match
5370    AB
5371No match
5372    Ab
5373No match
5374
5375/((?-i:a))b/i
5376
5377/(?-i:a)b/i
5378    aB
5379 0: aB
5380
5381/((?-i:a))b/i
5382    aB
5383 0: aB
5384
5385/(?-i:a)b/i
5386\= Expect no match
5387    Ab
5388No match
5389    AB
5390No match
5391
5392/((?-i:a))b/i
5393
5394/((?-i:a.))b/i
5395\= Expect no match
5396    AB
5397No match
5398    a\nB
5399No match
5400
5401/((?s-i:a.))b/i
5402    a\nB
5403 0: a\x0aB
5404
5405/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
5406    cabbbb
5407 0: cabbbb
5408
5409/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
5410    caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
5411 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
5412
5413/foo\w*\d{4}baz/
5414    foobar1234baz
5415 0: foobar1234baz
5416
5417/x(~~)*(?:(?:F)?)?/
5418    x~~
5419 0: x~~
5420 1: x
5421
5422/^a(?#xxx){3}c/
5423    aaac
5424 0: aaac
5425
5426/^a (?#xxx) (?#yyy) {3}c/x
5427    aaac
5428 0: aaac
5429
5430/(?<![cd])b/
5431\= Expect no match
5432    B\nB
5433No match
5434    dbcb
5435No match
5436
5437/(?<![cd])[ab]/
5438    dbaacb
5439 0: a
5440
5441/(?<!(c|d))b/
5442
5443/(?<!(c|d))[ab]/
5444    dbaacb
5445 0: a
5446
5447/(?<!cd)[ab]/
5448    cdaccb
5449 0: b
5450
5451/^(?:a?b?)*$/
5452\= Expect no match
5453    dbcb
5454No match
5455    a--
5456No match
5457
5458/((?s)^a(.))((?m)^b$)/
5459    a\nb\nc\n
5460 0: a\x0ab
5461
5462/((?m)^b$)/
5463    a\nb\nc\n
5464 0: b
5465
5466/(?m)^b/
5467    a\nb\n
5468 0: b
5469
5470/(?m)^(b)/
5471    a\nb\n
5472 0: b
5473
5474/((?m)^b)/
5475    a\nb\n
5476 0: b
5477
5478/\n((?m)^b)/
5479    a\nb\n
5480 0: \x0ab
5481
5482/((?s).)c(?!.)/
5483    a\nb\nc\n
5484 0: \x0ac
5485    a\nb\nc\n
5486 0: \x0ac
5487
5488/((?s)b.)c(?!.)/
5489    a\nb\nc\n
5490 0: b\x0ac
5491    a\nb\nc\n
5492 0: b\x0ac
5493
5494/^b/
5495
5496/()^b/
5497\= Expect no match
5498    a\nb\nc\n
5499No match
5500    a\nb\nc\n
5501No match
5502
5503/((?m)^b)/
5504    a\nb\nc\n
5505 0: b
5506
5507/(?(?!a)a|b)/
5508
5509/(?(?!a)b|a)/
5510    a
5511 0: a
5512
5513/(?(?=a)b|a)/
5514\= Expect no match
5515    a
5516No match
5517    a
5518No match
5519
5520/(?(?=a)a|b)/
5521    a
5522 0: a
5523
5524/(\w+:)+/
5525    one:
5526 0: one:
5527
5528/$(?<=^(a))/
5529    a
5530 0:
5531
5532/([\w:]+::)?(\w+)$/
5533    abcd
5534 0: abcd
5535    xy:z:::abcd
5536 0: xy:z:::abcd
5537
5538/^[^bcd]*(c+)/
5539    aexycd
5540 0: aexyc
5541
5542/(a*)b+/
5543    caab
5544 0: aab
5545
5546/([\w:]+::)?(\w+)$/
5547    abcd
5548 0: abcd
5549    xy:z:::abcd
5550 0: xy:z:::abcd
5551\= Expect no match
5552    abcd:
5553No match
5554    abcd:
5555No match
5556
5557/^[^bcd]*(c+)/
5558    aexycd
5559 0: aexyc
5560
5561/(>a+)ab/
5562
5563/(?>a+)b/
5564    aaab
5565 0: aaab
5566
5567/([[:]+)/
5568    a:[b]:
5569 0: :[
5570
5571/([[=]+)/
5572    a=[b]=
5573 0: =[
5574
5575/([[.]+)/
5576    a.[b].
5577 0: .[
5578
5579/((?>a+)b)/
5580    aaab
5581 0: aaab
5582
5583/(?>(a+))b/
5584    aaab
5585 0: aaab
5586
5587/((?>[^()]+)|\([^()]*\))+/
5588    ((abc(ade)ufh()()x
5589 0: abc(ade)ufh()()x
5590 1: abc(ade)ufh()()
5591 2: abc(ade)ufh()
5592 3: abc(ade)ufh
5593 4: abc(ade)
5594 5: abc
5595
5596/a\Z/
5597\= Expect no match
5598    aaab
5599No match
5600    a\nb\n
5601No match
5602
5603/b\Z/
5604    a\nb\n
5605 0: b
5606
5607/b\z/
5608
5609/b\Z/
5610    a\nb
5611 0: b
5612
5613/b\z/
5614    a\nb
5615 0: b
5616
5617/(?>.*)(?<=(abcd|wxyz))/
5618    alphabetabcd
5619 0: alphabetabcd
5620    endingwxyz
5621 0: endingwxyz
5622\= Expect no match
5623    a rather long string that doesn't end with one of them
5624No match
5625
5626/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
5627    word cat dog elephant mussel cow horse canary baboon snake shark otherword
5628 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
5629\= Expect no match
5630    word cat dog elephant mussel cow horse canary baboon snake shark
5631No match
5632
5633/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
5634\= Expect no match
5635    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
5636No match
5637
5638/(?<=\d{3}(?!999))foo/
5639    999foo
5640 0: foo
5641    123999foo
5642 0: foo
5643\= Expect no match
5644    123abcfoo
5645No match
5646
5647/(?<=(?!...999)\d{3})foo/
5648    999foo
5649 0: foo
5650    123999foo
5651 0: foo
5652\= Expect no match
5653    123abcfoo
5654No match
5655
5656/(?<=\d{3}(?!999)...)foo/
5657    123abcfoo
5658 0: foo
5659    123456foo
5660 0: foo
5661\= Expect no match
5662    123999foo
5663No match
5664
5665/(?<=\d{3}...)(?<!999)foo/
5666    123abcfoo
5667 0: foo
5668    123456foo
5669 0: foo
5670\= Expect no match
5671    123999foo
5672No match
5673
5674/((Z)+|A)*/
5675    ZABCDEFG
5676 0: ZA
5677 1: Z
5678 2:
5679
5680/(Z()|A)*/
5681    ZABCDEFG
5682 0: ZA
5683 1: Z
5684 2:
5685
5686/(Z(())|A)*/
5687    ZABCDEFG
5688 0: ZA
5689 1: Z
5690 2:
5691
5692/((?>Z)+|A)*/
5693    ZABCDEFG
5694 0: ZA
5695 1: Z
5696 2:
5697
5698/((?>)+|A)*/
5699    ZABCDEFG
5700 0:
5701
5702/a*/g
5703    abbab
5704 0: a
5705 0:
5706 0:
5707 0: a
5708 0:
5709 0:
5710
5711/[[:space:]]+/
5712    > \x09\x0a\x0c\x0d\x0b<
5713 0:  \x09\x0a\x0c\x0d\x0b
5714
5715/[[:blank:]]+/
5716    > \x09\x0a\x0c\x0d\x0b<
5717 0:  \x09
5718
5719/[\s]+/
5720    > \x09\x0a\x0c\x0d\x0b<
5721 0:  \x09\x0a\x0c\x0d\x0b
5722
5723/\s+/
5724    > \x09\x0a\x0c\x0d\x0b<
5725 0:  \x09\x0a\x0c\x0d\x0b
5726
5727/ab/x
5728    ab
5729 0: ab
5730
5731/(?!\A)x/m
5732  a\nxb\n
5733 0: x
5734
5735/(?!^)x/m
5736\= Expect no match
5737    a\nxb\n
5738No match
5739
5740/abc\Qabc\Eabc/
5741    abcabcabc
5742 0: abcabcabc
5743
5744/abc\Q(*+|\Eabc/
5745    abc(*+|abc
5746 0: abc(*+|abc
5747
5748/   abc\Q abc\Eabc/x
5749    abc abcabc
5750 0: abc abcabc
5751\= Expect no match
5752    abcabcabc
5753No match
5754
5755/abc#comment
5756    \Q#not comment
5757    literal\E/x
5758    abc#not comment\n    literal
5759 0: abc#not comment\x0a    literal
5760
5761/abc#comment
5762    \Q#not comment
5763    literal/x
5764    abc#not comment\n    literal
5765 0: abc#not comment\x0a    literal
5766
5767/abc#comment
5768    \Q#not comment
5769    literal\E #more comment
5770    /x
5771    abc#not comment\n    literal
5772 0: abc#not comment\x0a    literal
5773
5774/abc#comment
5775    \Q#not comment
5776    literal\E #more comment/x
5777    abc#not comment\n    literal
5778 0: abc#not comment\x0a    literal
5779
5780/\Qabc\$xyz\E/
5781    abc\\\$xyz
5782 0: abc\$xyz
5783
5784/\Qabc\E\$\Qxyz\E/
5785    abc\$xyz
5786 0: abc$xyz
5787
5788/\Gabc/
5789    abc
5790 0: abc
5791\= Expect no match
5792    xyzabc
5793No match
5794
5795/\Gabc./g
5796    abc1abc2xyzabc3
5797 0: abc1
5798 0: abc2
5799
5800/abc./g
5801    abc1abc2xyzabc3
5802 0: abc1
5803 0: abc2
5804 0: abc3
5805
5806/a(?x: b c )d/
5807    XabcdY
5808 0: abcd
5809\= Expect no match
5810    Xa b c d Y
5811No match
5812
5813/((?x)x y z | a b c)/
5814    XabcY
5815 0: abc
5816    AxyzB
5817 0: xyz
5818
5819/(?i)AB(?-i)C/
5820    XabCY
5821 0: abC
5822\= Expect no match
5823    XabcY
5824No match
5825
5826/((?i)AB(?-i)C|D)E/
5827    abCE
5828 0: abCE
5829    DE
5830 0: DE
5831\= Expect no match
5832    abcE
5833No match
5834    abCe
5835No match
5836    dE
5837No match
5838    De
5839No match
5840
5841/[z\Qa-d]\E]/
5842    z
5843 0: z
5844    a
5845 0: a
5846    -
5847 0: -
5848    d
5849 0: d
5850    ]
5851 0: ]
5852\= Expect no match
5853    b
5854No match
5855
5856/(a+)*b/
5857\= Expect no match
5858    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
5859No match
5860
5861/(?i)reg(?:ul(?:[a�]|ae)r|ex)/
5862    REGular
5863 0: REGular
5864    regulaer
5865 0: regulaer
5866    Regex
5867 0: Regex
5868    regul�r
5869 0: regul\xe4r
5870
5871/����[�-��-�]+/
5872    �����
5873 0: \xc5\xe6\xe5\xe4\xe0
5874    �����
5875 0: \xc5\xe6\xe5\xe4\xff
5876    �����
5877 0: \xc5\xe6\xe5\xe4\xc0
5878    �����
5879 0: \xc5\xe6\xe5\xe4\xdf
5880
5881/(?<=Z)X./
5882    \x84XAZXB
5883 0: XB
5884
5885/^(?(2)a|(1)(2))+$/
5886    123a
5887Failed: error -40: backreference condition or recursion test is not supported for DFA matching
5888
5889/(?<=a|bbbb)c/
5890    ac
5891 0: c
5892    bbbbc
5893 0: c
5894
5895/line\nbreak/
5896    this is a line\nbreak
5897 0: line\x0abreak
5898    line one\nthis is a line\nbreak in the second line
5899 0: line\x0abreak
5900
5901/line\nbreak/firstline
5902    this is a line\nbreak
5903 0: line\x0abreak
5904\= Expect no match
5905    line one\nthis is a line\nbreak in the second line
5906No match
5907
5908/line\nbreak/m,firstline
5909    this is a line\nbreak
5910 0: line\x0abreak
5911\= Expect no match
5912    line one\nthis is a line\nbreak in the second line
5913No match
5914
5915/1234/
5916    123\=ps
5917Partial match: 123
5918\= Expect no match
5919    a4\=ps,dfa_restart
5920No match
5921
5922/1234/
5923    123\=ps
5924Partial match: 123
5925    4\=ps,dfa_restart
5926 0: 4
5927
5928/^/gm
5929    a\nb\nc\n
5930 0:
5931 0:
5932 0:
5933    \
5934 0:
5935
5936/(?<=C\n)^/gm
5937    A\nC\nC\n
5938 0:
5939
5940/(?s)A?B/
5941    AB
5942 0: AB
5943    aB
5944 0: B
5945
5946/(?s)A*B/
5947    AB
5948 0: AB
5949    aB
5950 0: B
5951
5952/(?m)A?B/
5953    AB
5954 0: AB
5955    aB
5956 0: B
5957
5958/(?m)A*B/
5959    AB
5960 0: AB
5961    aB
5962 0: B
5963
5964/Content-Type\x3A[^\r\n]{6,}/
5965    Content-Type:xxxxxyyy
5966 0: Content-Type:xxxxxyyy
5967
5968/Content-Type\x3A[^\r\n]{6,}z/
5969    Content-Type:xxxxxyyyz
5970 0: Content-Type:xxxxxyyyz
5971
5972/Content-Type\x3A[^a]{6,}/
5973    Content-Type:xxxyyy
5974 0: Content-Type:xxxyyy
5975
5976/Content-Type\x3A[^a]{6,}z/
5977    Content-Type:xxxyyyz
5978 0: Content-Type:xxxyyyz
5979
5980/^abc/Im,newline=lf
5981Capture group count = 0
5982Options: multiline
5983Forced newline is LF
5984First code unit at start or follows newline
5985Last code unit = 'c'
5986Subject length lower bound = 3
5987    xyz\nabc
5988 0: abc
5989    xyz\r\nabc
5990 0: abc
5991\= Expect no match
5992    xyz\rabc
5993No match
5994    xyzabc\r
5995No match
5996    xyzabc\rpqr
5997No match
5998    xyzabc\r\n
5999No match
6000    xyzabc\r\npqr
6001No match
6002
6003/^abc/Im,newline=crlf
6004Capture group count = 0
6005Options: multiline
6006Forced newline is CRLF
6007First code unit at start or follows newline
6008Last code unit = 'c'
6009Subject length lower bound = 3
6010    xyz\r\nabclf>
6011 0: abc
6012\= Expect no match
6013    xyz\nabclf
6014No match
6015    xyz\rabclf
6016No match
6017
6018/^abc/Im,newline=cr
6019Capture group count = 0
6020Options: multiline
6021Forced newline is CR
6022First code unit at start or follows newline
6023Last code unit = 'c'
6024Subject length lower bound = 3
6025    xyz\rabc
6026 0: abc
6027\= Expect no match
6028    xyz\nabc
6029No match
6030    xyz\r\nabc
6031No match
6032
6033/.*/I,newline=lf
6034Capture group count = 0
6035May match empty string
6036Forced newline is LF
6037First code unit at start or follows newline
6038Subject length lower bound = 0
6039    abc\ndef
6040 0: abc
6041    abc\rdef
6042 0: abc\x0ddef
6043    abc\r\ndef
6044 0: abc\x0d
6045
6046/.*/I,newline=cr
6047Capture group count = 0
6048May match empty string
6049Forced newline is CR
6050First code unit at start or follows newline
6051Subject length lower bound = 0
6052    abc\ndef
6053 0: abc\x0adef
6054    abc\rdef
6055 0: abc
6056    abc\r\ndef
6057 0: abc
6058
6059/.*/I,newline=crlf
6060Capture group count = 0
6061May match empty string
6062Forced newline is CRLF
6063First code unit at start or follows newline
6064Subject length lower bound = 0
6065    abc\ndef
6066 0: abc\x0adef
6067    abc\rdef
6068 0: abc\x0ddef
6069    abc\r\ndef
6070 0: abc
6071
6072/\w+(.)(.)?def/Is
6073Capture group count = 2
6074Options: dotall
6075Starting 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
6076  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
6077Last code unit = 'f'
6078Subject length lower bound = 5
6079    abc\ndef
6080 0: abc\x0adef
6081    abc\rdef
6082 0: abc\x0ddef
6083    abc\r\ndef
6084 0: abc\x0d\x0adef
6085
6086/\w+(.)(.)?def/s
6087    abc\ndef
6088 0: abc\x0adef
6089    abc\rdef
6090 0: abc\x0ddef
6091    abc\r\ndef
6092 0: abc\x0d\x0adef
6093
6094/^\w+=.*(\\\n.*)*/
6095    abc=xyz\\\npqr
6096 0: abc=xyz\\x0apqr
6097 1: abc=xyz\\x0apq
6098 2: abc=xyz\\x0ap
6099 3: abc=xyz\\x0a
6100 4: abc=xyz\
6101 5: abc=xyz
6102 6: abc=xy
6103 7: abc=x
6104 8: abc=
6105
6106/^(a()*)*/
6107    aaaa
6108 0: aaaa
6109 1: aaa
6110 2: aa
6111 3: a
6112 4:
6113
6114/^(?:a(?:(?:))*)*/
6115    aaaa
6116 0: aaaa
6117 1: aaa
6118 2: aa
6119 3: a
6120 4:
6121
6122/^(a()+)+/
6123    aaaa
6124 0: aaaa
6125 1: aaa
6126 2: aa
6127 3: a
6128
6129/^(?:a(?:(?:))+)+/
6130    aaaa
6131 0: aaaa
6132 1: aaa
6133 2: aa
6134 3: a
6135
6136/(a|)*\d/
6137  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6138 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6139\= Expect no match
6140  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6141No match
6142
6143/(?>a|)*\d/
6144  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6145 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6146\= Expect no match
6147  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6148No match
6149
6150/(?:a|)*\d/
6151  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6152 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6153\= Expect no match
6154  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6155No match
6156
6157/^a.b/newline=lf
6158    a\rb
6159 0: a\x0db
6160\= Expect no match
6161    a\nb
6162No match
6163
6164/^a.b/newline=cr
6165    a\nb
6166 0: a\x0ab
6167\= Expect no match
6168    a\rb
6169No match
6170
6171/^a.b/newline=anycrlf
6172    a\x85b
6173 0: a\x85b
6174\= Expect no match
6175    a\rb
6176No match
6177
6178/^a.b/newline=any
6179\= Expect no match
6180    a\nb
6181No match
6182    a\rb
6183No match
6184    a\x85b
6185No match
6186
6187/^abc./gmx,newline=any
6188    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
6189 0: abc1
6190 0: abc2
6191 0: abc3
6192 0: abc4
6193 0: abc5
6194 0: abc6
6195 0: abc7
6196
6197/abc.$/gmx,newline=any
6198    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
6199 0: abc1
6200 0: abc2
6201 0: abc3
6202 0: abc4
6203 0: abc5
6204 0: abc6
6205 0: abc9
6206
6207/^a\Rb/bsr=unicode
6208    a\nb
6209 0: a\x0ab
6210    a\rb
6211 0: a\x0db
6212    a\r\nb
6213 0: a\x0d\x0ab
6214    a\x0bb
6215 0: a\x0bb
6216    a\x0cb
6217 0: a\x0cb
6218    a\x85b
6219 0: a\x85b
6220\= Expect no match
6221    a\n\rb
6222No match
6223
6224/^a\R*b/bsr=unicode
6225    ab
6226 0: ab
6227    a\nb
6228 0: a\x0ab
6229    a\rb
6230 0: a\x0db
6231    a\r\nb
6232 0: a\x0d\x0ab
6233    a\x0bb
6234 0: a\x0bb
6235    a\x0cb
6236 0: a\x0cb
6237    a\x85b
6238 0: a\x85b
6239    a\n\rb
6240 0: a\x0a\x0db
6241    a\n\r\x85\x0cb
6242 0: a\x0a\x0d\x85\x0cb
6243
6244/^a\R+b/bsr=unicode
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\= Expect no match
6262    ab
6263No match
6264
6265/^a\R{1,3}b/bsr=unicode
6266    a\nb
6267 0: a\x0ab
6268    a\n\rb
6269 0: a\x0a\x0db
6270    a\n\r\x85b
6271 0: a\x0a\x0d\x85b
6272    a\r\n\r\nb
6273 0: a\x0d\x0a\x0d\x0ab
6274    a\r\n\r\n\r\nb
6275 0: a\x0d\x0a\x0d\x0a\x0d\x0ab
6276    a\n\r\n\rb
6277 0: a\x0a\x0d\x0a\x0db
6278    a\n\n\r\nb
6279 0: a\x0a\x0a\x0d\x0ab
6280\= Expect no match
6281    a\n\n\n\rb
6282No match
6283    a\r
6284No match
6285
6286/.+foo/
6287    afoo
6288 0: afoo
6289\= Expect no match
6290    \r\nfoo
6291No match
6292    \nfoo
6293No match
6294
6295/.+foo/newline=crlf
6296    afoo
6297 0: afoo
6298    \nfoo
6299 0: \x0afoo
6300\= Expect no match
6301    \r\nfoo
6302No match
6303
6304/.+foo/newline=any
6305    afoo
6306 0: afoo
6307\= Expect no match
6308    \nfoo
6309No match
6310    \r\nfoo
6311No match
6312
6313/.+foo/s
6314    afoo
6315 0: afoo
6316    \r\nfoo
6317 0: \x0d\x0afoo
6318    \nfoo
6319 0: \x0afoo
6320
6321/^$/gm,newline=any
6322    abc\r\rxyz
6323 0:
6324    abc\n\rxyz
6325 0:
6326\= Expect no match
6327    abc\r\nxyz
6328No match
6329
6330/^X/m
6331    XABC
6332 0: X
6333\= Expect no match
6334    XABC\=notbol
6335No match
6336
6337/(?m)^$/g,newline=any,aftertext
6338    abc\r\n\r\n
6339 0:
6340 0+ \x0d\x0a
6341
6342/(?m)^$|^\r\n/g,newline=any,aftertext
6343    abc\r\n\r\n
6344 0: \x0d\x0a
6345 0+
6346 1:
6347
6348/(?m)$/g,newline=any,aftertext
6349    abc\r\n\r\n
6350 0:
6351 0+ \x0d\x0a\x0d\x0a
6352 0:
6353 0+ \x0d\x0a
6354 0:
6355 0+
6356
6357/(?|(abc)|(xyz))/
6358   >abc<
6359 0: abc
6360   >xyz<
6361 0: xyz
6362
6363/(x)(?|(abc)|(xyz))(x)/
6364    xabcx
6365 0: xabcx
6366    xxyzx
6367 0: xxyzx
6368
6369/(x)(?|(abc)(pqr)|(xyz))(x)/
6370    xabcpqrx
6371 0: xabcpqrx
6372    xxyzx
6373 0: xxyzx
6374
6375/(?|(abc)|(xyz))(?1)/
6376    abcabc
6377 0: abcabc
6378    xyzabc
6379 0: xyzabc
6380\= Expect no match
6381    xyzxyz
6382No match
6383
6384/\H\h\V\v/
6385    X X\x0a
6386 0: X X\x0a
6387    X\x09X\x0b
6388 0: X\x09X\x0b
6389\= Expect no match
6390    \xa0 X\x0a
6391No match
6392
6393/\H*\h+\V?\v{3,4}/
6394    \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
6395 0: \x09 \xa0X\x0a\x0b\x0c\x0d
6396    \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
6397 0: \x09 \xa0\x0a\x0b\x0c\x0d
6398    \x09\x20\xa0\x0a\x0b\x0c
6399 0: \x09 \xa0\x0a\x0b\x0c
6400\= Expect no match
6401    \x09\x20\xa0\x0a\x0b
6402No match
6403
6404/\H{3,4}/
6405    XY  ABCDE
6406 0: ABCD
6407    XY  PQR ST
6408 0: PQR
6409
6410/.\h{3,4}./
6411    XY  AB    PQRS
6412 0: B    P
6413 1: B
6414
6415/\h*X\h?\H+Y\H?Z/
6416    >XNNNYZ
6417 0: XNNNYZ
6418    >  X NYQZ
6419 0:   X NYQZ
6420\= Expect no match
6421    >XYZ
6422No match
6423    >  X NY Z
6424No match
6425
6426/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
6427    >XY\x0aZ\x0aA\x0bNN\x0c
6428 0: XY\x0aZ\x0aA\x0bNN\x0c
6429    >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
6430 0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
6431
6432/.+A/newline=crlf
6433\= Expect no match
6434    \r\nA
6435No match
6436
6437/\nA/newline=crlf
6438    \r\nA
6439 0: \x0aA
6440
6441/[\r\n]A/newline=crlf
6442    \r\nA
6443 0: \x0aA
6444
6445/(\r|\n)A/newline=crlf
6446    \r\nA
6447 0: \x0aA
6448
6449/a\Rb/I,bsr=anycrlf
6450Capture group count = 0
6451\R matches CR, LF, or CRLF
6452First code unit = 'a'
6453Last code unit = 'b'
6454Subject length lower bound = 3
6455    a\rb
6456 0: a\x0db
6457    a\nb
6458 0: a\x0ab
6459    a\r\nb
6460 0: a\x0d\x0ab
6461\= Expect no match
6462    a\x85b
6463No match
6464    a\x0bb
6465No match
6466
6467/a\Rb/I,bsr=unicode
6468Capture group count = 0
6469\R matches any Unicode newline
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    a\x85b
6480 0: a\x85b
6481    a\x0bb
6482 0: a\x0bb
6483
6484/a\R?b/I,bsr=anycrlf
6485Capture group count = 0
6486\R matches CR, LF, or CRLF
6487First code unit = 'a'
6488Last code unit = 'b'
6489Subject length lower bound = 2
6490    a\rb
6491 0: a\x0db
6492    a\nb
6493 0: a\x0ab
6494    a\r\nb
6495 0: a\x0d\x0ab
6496\= Expect no match
6497    a\x85b
6498No match
6499    a\x0bb
6500No match
6501
6502/a\R?b/I,bsr=unicode
6503Capture group count = 0
6504\R matches any Unicode newline
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    a\x85b
6515 0: a\x85b
6516    a\x0bb
6517 0: a\x0bb
6518
6519/a\R{2,4}b/I,bsr=anycrlf
6520Capture group count = 0
6521\R matches CR, LF, or CRLF
6522First code unit = 'a'
6523Last code unit = 'b'
6524Subject length lower bound = 4
6525    a\r\n\nb
6526 0: a\x0d\x0a\x0ab
6527    a\n\r\rb
6528 0: a\x0a\x0d\x0db
6529    a\r\n\r\n\r\n\r\nb
6530 0: a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0ab
6531\= Expect no match
6532    a\x0b\x0bb
6533No match
6534    a\x85\x85b
6535No match
6536
6537/a\R{2,4}b/I,bsr=unicode
6538Capture group count = 0
6539\R matches any Unicode newline
6540First code unit = 'a'
6541Last code unit = 'b'
6542Subject length lower bound = 4
6543    a\r\rb
6544 0: a\x0d\x0db
6545    a\n\n\nb
6546 0: a\x0a\x0a\x0ab
6547    a\r\n\n\r\rb
6548 0: a\x0d\x0a\x0a\x0d\x0db
6549    a\x85\x85b
6550 0: a\x85\x85b
6551    a\x0b\x0bb
6552 0: a\x0b\x0bb
6553\= Expect no match
6554    a\r\r\r\r\rb
6555No match
6556
6557/a(?!)|\wbc/
6558    abc
6559 0: abc
6560
6561/a[]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
6562\= Expect no match
6563    ab
6564No match
6565
6566/a[]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
6567\= Expect no match
6568    ab
6569No match
6570
6571/a[]*+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
6572\= Expect no match
6573    ab
6574No match
6575
6576/a[^]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
6577    aXb
6578 0: aXb
6579    a\nb
6580 0: a\x0ab
6581\= Expect no match
6582    ab
6583No match
6584
6585/a[^]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
6586    aXb
6587 0: aXb
6588    a\nX\nXb
6589 0: a\x0aX\x0aXb
6590\= Expect no match
6591    ab
6592No match
6593
6594/X$/dollar_endonly
6595    X
6596 0: X
6597\= Expect no match
6598    X\n
6599No match
6600
6601/X$/
6602    X
6603 0: X
6604    X\n
6605 0: X
6606
6607/xyz/auto_callout
6608  xyz
6609--->xyz
6610 +0 ^       x
6611 +1 ^^      y
6612 +2 ^ ^     z
6613 +3 ^  ^    End of pattern
6614 0: xyz
6615  abcxyz
6616--->abcxyz
6617 +0    ^       x
6618 +1    ^^      y
6619 +2    ^ ^     z
6620 +3    ^  ^    End of pattern
6621 0: xyz
6622\= Expect no match
6623  abc
6624No match
6625  abcxypqr
6626No match
6627
6628/xyz/auto_callout,no_start_optimize
6629  abcxyz
6630--->abcxyz
6631 +0 ^          x
6632 +0  ^         x
6633 +0   ^        x
6634 +0    ^       x
6635 +1    ^^      y
6636 +2    ^ ^     z
6637 +3    ^  ^    End of pattern
6638 0: xyz
6639\= Expect no match
6640  abc
6641--->abc
6642 +0 ^       x
6643 +0  ^      x
6644 +0   ^     x
6645 +0    ^    x
6646No match
6647  abcxypqr
6648--->abcxypqr
6649 +0 ^            x
6650 +0  ^           x
6651 +0   ^          x
6652 +0    ^         x
6653 +1    ^^        y
6654 +2    ^ ^       z
6655 +0     ^        x
6656 +0      ^       x
6657 +0       ^      x
6658 +0        ^     x
6659 +0         ^    x
6660No match
6661
6662/(*NO_START_OPT)xyz/auto_callout
6663  abcxyz
6664--->abcxyz
6665+15 ^          x
6666+15  ^         x
6667+15   ^        x
6668+15    ^       x
6669+16    ^^      y
6670+17    ^ ^     z
6671+18    ^  ^    End of pattern
6672 0: xyz
6673
6674/(?C)ab/
6675  ab
6676--->ab
6677  0 ^      a
6678 0: ab
6679  ab\=callout_none
6680 0: ab
6681
6682/ab/auto_callout
6683  ab
6684--->ab
6685 +0 ^      a
6686 +1 ^^     b
6687 +2 ^ ^    End of pattern
6688 0: ab
6689  ab\=callout_none
6690 0: ab
6691
6692/^"((?(?=[a])[^"])|b)*"$/auto_callout
6693    "ab"
6694--->"ab"
6695 +0 ^        ^
6696 +1 ^        "
6697 +2 ^^       (
6698+21 ^^       "
6699 +3 ^^       (?
6700+18 ^^       b
6701 +5 ^^       (?=
6702 +8  ^       [a]
6703+11  ^^      )
6704+12 ^^       [^"]
6705+16 ^ ^      )
6706+17 ^ ^      |
6707+21 ^ ^      "
6708 +3 ^ ^      (?
6709+18 ^ ^      b
6710 +5 ^ ^      (?=
6711 +8   ^      [a]
6712+19 ^  ^     )*
6713+21 ^  ^     "
6714 +3 ^  ^     (?
6715+18 ^  ^     b
6716 +5 ^  ^     (?=
6717 +8    ^     [a]
6718+17 ^  ^     |
6719+22 ^   ^    $
6720+23 ^   ^    End of pattern
6721 0: "ab"
6722    "ab"\=callout_none
6723 0: "ab"
6724
6725/\d+X|9+Y/
6726    ++++123999\=ps
6727Partial match: 123999
6728    ++++123999Y\=ps
6729 0: 999Y
6730
6731/Z(*F)/
6732\= Expect no match
6733    Z\=ps
6734No match
6735    ZA\=ps
6736No match
6737
6738/Z(?!)/
6739\= Expect no match
6740    Z\=ps
6741No match
6742    ZA\=ps
6743No match
6744
6745/dog(sbody)?/
6746    dogs\=ps
6747 0: dog
6748    dogs\=ph
6749Partial match: dogs
6750
6751/dog(sbody)??/
6752    dogs\=ps
6753 0: dog
6754    dogs\=ph
6755Partial match: dogs
6756
6757/dog|dogsbody/
6758    dogs\=ps
6759 0: dog
6760    dogs\=ph
6761Partial match: dogs
6762
6763/dogsbody|dog/
6764    dogs\=ps
6765 0: dog
6766    dogs\=ph
6767Partial match: dogs
6768
6769/Z(*F)Q|ZXY/
6770    Z\=ps
6771Partial match: Z
6772\= Expect no match
6773    ZA\=ps
6774No match
6775    X\=ps
6776No match
6777
6778/\bthe cat\b/
6779    the cat\=ps
6780 0: the cat
6781    the cat\=ph
6782Partial match: the cat
6783
6784/dog(sbody)?/
6785    dogs\=ps
6786 0: dog
6787    body\=dfa_restart
6788 0: body
6789
6790/dog(sbody)?/
6791    dogs\=ph
6792Partial match: dogs
6793    body\=dfa_restart
6794 0: body
6795
6796/abc/
6797   abc\=ps
6798 0: abc
6799   abc\=ph
6800 0: abc
6801
6802/abc\K123/
6803    xyzabc123pqr
6804Failed: error -42: pattern contains an item that is not supported for DFA matching
6805
6806/(?<=abc)123/allusedtext
6807    xyzabc123pqr
6808 0: abc123
6809    <<<
6810    xyzabc12\=ps
6811Partial match: abc12
6812               <<<
6813    xyzabc12\=ph
6814Partial match: abc12
6815               <<<
6816
6817/\babc\b/allusedtext
6818    +++abc+++
6819 0: +abc+
6820    <   >
6821    +++ab\=ps
6822Partial match: +ab
6823               <
6824    +++ab\=ph
6825Partial match: +ab
6826               <
6827
6828/(?=C)/g,aftertext
6829    ABCDECBA
6830 0:
6831 0+ CDECBA
6832 0:
6833 0+ CBA
6834
6835/(abc|def|xyz)/I
6836Capture group count = 1
6837Starting code units: a d x
6838Subject length lower bound = 3
6839    terhjk;abcdaadsfe
6840 0: abc
6841    the quick xyz brown fox
6842 0: xyz
6843\= Expect no match
6844    thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
6845No match
6846
6847/(abc|def|xyz)/I,no_start_optimize
6848Capture group count = 1
6849Options: no_start_optimize
6850    terhjk;abcdaadsfe
6851 0: abc
6852    the quick xyz brown fox
6853 0: xyz
6854\= Expect no match
6855    thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
6856No match
6857
6858/abcd*/aftertext
6859    xxxxabcd\=ps
6860 0: abcd
6861 0+
6862    xxxxabcd\=ph
6863Partial match: abcd
6864    dddxxx\=dfa_restart
6865 0: ddd
6866 0+ xxx
6867    xxxxabcd\=ph
6868Partial match: abcd
6869    xxx\=dfa_restart
6870 0:
6871 0+ xxx
6872
6873/abcd*/i
6874    xxxxabcd\=ps
6875 0: abcd
6876    xxxxabcd\=ph
6877Partial match: abcd
6878    XXXXABCD\=ps
6879 0: ABCD
6880    XXXXABCD\=ph
6881Partial match: ABCD
6882
6883/abc\d*/
6884    xxxxabc1\=ps
6885 0: abc1
6886    xxxxabc1\=ph
6887Partial match: abc1
6888
6889/abc[de]*/
6890    xxxxabcde\=ps
6891 0: abcde
6892    xxxxabcde\=ph
6893Partial match: abcde
6894
6895/(?:(?1)|B)(A(*F)|C)/
6896    ABCD
6897 0: BC
6898    CCD
6899 0: CC
6900\= Expect no match
6901    CAD
6902No match
6903
6904/^(?:(?1)|B)(A(*F)|C)/
6905    CCD
6906 0: CC
6907    BCD
6908 0: BC
6909\= Expect no match
6910    ABCD
6911No match
6912    CAD
6913No match
6914    BAD
6915No match
6916
6917/^(?!a(*SKIP)b)/
6918    ac
6919Failed: error -42: pattern contains an item that is not supported for DFA matching
6920
6921/^(?=a(*SKIP)b|ac)/
6922    ac
6923Failed: error -42: pattern contains an item that is not supported for DFA matching
6924
6925/^(?=a(*THEN)b|ac)/
6926    ac
6927Failed: error -42: pattern contains an item that is not supported for DFA matching
6928
6929/^(?=a(*PRUNE)b)/
6930    ab
6931Failed: error -42: pattern contains an item that is not supported for DFA matching
6932
6933/^(?(?!a(*SKIP)b))/
6934    ac
6935Failed: error -42: pattern contains an item that is not supported for DFA matching
6936
6937/(?<=abc)def/allusedtext
6938    abc\=ph
6939Partial match: abc
6940               <<<
6941
6942/abc$/
6943    abc
6944 0: abc
6945    abc\=ps
6946 0: abc
6947    abc\=ph
6948Partial match: abc
6949
6950/abc$/m
6951    abc
6952 0: abc
6953    abc\n
6954 0: abc
6955    abc\=ph
6956Partial match: abc
6957    abc\n\=ph
6958 0: abc
6959    abc\=ps
6960 0: abc
6961    abc\n\=ps
6962 0: abc
6963
6964/abc\z/
6965    abc
6966 0: abc
6967    abc\=ps
6968 0: abc
6969    abc\=ph
6970Partial match: abc
6971
6972/abc\Z/
6973    abc
6974 0: abc
6975    abc\=ps
6976 0: abc
6977    abc\=ph
6978Partial match: abc
6979
6980/abc\b/
6981    abc
6982 0: abc
6983    abc\=ps
6984 0: abc
6985    abc\=ph
6986Partial match: abc
6987
6988/abc\B/
6989    abc\=ps
6990Partial match: abc
6991    abc\=ph
6992Partial match: abc
6993\= Expect no match
6994    abc
6995No match
6996
6997/.+/
6998    abc\=offset=0
6999 0: abc
7000    abc\=offset=1
7001 0: bc
7002    abc\=offset=2
7003 0: c
7004\= Bad offsets
7005    abc\=offset=4
7006Failed: error -33: bad offset value
7007    abc\=offset=-4
7008** Invalid value in 'offset=-4'
7009\= Expect no match
7010    abc\=offset=3
7011No match
7012
7013/^(?:a)++\w/
7014     aaaab
7015 0: aaaab
7016\= Expect no match
7017     aaaa
7018No match
7019     bbb
7020No match
7021
7022/^(?:aa|(?:a)++\w)/
7023     aaaab
7024 0: aaaab
7025 1: aa
7026     aaaa
7027 0: aa
7028\= Expect no match
7029     bbb
7030No match
7031
7032/^(?:a)*+\w/
7033     aaaab
7034 0: aaaab
7035     bbb
7036 0: b
7037\= Expect no match
7038     aaaa
7039No match
7040
7041/^(a)++\w/
7042     aaaab
7043 0: aaaab
7044\= Expect no match
7045     aaaa
7046No match
7047     bbb
7048No match
7049
7050/^(a|)++\w/
7051     aaaab
7052 0: aaaab
7053\= Expect no match
7054     aaaa
7055No match
7056     bbb
7057No match
7058
7059/(?=abc){3}abc/aftertext
7060    abcabcabc
7061 0: abc
7062 0+ abcabc
7063\= Expect no match
7064    xyz
7065No match
7066
7067/(?=abc)+abc/aftertext
7068    abcabcabc
7069 0: abc
7070 0+ abcabc
7071\= Expect no match
7072    xyz
7073No match
7074
7075/(?=abc)++abc/aftertext
7076    abcabcabc
7077 0: abc
7078 0+ abcabc
7079\= Expect no match
7080    xyz
7081No match
7082
7083/(?=abc){0}xyz/
7084    xyz
7085 0: xyz
7086
7087/(?=abc){1}xyz/
7088\= Expect no match
7089    xyz
7090No match
7091
7092/(?=(a))?./
7093    ab
7094 0: a
7095    bc
7096 0: b
7097
7098/(?=(a))??./
7099    ab
7100 0: a
7101    bc
7102 0: b
7103
7104/^(?=(a)){0}b(?1)/
7105    backgammon
7106 0: ba
7107
7108/^(?=(?1))?[az]([abc])d/
7109    abd
7110 0: abd
7111    zcdxx
7112 0: zcd
7113
7114/^(?!a){0}\w+/
7115    aaaaa
7116 0: aaaaa
7117
7118/(?<=(abc))?xyz/
7119    abcxyz
7120 0: xyz
7121    pqrxyz
7122 0: xyz
7123
7124/((?2))((?1))/
7125    abc
7126Failed: error -52: nested recursion at the same subject position
7127
7128/(?(R)a+|(?R)b)/
7129    aaaabcde
7130 0: aaaab
7131
7132/(?(R)a+|((?R))b)/
7133    aaaabcde
7134 0: aaaab
7135
7136/((?(R)a+|(?1)b))/
7137    aaaabcde
7138 0: aaaab
7139
7140/((?(R2)a+|(?1)b))()/
7141    aaaabcde
7142Failed: error -40: backreference condition or recursion test is not supported for DFA matching
7143
7144/(?(R)a*(?1)|((?R))b)/
7145    aaaabcde
7146Failed: error -52: nested recursion at the same subject position
7147
7148/(a+)/no_auto_possess
7149    aaaa\=ovector=3
7150Matched, but offsets vector is too small to show all matches
7151 0: aaaa
7152 1: aaa
7153 2: aa
7154    aaaa\=ovector=4
7155 0: aaaa
7156 1: aaa
7157 2: aa
7158 3: a
7159
7160/^\R/
7161    \r\=ps
7162 0: \x0d
7163    \r\=ph
7164Partial match: \x0d
7165
7166/^\R{2,3}x/
7167    \r\=ps
7168Partial match: \x0d
7169    \r\=ph
7170Partial match: \x0d
7171    \r\r\=ps
7172Partial match: \x0d\x0d
7173    \r\r\=ph
7174Partial match: \x0d\x0d
7175    \r\r\r\=ps
7176Partial match: \x0d\x0d\x0d
7177    \r\r\r\=ph
7178Partial match: \x0d\x0d\x0d
7179    \r\rx
7180 0: \x0d\x0dx
7181    \r\r\rx
7182 0: \x0d\x0d\x0dx
7183
7184/^\R{2,3}?x/
7185    \r\=ps
7186Partial match: \x0d
7187    \r\=ph
7188Partial match: \x0d
7189    \r\r\=ps
7190Partial match: \x0d\x0d
7191    \r\r\=ph
7192Partial match: \x0d\x0d
7193    \r\r\r\=ps
7194Partial match: \x0d\x0d\x0d
7195    \r\r\r\=ph
7196Partial match: \x0d\x0d\x0d
7197    \r\rx
7198 0: \x0d\x0dx
7199    \r\r\rx
7200 0: \x0d\x0d\x0dx
7201
7202/^\R?x/
7203    \r\=ps
7204Partial match: \x0d
7205    \r\=ph
7206Partial match: \x0d
7207    x
7208 0: x
7209    \rx
7210 0: \x0dx
7211
7212/^\R+x/
7213    \r\=ps
7214Partial match: \x0d
7215    \r\=ph
7216Partial match: \x0d
7217    \r\n\=ps
7218Partial match: \x0d\x0a
7219    \r\n\=ph
7220Partial match: \x0d\x0a
7221    \rx
7222 0: \x0dx
7223
7224/^a$/newline=crlf
7225    a\r\=ps
7226Partial match: a\x0d
7227    a\r\=ph
7228Partial match: a\x0d
7229
7230/^a$/m,newline=crlf
7231    a\r\=ps
7232Partial match: a\x0d
7233    a\r\=ph
7234Partial match: a\x0d
7235
7236/^(a$|a\r)/newline=crlf
7237    a\r\=ps
7238 0: a\x0d
7239    a\r\=ph
7240Partial match: a\x0d
7241
7242/^(a$|a\r)/m,newline=crlf
7243    a\r\=ps
7244 0: a\x0d
7245    a\r\=ph
7246Partial match: a\x0d
7247
7248/./newline=crlf
7249    \r\=ps
7250 0: \x0d
7251    \r\=ph
7252Partial match: \x0d
7253
7254/.{2,3}/newline=crlf
7255    \r\=ps
7256Partial match: \x0d
7257    \r\=ph
7258Partial match: \x0d
7259    \r\r\=ps
7260 0: \x0d\x0d
7261    \r\r\=ph
7262Partial match: \x0d\x0d
7263    \r\r\r\=ps
7264 0: \x0d\x0d\x0d
7265    \r\r\r\=ph
7266Partial match: \x0d\x0d\x0d
7267
7268/.{2,3}?/newline=crlf
7269    \r\=ps
7270Partial match: \x0d
7271    \r\=ph
7272Partial match: \x0d
7273    \r\r\=ps
7274 0: \x0d\x0d
7275    \r\r\=ph
7276Partial match: \x0d\x0d
7277    \r\r\r\=ps
7278 0: \x0d\x0d\x0d
7279 1: \x0d\x0d
7280    \r\r\r\=ph
7281Partial match: \x0d\x0d\x0d
7282
7283# Test simple validity check for restarts
7284
7285/abcdef/
7286   abc\=dfa_restart
7287Failed: error -38: invalid data in workspace for DFA restart
7288
7289/<H((?(?!<H|F>)(.)|(?R))++)*F>/
7290    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.
7291 0: <H more text <H texting more  hexA0-"\xa0"    hex above 7F-"\xbc" F> text xxxxx <H text F> text F>
7292
7293/^(?>.{4})abc|^\w\w.xabcd/
7294    xxxxabcd
7295 0: xxxxabcd
7296 1: xxxxabc
7297    xx\xa0xabcd
7298 0: xx\xa0xabcd
7299 1: xx\xa0xabc
7300
7301/^(.{4}){2}+abc|^\w\w.x\w\w\w\wabcd/
7302    xxxxxxxxabcd
7303 0: xxxxxxxxabcd
7304 1: xxxxxxxxabc
7305    xx\xa0xxxxxabcd
7306 0: xx\xa0xxxxxabcd
7307 1: xx\xa0xxxxxabc
7308
7309/abcd/
7310    abcd\=ovector=0
7311 0: abcd
7312
7313# These tests show up auto-possessification
7314
7315/[ab]*/
7316    aaaa
7317 0: aaaa
7318
7319/[ab]*?/
7320    aaaa
7321 0: aaaa
7322 1: aaa
7323 2: aa
7324 3: a
7325 4:
7326
7327/[ab]?/
7328    aaaa
7329 0: a
7330
7331/[ab]??/
7332    aaaa
7333 0: a
7334 1:
7335
7336/[ab]+/
7337    aaaa
7338 0: aaaa
7339
7340/[ab]+?/
7341    aaaa
7342 0: aaaa
7343 1: aaa
7344 2: aa
7345 3: a
7346
7347/[ab]{2,3}/
7348    aaaa
7349 0: aaa
7350
7351/[ab]{2,3}?/
7352    aaaa
7353 0: aaa
7354 1: aa
7355
7356/[ab]{2,}/
7357    aaaa
7358 0: aaaa
7359
7360/[ab]{2,}?/
7361    aaaa
7362 0: aaaa
7363 1: aaa
7364 2: aa
7365
7366'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++'
7367    NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
7368 0: NON QUOTED "QUOT""ED" AFTER
7369
7370'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
7371    NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
7372 0: NON QUOTED "QUOT""ED" AFTER
7373
7374/abc(?=xyz)/allusedtext
7375    abcxyzpqr
7376 0: abcxyz
7377       >>>
7378    abcxyzpqr\=aftertext
7379 0: abcxyz
7380       >>>
7381 0+ xyzpqr
7382
7383/(?<=pqr)abc(?=xyz)/allusedtext
7384    xyzpqrabcxyzpqr
7385 0: pqrabcxyz
7386    <<<   >>>
7387    xyzpqrabcxyzpqr\=aftertext
7388 0: pqrabcxyz
7389    <<<   >>>
7390 0+ xyzpqr
7391
7392/a\b/
7393    a.\=allusedtext
7394 0: a.
7395     >
7396    a\=allusedtext
7397 0: a
7398
7399/abc(?=abcde)(?=ab)/allusedtext
7400    abcabcdefg
7401 0: abcabcde
7402       >>>>>
7403
7404/a*?b*?/
7405    ab
7406 0: ab
7407 1: a
7408 2:
7409
7410/(*NOTEMPTY)a*?b*?/
7411    ab
7412 0: ab
7413 1: a
7414    ba
7415 0: b
7416    cb
7417 0: b
7418
7419/(*NOTEMPTY_ATSTART)a*?b*?/aftertext
7420    ab
7421 0: ab
7422 0+
7423 1: a
7424    cdab
7425 0:
7426 0+ dab
7427
7428/(a)(b)|(c)/
7429    XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
7430 0: c
7431Get substring 1 failed (-55): requested value is not set
7432Get substring 2 failed (-54): requested value is not available
7433Get substring 3 failed (-54): requested value is not available
7434Get substring 4 failed (-54): requested value is not available
7435 0L c
7436
7437/(?<A>aa)/
7438    aa\=get=A
7439 0: aa
7440Get substring 'A' failed (-41): function is not supported for DFA matching
7441    aa\=copy=A
7442 0: aa
7443Copy substring 'A' failed (-41): function is not supported for DFA matching
7444
7445/a+/no_auto_possess
7446    a\=ovector=2,get=1,get=2,getall
7447 0: a
7448Get substring 1 failed (-55): requested value is not set
7449Get substring 2 failed (-54): requested value is not available
7450 0L a
7451    aaa\=ovector=2,get=1,get=2,getall
7452Matched, but offsets vector is too small to show all matches
7453 0: aaa
7454 1: aa
7455 1G aa (2)
7456Get substring 2 failed (-54): requested value is not available
7457 0L aaa
7458 1L aa
7459
7460/a(b)c(d)/
7461    abc\=ph,copy=0,copy=1,getall
7462Partial match: abc
7463 0C abc (3)
7464Copy substring 1 failed (-2): partial match
7465get substring list failed (-2): partial match
7466
7467/ab(?C" any text with spaces ")cde/B
7468------------------------------------------------------------------
7469        Bra
7470        ab
7471        CalloutStr " any text with spaces " 6 30 1
7472        cde
7473        Ket
7474        End
7475------------------------------------------------------------------
7476    abcde
7477Callout (6): " any text with spaces "
7478--->abcde
7479    ^ ^       c
7480 0: abcde
7481    12abcde
7482Callout (6): " any text with spaces "
7483--->12abcde
7484      ^ ^       c
7485 0: abcde
7486
7487/^a(b)c(?C1)def/
7488      abcdef
7489--->abcdef
7490  1 ^  ^       d
7491 0: abcdef
7492
7493/^a(b)c(?C"AB")def/
7494      abcdef
7495Callout (10): "AB"
7496--->abcdef
7497    ^  ^       d
7498 0: abcdef
7499
7500/^a(b)c(?C1)def/
7501      abcdef\=callout_capture
7502Callout 1: last capture = 0
7503--->abcdef
7504    ^  ^       d
7505 0: abcdef
7506
7507/^a(b)c(?C{AB})def/B
7508------------------------------------------------------------------
7509        Bra
7510        ^
7511        a
7512        CBra 1
7513        b
7514        Ket
7515        c
7516        CalloutStr {AB} 10 14 1
7517        def
7518        Ket
7519        End
7520------------------------------------------------------------------
7521      abcdef\=callout_capture
7522Callout (10): {AB} last capture = 0
7523--->abcdef
7524    ^  ^       d
7525 0: abcdef
7526
7527/^(?(?C25)(?=abc)abcd|xyz)/B
7528------------------------------------------------------------------
7529        Bra
7530        ^
7531        Cond
7532        Callout 25 9 3
7533        Assert
7534        abc
7535        Ket
7536        abcd
7537        Alt
7538        xyz
7539        Ket
7540        Ket
7541        End
7542------------------------------------------------------------------
7543    abcdefg
7544--->abcdefg
7545 25 ^           (?=
7546 0: abcd
7547    xyz123
7548--->xyz123
7549 25 ^          (?=
7550 0: xyz
7551
7552/^(?(?C$abc$)(?=abc)abcd|xyz)/B
7553------------------------------------------------------------------
7554        Bra
7555        ^
7556        Cond
7557        CalloutStr $abc$ 7 12 3
7558        Assert
7559        abc
7560        Ket
7561        abcd
7562        Alt
7563        xyz
7564        Ket
7565        Ket
7566        End
7567------------------------------------------------------------------
7568    abcdefg
7569Callout (7): $abc$
7570--->abcdefg
7571    ^           (?=
7572 0: abcd
7573    xyz123
7574Callout (7): $abc$
7575--->xyz123
7576    ^          (?=
7577 0: xyz
7578
7579/^ab(?C'first')cd(?C"second")ef/
7580    abcdefg
7581Callout (7): 'first'
7582--->abcdefg
7583    ^ ^         c
7584Callout (20): "second"
7585--->abcdefg
7586    ^   ^       e
7587 0: abcdef
7588
7589/(?:a(?C`code`)){3}X/
7590    aaaXY
7591Callout (8): `code`
7592--->aaaXY
7593    ^^        ){3}
7594Callout (8): `code`
7595--->aaaXY
7596    ^ ^       ){3}
7597Callout (8): `code`
7598--->aaaXY
7599    ^  ^      ){3}
7600 0: aaaX
7601
7602# Binary zero in callout string
7603/"a(?C'x" 00 "z')b"/hex
7604    abcdefgh
7605Callout (5): 'x\x00z'
7606--->abcdefgh
7607    ^^           b
7608 0: ab
7609
7610/(?(?!)a|b)/
7611    bbb
7612 0: b
7613\= Expect no match
7614    aaa
7615No match
7616
7617/^/gm
7618    \n\n\n
7619 0:
7620 0:
7621 0:
7622
7623/^/gm,alt_circumflex
7624    \n\n\n
7625 0:
7626 0:
7627 0:
7628 0:
7629
7630/abc/use_offset_limit
7631    1234abcde\=offset_limit=100
7632 0: abc
7633    1234abcde\=offset_limit=9
7634 0: abc
7635    1234abcde\=offset_limit=4
7636 0: abc
7637    1234abcde\=offset_limit=4,offset=4
7638 0: abc
7639\= Expect no match
7640    1234abcde\=offset_limit=4,offset=5
7641No match
7642    1234abcde\=offset_limit=3
7643No match
7644
7645/(?<=abc)/use_offset_limit
7646    1234abc\=offset_limit=7
7647 0:
7648\= Expect no match
7649    1234abc\=offset_limit=6
7650No match
7651
7652/abcd/null_context
7653    abcd\=null_context
7654 0: abcd
7655
7656/()()a+/no_auto_possess
7657    aaa\=allcaptures
7658** Ignored after DFA matching: allcaptures
7659 0: aaa
7660 1: aa
7661 2: a
7662    a\=allcaptures
7663** Ignored after DFA matching: allcaptures
7664 0: a
7665
7666/(*LIMIT_DEPTH=100)^((.)(?1)|.)$/
7667\= Expect depth limit exceeded
7668    a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
7669Failed: error -53: matching depth limit exceeded
7670
7671/(*LIMIT_HEAP=0)^((.)(?1)|.)$/
7672\= Expect heap limit exceeded
7673    a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
7674Failed: error -63: heap limit exceeded
7675
7676/(*LIMIT_HEAP=50000)^((.)(?1)|.)$/
7677\= Expect success
7678    a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
7679 0: a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
7680
7681/(02-)?[0-9]{3}-[0-9]{3}/
7682    02-123-123
7683 0: 02-123-123
7684
7685/^(a(?2))(b)(?1)/
7686    abbab\=find_limits
7687Minimum heap limit = 0
7688Minimum match limit = 4
7689Minimum depth limit = 2
7690 0: abbab
7691
7692/abc/endanchored
7693    xyzabc
7694 0: abc
7695\= Expect no match
7696    xyzabcdef
7697No match
7698\= Expect error
7699    xyzabc\=ph
7700Failed: error -34: bad option value
7701
7702/abc/
7703    xyzabc\=endanchored
7704 0: abc
7705\= Expect no match
7706    xyzabcdef\=endanchored
7707No match
7708\= Expect error
7709    xyzabc\=ps,endanchored
7710Failed: error -34: bad option value
7711
7712/abc|bcd/endanchored
7713    xyzabcd
7714 0: bcd
7715\= Expect no match
7716    xyzabcdef
7717No match
7718
7719/(*NUL)^.*/
7720    a\nb\x00ccc
7721 0: a\x0ab
7722
7723/(*NUL)^.*/s
7724    a\nb\x00ccc
7725 0: a\x0ab\x00ccc
7726
7727/^x/m,newline=nul
7728    ab\x00xy
7729 0: x
7730
7731/'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex
7732    x\nyz
7733 0: x\x0ay
7734
7735/(*NUL)^X\NY/
7736    X\nY
7737 0: X\x0aY
7738    X\rY
7739 0: X\x0dY
7740\= Expect no match
7741    X\x00Y
7742No match
7743
7744/(?<=abc|)/
7745    abcde\=aftertext
7746 0:
7747 0+ abcde
7748
7749/(?<=|abc)/
7750    abcde\=aftertext
7751 0:
7752 0+ abcde
7753
7754/(?<=abc|)/endanchored
7755    abcde\=aftertext
7756 0:
7757 0+
7758
7759/(?<=|abc)/endanchored
7760    abcde\=aftertext
7761 0:
7762 0+
7763
7764/(*LIMIT_MATCH=100).*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00\x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););/no_dotstar_anchor
7765\= Expect limit exceeded
7766.*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00\x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););
7767Failed: error -47: match limit exceeded
7768
7769/\n/firstline
7770    xyz\nabc
7771 0: \x0a
7772
7773/\nabc/firstline
7774    xyz\nabc
7775 0: \x0aabc
7776
7777/\x{0a}abc/firstline,newline=crlf
7778\= Expect no match
7779    xyz\r\nabc
7780No match
7781
7782/[abc]/firstline
7783\= Expect no match
7784    \na
7785No match
7786
7787/foobar/
7788    the foobar thing\=copy_matched_subject
7789 0: foobar
7790    the foobar thing\=copy_matched_subject,zero_terminate
7791 0: foobar
7792
7793/foobar/g
7794    the foobar thing foobar again\=copy_matched_subject
7795 0: foobar
7796 0: foobar
7797
7798/(?(VERSION>=0)^B0W)/
7799    B0W-W0W
7800 0: B0W
7801\= Expect no match
7802    0
7803No match
7804
7805/(?(VERSION>=1000)^B0W|W0W)/
7806    B0W-W0W
7807 0: W0W
7808\= Expect no match
7809    0
7810No match
7811
7812/(?<=pqr)abc(?=xyz)/
7813    123pqrabcxy\=ps,allusedtext
7814Partial match: pqrabcxy
7815               <<<
7816    123pqrabcxyz\=ps,allusedtext
7817 0: pqrabcxyz
7818    <<<   >>>
7819
7820/(?>a+b)/
7821    aaaa\=ps
7822Partial match: aaaa
7823    aaaab\=ps
7824 0: aaaab
7825
7826/(abc)(?1)/
7827    abca\=ps
7828Partial match: abca
7829    abcabc\=ps
7830 0: abcabc
7831
7832/(?(?=abc).*|Z)/
7833    ab\=ps
7834Partial match: ab
7835    abcxyz\=ps
7836 0: abcxyz
7837
7838/(abc)++x/
7839    abcab\=ps
7840Partial match: abcab
7841    abc\=ps
7842Partial match: abc
7843    ab\=ps
7844Partial match: ab
7845    abcx
7846 0: abcx
7847
7848/\z/
7849    abc\=ph
7850Partial match:
7851    abc\=ps
7852 0:
7853
7854/\Z/
7855    abc\=ph
7856Partial match:
7857    abc\=ps
7858 0:
7859    abc\n\=ph
7860Partial match: \x0a
7861    abc\n\=ps
7862 0:
7863
7864/c*+(?<=[bc])/
7865    abc\=ph
7866Partial match: c
7867    ab\=ph
7868Partial match:
7869    abc\=ps
7870 0: c
7871    ab\=ps
7872 0:
7873
7874/c++(?<=[bc])/
7875    abc\=ph
7876Partial match: c
7877    ab\=ph
7878Partial match:
7879
7880/(?<=(?=.(?<=x)))/
7881    abx
7882 0:
7883    ab\=ph
7884Partial match:
7885    bxyz
7886 0:
7887    xyz
7888 0:
7889
7890/(?![ab]).*/
7891    ab\=ph
7892Partial match:
7893
7894/c*+/
7895    ab\=ph,offset=2
7896Partial match:
7897
7898# End of testinput6
7899