• 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
12/ab*c/
13    abc
14    abbbbc
15    ac
16
17/ab+c/
18    abc
19    abbbbbbc
20\= Expect no match
21    ac
22    ab
23
24/a*/no_auto_possess
25    a
26    aaaaaaaaaaaaaaaaa
27    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=10
28    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=dfa_shortest
29
30/(a|abcd|african)/
31    a
32    abcd
33    african
34
35/^abc/
36    abcdef
37\= Expect no match
38    xyzabc
39    xyz\nabc
40
41/^abc/m
42    abcdef
43    xyz\nabc
44\= Expect no match
45    xyzabc
46
47/\Aabc/
48    abcdef
49\= Expect no match
50    xyzabc
51    xyz\nabc
52
53/\Aabc/m
54    abcdef
55\= Expect no match
56    xyzabc
57    xyz\nabc
58
59/\Gabc/
60    abcdef
61    xyzabc\=offset=3
62\= Expect no match
63    xyzabc
64    xyzabc\=offset=2
65
66/x\dy\Dz/
67    x9yzz
68    x0y+z
69\= Expect no match
70    xyz
71    xxy0z
72
73/x\sy\Sz/
74    x yzz
75    x y+z
76\= Expect no match
77    xyz
78    xxyyz
79
80/x\wy\Wz/
81    xxy+z
82\= Expect no match
83    xxy0z
84    x+y+z
85
86/x.y/
87    x+y
88    x-y
89\= Expect no match
90    x\ny
91
92/x.y/s
93    x+y
94    x-y
95    x\ny
96
97/(a.b(?s)c.d|x.y)p.q/
98    a+bc+dp+q
99    a+bc\ndp+q
100    x\nyp+q
101\= Expect no match
102    a\nbc\ndp+q
103    a+bc\ndp\nq
104    x\nyp\nq
105
106/a\d\z/
107    ba0
108\= Expect no match
109    ba0\n
110    ba0\ncd
111
112/a\d\z/m
113    ba0
114\= Expect no match
115    ba0\n
116    ba0\ncd
117
118/a\d\Z/
119    ba0
120    ba0\n
121\= Expect no match
122    ba0\ncd
123
124/a\d\Z/m
125    ba0
126    ba0\n
127\= Expect no match
128    ba0\ncd
129
130/a\d$/
131    ba0
132    ba0\n
133\= Expect no match
134    ba0\ncd
135
136/a\d$/m
137    ba0
138    ba0\n
139    ba0\ncd
140
141/abc/i
142    abc
143    aBc
144    ABC
145
146/[^a]/
147    abcd
148
149/ab?\w/
150    abz
151    abbz
152    azz
153
154/x{0,3}yz/
155    ayzq
156    axyzq
157    axxyz
158    axxxyzq
159    axxxxyzq
160\= Expect no match
161    ax
162    axx
163
164/x{3}yz/
165    axxxyzq
166    axxxxyzq
167\= Expect no match
168    ax
169    axx
170    ayzq
171    axyzq
172    axxyz
173
174/x{2,3}yz/
175    axxyz
176    axxxyzq
177    axxxxyzq
178\= Expect no match
179    ax
180    axx
181    ayzq
182    axyzq
183
184/[^a]+/no_auto_possess
185    bac
186    bcdefax
187\= Expect no match
188    aaaaa
189
190/[^a]*/no_auto_possess
191    bac
192    bcdefax
193    aaaaa
194
195/[^a]{3,5}/no_auto_possess
196    xyz
197    awxyza
198    abcdefa
199    abcdefghijk
200\= Expect no match
201    axya
202    axa
203    aaaaa
204
205/\d*/
206    1234b567
207    xyz
208
209/\D*/
210    a1234b567
211    xyz
212
213/\d+/
214    ab1234c56
215\= Expect no match
216    xyz
217
218/\D+/
219    ab123c56
220\= Expect no match
221    789
222
223/\d?A/
224    045ABC
225    ABC
226\= Expect no match
227    XYZ
228
229/\D?A/
230    ABC
231    BAC
232    9ABC
233
234/a+/
235    aaaa
236
237/^.*xyz/
238    xyz
239    ggggggggxyz
240
241/^.+xyz/
242    abcdxyz
243    axyz
244\= Expect no match
245    xyz
246
247/^.?xyz/
248    xyz
249    cxyz
250
251/^\d{2,3}X/
252    12X
253    123X
254\= Expect no match
255    X
256    1X
257    1234X
258
259/^[abcd]\d/
260    a45
261    b93
262    c99z
263    d04
264\= Expect no match
265    e45
266    abcd
267    abcd1234
268    1234
269
270/^[abcd]*\d/
271    a45
272    b93
273    c99z
274    d04
275    abcd1234
276    1234
277\= Expect no match
278    e45
279    abcd
280
281/^[abcd]+\d/
282    a45
283    b93
284    c99z
285    d04
286    abcd1234
287\= Expect no match
288    1234
289    e45
290    abcd
291
292/^a+X/
293    aX
294    aaX
295
296/^[abcd]?\d/
297    a45
298    b93
299    c99z
300    d04
301    1234
302\= Expect no match
303    abcd1234
304    e45
305
306/^[abcd]{2,3}\d/
307    ab45
308    bcd93
309\= Expect no match
310    1234
311    a36
312    abcd1234
313    ee45
314
315/^(abc)*\d/
316    abc45
317    abcabcabc45
318    42xyz
319
320/^(abc)+\d/
321    abc45
322    abcabcabc45
323\= Expect no match
324    42xyz
325
326/^(abc)?\d/
327    abc45
328    42xyz
329\= Expect no match
330    abcabcabc45
331
332/^(abc){2,3}\d/
333    abcabc45
334    abcabcabc45
335\= Expect no match
336    abcabcabcabc45
337    abc45
338    42xyz
339
340/1(abc|xyz)2(?1)3/
341    1abc2abc3456
342    1abc2xyz3456
343
344/^(a*\w|ab)=(a*\w|ab)/
345    ab=ab
346
347/^(a*\w|ab)=(?1)/
348    ab=ab
349
350/^([^()]|\((?1)*\))*$/
351    abc
352    a(b)c
353    a(b(c))d
354\= Expect no match)
355    a(b(c)d
356
357/^>abc>([^()]|\((?1)*\))*<xyz<$/
358    >abc>123<xyz<
359    >abc>1(2)3<xyz<
360    >abc>(1(2)3)<xyz<
361
362/^(?>a*)\d/
363    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9876
364\= Expect no match
365    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
366
367/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/x
368    <>
369    <abcd>
370    <abc <123> hij>
371    <abc <def> hij>
372    <abc<>def>
373    <abc<>
374\= Expect no match
375    <abc
376
377/^(?(?=abc)\w{3}:|\d\d)$/
378    abc:
379    12
380\= Expect no match
381    123
382    xyz
383
384/^(?(?!abc)\d\d|\w{3}:)$/
385    abc:
386    12
387\= Expect no match
388    123
389    xyz
390
391/^(?=abc)\w{5}:$/
392    abcde:
393\= Expect no match
394    abc..
395    123
396    vwxyz
397
398/^(?!abc)\d\d$/
399    12
400\= Expect no match
401    abcde:
402    abc..
403    123
404    vwxyz
405
406/(?<=abc|xy)123/
407    abc12345
408    wxy123z
409\= Expect no match
410    123abc
411
412/(?<!abc|xy)123/
413    123abc
414    mno123456
415\= Expect no match
416    abc12345
417    wxy123z
418
419/abc(?C1)xyz/
420    abcxyz
421    123abcxyz999
422
423/(ab|cd){3,4}/auto_callout
424  ababab
425  abcdabcd
426  abcdcdcdcdcd
427
428/^abc/
429    abcdef
430\= Expect no match
431    abcdef\=notbol
432
433/^(a*|xyz)/
434    bcd
435    aaabcd
436    xyz
437    xyz\=notempty
438\= Expect no match
439    bcd\=notempty
440
441/xyz$/
442    xyz
443    xyz\n
444\= Expect no match
445    xyz\=noteol
446    xyz\n\=noteol
447
448/xyz$/m
449    xyz
450    xyz\n
451    abcxyz\npqr
452    abcxyz\npqr\=noteol
453    xyz\n\=noteol
454\= Expect no match
455    xyz\=noteol
456
457/\Gabc/
458    abcdef
459    defabcxyz\=offset=3
460\= Expect no match
461    defabcxyz
462
463/^abcdef/
464    ab\=ps
465    abcde\=ps
466    abcdef\=ps
467\= Expect no match
468    abx\=ps
469
470/^a{2,4}\d+z/
471    a\=ps
472    aa\=ps
473    aa2\=ps
474    aaa\=ps
475    aaa23\=ps
476    aaaa12345\=ps
477    aa0z\=ps
478    aaaa4444444444444z\=ps
479\= Expect no match
480    az\=ps
481    aaaaa\=ps
482    a56\=ps
483
484/^abcdef/
485   abc\=ps
486   def\=dfa_restart
487
488/(?<=foo)bar/
489   foob\=ps,offset=2
490   foobar...\=ps,dfa_restart,offset=4
491   foobar\=offset=2
492\= Expect no match
493   xyzfo\=ps
494   obar\=dfa_restart
495
496/(ab*(cd|ef))+X/
497    lkjhlkjhlkjhlkjhabbbbbbcdaefabbbbbbbefa\=ps,notbol,noteol
498    cdabbbbbbbb\=ps,notbol,dfa_restart,noteol
499    efabbbbbbbbbbbbbbbb\=ps,notbol,dfa_restart,noteol
500    bbbbbbbbbbbbcdXyasdfadf\=ps,notbol,dfa_restart,noteol
501\= Expect no match
502    adfadadaklhlkalkajhlkjahdfasdfasdfladsfjkj\=ps,noteol
503
504/the quick brown fox/
505    the quick brown fox
506    What do you know about the quick brown fox?
507\= Expect no match
508    The quick brown FOX
509    What do you know about THE QUICK BROWN FOX?
510
511/The quick brown fox/i
512    the quick brown fox
513    The quick brown FOX
514    What do you know about the quick brown fox?
515    What do you know about THE QUICK BROWN FOX?
516
517/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
518    abcd\t\n\r\f\a\e9;\$\\?caxyz
519
520/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
521    abxyzpqrrrabbxyyyypqAzz
522    abxyzpqrrrabbxyyyypqAzz
523    aabxyzpqrrrabbxyyyypqAzz
524    aaabxyzpqrrrabbxyyyypqAzz
525    aaaabxyzpqrrrabbxyyyypqAzz
526    abcxyzpqrrrabbxyyyypqAzz
527    aabcxyzpqrrrabbxyyyypqAzz
528    aaabcxyzpqrrrabbxyyyypAzz
529    aaabcxyzpqrrrabbxyyyypqAzz
530    aaabcxyzpqrrrabbxyyyypqqAzz
531    aaabcxyzpqrrrabbxyyyypqqqAzz
532    aaabcxyzpqrrrabbxyyyypqqqqAzz
533    aaabcxyzpqrrrabbxyyyypqqqqqAzz
534    aaabcxyzpqrrrabbxyyyypqqqqqqAzz
535    aaaabcxyzpqrrrabbxyyyypqAzz
536    abxyzzpqrrrabbxyyyypqAzz
537    aabxyzzzpqrrrabbxyyyypqAzz
538    aaabxyzzzzpqrrrabbxyyyypqAzz
539    aaaabxyzzzzpqrrrabbxyyyypqAzz
540    abcxyzzpqrrrabbxyyyypqAzz
541    aabcxyzzzpqrrrabbxyyyypqAzz
542    aaabcxyzzzzpqrrrabbxyyyypqAzz
543    aaaabcxyzzzzpqrrrabbxyyyypqAzz
544    aaaabcxyzzzzpqrrrabbbxyyyypqAzz
545    aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
546    aaabcxyzpqrrrabbxyyyypABzz
547    aaabcxyzpqrrrabbxyyyypABBzz
548    >>>aaabxyzpqrrrabbxyyyypqAzz
549    >aaaabxyzpqrrrabbxyyyypqAzz
550    >>>>abcxyzpqrrrabbxyyyypqAzz
551\= Expect no match
552    abxyzpqrrabbxyyyypqAzz
553    abxyzpqrrrrabbxyyyypqAzz
554    abxyzpqrrrabxyyyypqAzz
555    aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
556    aaaabcxyzzzzpqrrrabbbxyyypqAzz
557    aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
558
559/^(abc){1,2}zz/
560    abczz
561    abcabczz
562\= Expect no match
563    zz
564    abcabcabczz
565    >>abczz
566
567/^(b+?|a){1,2}?c/
568    bc
569    bbc
570    bbbc
571    bac
572    bbac
573    aac
574    abbbbbbbbbbbc
575    bbbbbbbbbbbac
576\= Expect no match
577    aaac
578    abbbbbbbbbbbac
579
580/^(b+|a){1,2}c/
581    bc
582    bbc
583    bbbc
584    bac
585    bbac
586    aac
587    abbbbbbbbbbbc
588    bbbbbbbbbbbac
589\= Expect no match
590    aaac
591    abbbbbbbbbbbac
592
593/^(b+|a){1,2}?bc/
594    bbc
595
596/^(b*|ba){1,2}?bc/
597    babc
598    bbabc
599    bababc
600\= Expect no match
601    bababbc
602    babababc
603
604/^(ba|b*){1,2}?bc/
605    babc
606    bbabc
607    bababc
608\= Expect no match
609    bababbc
610    babababc
611
612/^\ca\cA\c[\c{\c:/
613    \x01\x01\e;z
614
615/^[ab\]cde]/
616    athing
617    bthing
618    ]thing
619    cthing
620    dthing
621    ething
622\= Expect no match
623    fthing
624    [thing
625    \\thing
626
627/^[]cde]/
628    ]thing
629    cthing
630    dthing
631    ething
632\= Expect no match
633    athing
634    fthing
635
636/^[^ab\]cde]/
637    fthing
638    [thing
639    \\thing
640\= Expect no match
641    athing
642    bthing
643    ]thing
644    cthing
645    dthing
646    ething
647
648/^[^]cde]/
649    athing
650    fthing
651\= Expect no match
652    ]thing
653    cthing
654    dthing
655    ething
656
657/^\�/
658659
660/^�/
661662
663/^[0-9]+$/
664    0
665    1
666    2
667    3
668    4
669    5
670    6
671    7
672    8
673    9
674    10
675    100
676\= Expect no match
677    abc
678
679/^.*nter/
680    enter
681    inter
682    uponter
683
684/^xxx[0-9]+$/
685    xxx0
686    xxx1234
687\= Expect no match
688    xxx
689
690/^.+[0-9][0-9][0-9]$/
691    x123
692    xx123
693    123456
694    x1234
695\= Expect no match
696    123
697
698/^.+?[0-9][0-9][0-9]$/
699    x123
700    xx123
701    123456
702    x1234
703\= Expect no match
704    123
705
706/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
707    abc!pqr=apquxz.ixr.zzz.ac.uk
708\= Expect no match
709    !pqr=apquxz.ixr.zzz.ac.uk
710    abc!=apquxz.ixr.zzz.ac.uk
711    abc!pqr=apquxz:ixr.zzz.ac.uk
712    abc!pqr=apquxz.ixr.zzz.ac.ukk
713
714/:/
715    Well, we need a colon: somewhere
716\= Expect no match
717    No match without a colon
718
719/([\da-f:]+)$/i
720    0abc
721    abc
722    fed
723    E
724    ::
725    5f03:12C0::932e
726    fed def
727    Any old stuff
728\= Expect no match
729    0zzz
730    gzzz
731    fed\x20
732    Any old rubbish
733
734/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
735    .1.2.3
736    A.12.123.0
737\= Expect no match
738    .1.2.3333
739    1.2.3
740    1234.2.3
741
742/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
743    1 IN SOA non-sp1 non-sp2(
744    1    IN    SOA    non-sp1    non-sp2   (
745\= Expect no match
746    1IN SOA non-sp1 non-sp2(
747
748/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
749    a.
750    Z.
751    2.
752    ab-c.pq-r.
753    sxk.zzz.ac.uk.
754    x-.y-.
755\= Expect no match
756    -abc.peq.
757
758/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
759    *.a
760    *.b0-a
761    *.c3-b.c
762    *.c-a.b-c
763\= Expect no match
764    *.0
765    *.a-
766    *.a-b.c-
767    *.c-a.0-c
768
769/^(?=ab(de))(abd)(e)/
770    abde
771
772/^(?!(ab)de|x)(abd)(f)/
773    abdf
774
775/^(?=(ab(cd)))(ab)/
776    abcd
777
778/^[\da-f](\.[\da-f])*$/i
779    a.b.c.d
780    A.B.C.D
781    a.b.c.1.2.3.C
782
783/^\".*\"\s*(;.*)?$/
784    \"1234\"
785    \"abcd\" ;
786    \"\" ; rhubarb
787\= Expect no match
788    \"1234\" : things
789
790/^$/
791    \
792
793/   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/x
794    ab c
795\= Expect no match
796    abc
797    ab cde
798
799/(?x)   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/
800    ab c
801\= Expect no match
802    abc
803    ab cde
804
805/^   a\ b[c ]d       $/x
806    a bcd
807    a b d
808\= Expect no match
809    abcd
810    ab d
811
812/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
813    abcdefhijklm
814
815/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
816    abcdefhijklm
817
818/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
819    a+ Z0+\x08\n\x1d\x12
820
821/^[.^$|()*+?{,}]+/
822    .^\$(*+)|{?,?}
823
824/^a*\w/
825    z
826    az
827    aaaz
828    a
829    aa
830    aaaa
831    a+
832    aa+
833
834/^a*?\w/
835    z
836    az
837    aaaz
838    a
839    aa
840    aaaa
841    a+
842    aa+
843
844/^a+\w/
845    az
846    aaaz
847    aa
848    aaaa
849    aa+
850
851/^a+?\w/
852    az
853    aaaz
854    aa
855    aaaa
856    aa+
857
858/^\d{8}\w{2,}/
859    1234567890
860    12345678ab
861    12345678__
862\= Expect no match
863    1234567
864
865/^[aeiou\d]{4,5}$/
866    uoie
867    1234
868    12345
869    aaaaa
870\= Expect no match
871    123456
872
873/^[aeiou\d]{4,5}?/
874    uoie
875    1234
876    12345
877    aaaaa
878    123456
879
880/^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]/
881    From abcd  Mon Sep 01 12:33:02 1997
882
883/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
884    From abcd  Mon Sep 01 12:33:02 1997
885    From abcd  Mon Sep  1 12:33:02 1997
886\= Expect no match
887    From abcd  Sep 01 12:33:02 1997
888
889/^12.34/s
890    12\n34
891    12\r34
892
893/\w+(?=\t)/
894    the quick brown\t fox
895
896/foo(?!bar)(.*)/
897    foobar is foolish see?
898
899/(?:(?!foo)...|^.{0,2})bar(.*)/
900    foobar crowbar etc
901    barrel
902    2barrel
903    A barrel
904
905/^(\D*)(?=\d)(?!123)/
906    abc456
907\= Expect no match
908    abc123
909
910/^1234(?# test newlines
911  inside)/
912    1234
913
914/^1234 #comment in extended re
915  /x
916    1234
917
918/#rhubarb
919  abcd/x
920    abcd
921
922/^abcd#rhubarb/x
923    abcd
924
925/(?!^)abc/
926    the abc
927\= Expect no match
928    abc
929
930/(?=^)abc/
931    abc
932\= Expect no match
933    the abc
934
935/^[ab]{1,3}(ab*|b)/no_auto_possess
936    aabbbbb
937
938/^[ab]{1,3}?(ab*|b)/no_auto_possess
939    aabbbbb
940
941/^[ab]{1,3}?(ab*?|b)/no_auto_possess
942    aabbbbb
943
944/^[ab]{1,3}(ab*?|b)/no_auto_possess
945    aabbbbb
946
947/  (?: [\040\t] |  \(
948(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
949\)  )*                          # optional leading comment
950(?:    (?:
951[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
952(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
953|
954" (?:                      # opening quote...
955[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
956|                     #    or
957\\ [^\x80-\xff]           #   Escaped something (something != CR)
958)* "  # closing quote
959)                    # initial word
960(?:  (?: [\040\t] |  \(
961(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
962\)  )*  \.  (?: [\040\t] |  \(
963(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
964\)  )*   (?:
965[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
966(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
967|
968" (?:                      # opening quote...
969[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
970|                     #    or
971\\ [^\x80-\xff]           #   Escaped something (something != CR)
972)* "  # closing quote
973)  )* # further okay, if led by a period
974(?: [\040\t] |  \(
975(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
976\)  )*  @  (?: [\040\t] |  \(
977(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
978\)  )*    (?:
979[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
980(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
981|   \[                         # [
982(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
983\]                        #           ]
984)                           # initial subdomain
985(?:                                  #
986(?: [\040\t] |  \(
987(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
988\)  )*  \.                        # if led by a period...
989(?: [\040\t] |  \(
990(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
991\)  )*   (?:
992[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
993(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
994|   \[                         # [
995(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
996\]                        #           ]
997)                     #   ...further okay
998)*
999# address
1000|                     #  or
1001(?:
1002[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1003(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1004|
1005" (?:                      # opening quote...
1006[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1007|                     #    or
1008\\ [^\x80-\xff]           #   Escaped something (something != CR)
1009)* "  # closing quote
1010)             # one word, optionally followed by....
1011(?:
1012[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]  |  # atom and space parts, or...
1013\(
1014(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1015\)       |  # comments, or...
1016
1017" (?:                      # opening quote...
1018[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1019|                     #    or
1020\\ [^\x80-\xff]           #   Escaped something (something != CR)
1021)* "  # closing quote
1022# quoted strings
1023)*
1024<  (?: [\040\t] |  \(
1025(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1026\)  )*                     # leading <
1027(?:  @  (?: [\040\t] |  \(
1028(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1029\)  )*    (?:
1030[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1031(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1032|   \[                         # [
1033(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1034\]                        #           ]
1035)                           # initial subdomain
1036(?:                                  #
1037(?: [\040\t] |  \(
1038(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1039\)  )*  \.                        # if led by a period...
1040(?: [\040\t] |  \(
1041(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1042\)  )*   (?:
1043[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1044(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1045|   \[                         # [
1046(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1047\]                        #           ]
1048)                     #   ...further okay
1049)*
1050
1051(?:  (?: [\040\t] |  \(
1052(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1053\)  )*  ,  (?: [\040\t] |  \(
1054(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1055\)  )*  @  (?: [\040\t] |  \(
1056(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1057\)  )*    (?:
1058[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1059(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1060|   \[                         # [
1061(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1062\]                        #           ]
1063)                           # initial subdomain
1064(?:                                  #
1065(?: [\040\t] |  \(
1066(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1067\)  )*  \.                        # if led by a period...
1068(?: [\040\t] |  \(
1069(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1070\)  )*   (?:
1071[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1072(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1073|   \[                         # [
1074(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1075\]                        #           ]
1076)                     #   ...further okay
1077)*
1078)* # further okay, if led by comma
1079:                                # closing colon
1080(?: [\040\t] |  \(
1081(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1082\)  )*  )? #       optional route
1083(?:
1084[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1085(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1086|
1087" (?:                      # opening quote...
1088[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1089|                     #    or
1090\\ [^\x80-\xff]           #   Escaped something (something != CR)
1091)* "  # closing quote
1092)                    # initial word
1093(?:  (?: [\040\t] |  \(
1094(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1095\)  )*  \.  (?: [\040\t] |  \(
1096(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1097\)  )*   (?:
1098[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1099(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1100|
1101" (?:                      # opening quote...
1102[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
1103|                     #    or
1104\\ [^\x80-\xff]           #   Escaped something (something != CR)
1105)* "  # closing quote
1106)  )* # further okay, if led by a period
1107(?: [\040\t] |  \(
1108(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1109\)  )*  @  (?: [\040\t] |  \(
1110(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1111\)  )*    (?:
1112[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1113(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1114|   \[                         # [
1115(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1116\]                        #           ]
1117)                           # initial subdomain
1118(?:                                  #
1119(?: [\040\t] |  \(
1120(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1121\)  )*  \.                        # if led by a period...
1122(?: [\040\t] |  \(
1123(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1124\)  )*   (?:
1125[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1126(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1127|   \[                         # [
1128(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
1129\]                        #           ]
1130)                     #   ...further okay
1131)*
1132#       address spec
1133(?: [\040\t] |  \(
1134(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1135\)  )*  > #                  trailing >
1136# name and address
1137)  (?: [\040\t] |  \(
1138(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
1139\)  )*                       # optional trailing comment
1140/x
1141    Alan Other <user\@dom.ain>
1142    <user\@dom.ain>
1143    user\@dom.ain
1144    \"A. Other\" <user.1234\@dom.ain> (a comment)
1145    A. Other <user.1234\@dom.ain> (a comment)
1146    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
1147    A missing angle <user\@some.where
1148\= Expect no match
1149    The quick brown fox
1150
1151/[\040\t]*                    # Nab whitespace.
1152(?:
1153\(                              #  (
1154[^\\\x80-\xff\n\015()] *                             #     normal*
1155(?:                                 #       (
1156(?:  \\ [^\x80-\xff]  |
1157\(                            #  (
1158[^\\\x80-\xff\n\015()] *                            #     normal*
1159(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1160\)                           #                       )
1161)    #         special
1162[^\\\x80-\xff\n\015()] *                         #         normal*
1163)*                                  #            )*
1164\)                             #                )
1165[\040\t]* )*    # If comment found, allow more spaces.
1166# optional leading comment
1167(?:
1168(?:
1169[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1170(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1171# Atom
1172|                       #  or
1173"                                     # "
1174[^\\\x80-\xff\n\015"] *                            #   normal
1175(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1176"                                     #        "
1177# Quoted string
1178)
1179[\040\t]*                    # Nab whitespace.
1180(?:
1181\(                              #  (
1182[^\\\x80-\xff\n\015()] *                             #     normal*
1183(?:                                 #       (
1184(?:  \\ [^\x80-\xff]  |
1185\(                            #  (
1186[^\\\x80-\xff\n\015()] *                            #     normal*
1187(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1188\)                           #                       )
1189)    #         special
1190[^\\\x80-\xff\n\015()] *                         #         normal*
1191)*                                  #            )*
1192\)                             #                )
1193[\040\t]* )*    # If comment found, allow more spaces.
1194(?:
1195\.
1196[\040\t]*                    # Nab whitespace.
1197(?:
1198\(                              #  (
1199[^\\\x80-\xff\n\015()] *                             #     normal*
1200(?:                                 #       (
1201(?:  \\ [^\x80-\xff]  |
1202\(                            #  (
1203[^\\\x80-\xff\n\015()] *                            #     normal*
1204(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1205\)                           #                       )
1206)    #         special
1207[^\\\x80-\xff\n\015()] *                         #         normal*
1208)*                                  #            )*
1209\)                             #                )
1210[\040\t]* )*    # If comment found, allow more spaces.
1211(?:
1212[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1213(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1214# Atom
1215|                       #  or
1216"                                     # "
1217[^\\\x80-\xff\n\015"] *                            #   normal
1218(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1219"                                     #        "
1220# Quoted string
1221)
1222[\040\t]*                    # Nab whitespace.
1223(?:
1224\(                              #  (
1225[^\\\x80-\xff\n\015()] *                             #     normal*
1226(?:                                 #       (
1227(?:  \\ [^\x80-\xff]  |
1228\(                            #  (
1229[^\\\x80-\xff\n\015()] *                            #     normal*
1230(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1231\)                           #                       )
1232)    #         special
1233[^\\\x80-\xff\n\015()] *                         #         normal*
1234)*                                  #            )*
1235\)                             #                )
1236[\040\t]* )*    # If comment found, allow more spaces.
1237# additional words
1238)*
1239@
1240[\040\t]*                    # Nab whitespace.
1241(?:
1242\(                              #  (
1243[^\\\x80-\xff\n\015()] *                             #     normal*
1244(?:                                 #       (
1245(?:  \\ [^\x80-\xff]  |
1246\(                            #  (
1247[^\\\x80-\xff\n\015()] *                            #     normal*
1248(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1249\)                           #                       )
1250)    #         special
1251[^\\\x80-\xff\n\015()] *                         #         normal*
1252)*                                  #            )*
1253\)                             #                )
1254[\040\t]* )*    # If comment found, allow more spaces.
1255(?:
1256[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1257(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1258|
1259\[                            # [
1260(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1261\]                           #           ]
1262)
1263[\040\t]*                    # Nab whitespace.
1264(?:
1265\(                              #  (
1266[^\\\x80-\xff\n\015()] *                             #     normal*
1267(?:                                 #       (
1268(?:  \\ [^\x80-\xff]  |
1269\(                            #  (
1270[^\\\x80-\xff\n\015()] *                            #     normal*
1271(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1272\)                           #                       )
1273)    #         special
1274[^\\\x80-\xff\n\015()] *                         #         normal*
1275)*                                  #            )*
1276\)                             #                )
1277[\040\t]* )*    # If comment found, allow more spaces.
1278# optional trailing comments
1279(?:
1280\.
1281[\040\t]*                    # Nab whitespace.
1282(?:
1283\(                              #  (
1284[^\\\x80-\xff\n\015()] *                             #     normal*
1285(?:                                 #       (
1286(?:  \\ [^\x80-\xff]  |
1287\(                            #  (
1288[^\\\x80-\xff\n\015()] *                            #     normal*
1289(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1290\)                           #                       )
1291)    #         special
1292[^\\\x80-\xff\n\015()] *                         #         normal*
1293)*                                  #            )*
1294\)                             #                )
1295[\040\t]* )*    # If comment found, allow more spaces.
1296(?:
1297[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1298(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1299|
1300\[                            # [
1301(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1302\]                           #           ]
1303)
1304[\040\t]*                    # Nab whitespace.
1305(?:
1306\(                              #  (
1307[^\\\x80-\xff\n\015()] *                             #     normal*
1308(?:                                 #       (
1309(?:  \\ [^\x80-\xff]  |
1310\(                            #  (
1311[^\\\x80-\xff\n\015()] *                            #     normal*
1312(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1313\)                           #                       )
1314)    #         special
1315[^\\\x80-\xff\n\015()] *                         #         normal*
1316)*                                  #            )*
1317\)                             #                )
1318[\040\t]* )*    # If comment found, allow more spaces.
1319# optional trailing comments
1320)*
1321# address
1322|                             #  or
1323(?:
1324[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1325(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1326# Atom
1327|                       #  or
1328"                                     # "
1329[^\\\x80-\xff\n\015"] *                            #   normal
1330(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1331"                                     #        "
1332# Quoted string
1333)
1334# leading word
1335[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *               # "normal" atoms and or spaces
1336(?:
1337(?:
1338\(                              #  (
1339[^\\\x80-\xff\n\015()] *                             #     normal*
1340(?:                                 #       (
1341(?:  \\ [^\x80-\xff]  |
1342\(                            #  (
1343[^\\\x80-\xff\n\015()] *                            #     normal*
1344(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1345\)                           #                       )
1346)    #         special
1347[^\\\x80-\xff\n\015()] *                         #         normal*
1348)*                                  #            )*
1349\)                             #                )
1350|
1351"                                     # "
1352[^\\\x80-\xff\n\015"] *                            #   normal
1353(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1354"                                     #        "
1355) # "special" comment or quoted string
1356[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *            #  more "normal"
1357)*
1358<
1359[\040\t]*                    # Nab whitespace.
1360(?:
1361\(                              #  (
1362[^\\\x80-\xff\n\015()] *                             #     normal*
1363(?:                                 #       (
1364(?:  \\ [^\x80-\xff]  |
1365\(                            #  (
1366[^\\\x80-\xff\n\015()] *                            #     normal*
1367(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1368\)                           #                       )
1369)    #         special
1370[^\\\x80-\xff\n\015()] *                         #         normal*
1371)*                                  #            )*
1372\)                             #                )
1373[\040\t]* )*    # If comment found, allow more spaces.
1374# <
1375(?:
1376@
1377[\040\t]*                    # Nab whitespace.
1378(?:
1379\(                              #  (
1380[^\\\x80-\xff\n\015()] *                             #     normal*
1381(?:                                 #       (
1382(?:  \\ [^\x80-\xff]  |
1383\(                            #  (
1384[^\\\x80-\xff\n\015()] *                            #     normal*
1385(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1386\)                           #                       )
1387)    #         special
1388[^\\\x80-\xff\n\015()] *                         #         normal*
1389)*                                  #            )*
1390\)                             #                )
1391[\040\t]* )*    # If comment found, allow more spaces.
1392(?:
1393[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1394(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1395|
1396\[                            # [
1397(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1398\]                           #           ]
1399)
1400[\040\t]*                    # Nab whitespace.
1401(?:
1402\(                              #  (
1403[^\\\x80-\xff\n\015()] *                             #     normal*
1404(?:                                 #       (
1405(?:  \\ [^\x80-\xff]  |
1406\(                            #  (
1407[^\\\x80-\xff\n\015()] *                            #     normal*
1408(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1409\)                           #                       )
1410)    #         special
1411[^\\\x80-\xff\n\015()] *                         #         normal*
1412)*                                  #            )*
1413\)                             #                )
1414[\040\t]* )*    # If comment found, allow more spaces.
1415# optional trailing comments
1416(?:
1417\.
1418[\040\t]*                    # Nab whitespace.
1419(?:
1420\(                              #  (
1421[^\\\x80-\xff\n\015()] *                             #     normal*
1422(?:                                 #       (
1423(?:  \\ [^\x80-\xff]  |
1424\(                            #  (
1425[^\\\x80-\xff\n\015()] *                            #     normal*
1426(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1427\)                           #                       )
1428)    #         special
1429[^\\\x80-\xff\n\015()] *                         #         normal*
1430)*                                  #            )*
1431\)                             #                )
1432[\040\t]* )*    # If comment found, allow more spaces.
1433(?:
1434[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1435(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1436|
1437\[                            # [
1438(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1439\]                           #           ]
1440)
1441[\040\t]*                    # Nab whitespace.
1442(?:
1443\(                              #  (
1444[^\\\x80-\xff\n\015()] *                             #     normal*
1445(?:                                 #       (
1446(?:  \\ [^\x80-\xff]  |
1447\(                            #  (
1448[^\\\x80-\xff\n\015()] *                            #     normal*
1449(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1450\)                           #                       )
1451)    #         special
1452[^\\\x80-\xff\n\015()] *                         #         normal*
1453)*                                  #            )*
1454\)                             #                )
1455[\040\t]* )*    # If comment found, allow more spaces.
1456# optional trailing comments
1457)*
1458(?: ,
1459[\040\t]*                    # Nab whitespace.
1460(?:
1461\(                              #  (
1462[^\\\x80-\xff\n\015()] *                             #     normal*
1463(?:                                 #       (
1464(?:  \\ [^\x80-\xff]  |
1465\(                            #  (
1466[^\\\x80-\xff\n\015()] *                            #     normal*
1467(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1468\)                           #                       )
1469)    #         special
1470[^\\\x80-\xff\n\015()] *                         #         normal*
1471)*                                  #            )*
1472\)                             #                )
1473[\040\t]* )*    # If comment found, allow more spaces.
1474@
1475[\040\t]*                    # Nab whitespace.
1476(?:
1477\(                              #  (
1478[^\\\x80-\xff\n\015()] *                             #     normal*
1479(?:                                 #       (
1480(?:  \\ [^\x80-\xff]  |
1481\(                            #  (
1482[^\\\x80-\xff\n\015()] *                            #     normal*
1483(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1484\)                           #                       )
1485)    #         special
1486[^\\\x80-\xff\n\015()] *                         #         normal*
1487)*                                  #            )*
1488\)                             #                )
1489[\040\t]* )*    # If comment found, allow more spaces.
1490(?:
1491[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1492(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1493|
1494\[                            # [
1495(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1496\]                           #           ]
1497)
1498[\040\t]*                    # Nab whitespace.
1499(?:
1500\(                              #  (
1501[^\\\x80-\xff\n\015()] *                             #     normal*
1502(?:                                 #       (
1503(?:  \\ [^\x80-\xff]  |
1504\(                            #  (
1505[^\\\x80-\xff\n\015()] *                            #     normal*
1506(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1507\)                           #                       )
1508)    #         special
1509[^\\\x80-\xff\n\015()] *                         #         normal*
1510)*                                  #            )*
1511\)                             #                )
1512[\040\t]* )*    # If comment found, allow more spaces.
1513# optional trailing comments
1514(?:
1515\.
1516[\040\t]*                    # Nab whitespace.
1517(?:
1518\(                              #  (
1519[^\\\x80-\xff\n\015()] *                             #     normal*
1520(?:                                 #       (
1521(?:  \\ [^\x80-\xff]  |
1522\(                            #  (
1523[^\\\x80-\xff\n\015()] *                            #     normal*
1524(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1525\)                           #                       )
1526)    #         special
1527[^\\\x80-\xff\n\015()] *                         #         normal*
1528)*                                  #            )*
1529\)                             #                )
1530[\040\t]* )*    # If comment found, allow more spaces.
1531(?:
1532[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1533(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1534|
1535\[                            # [
1536(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1537\]                           #           ]
1538)
1539[\040\t]*                    # Nab whitespace.
1540(?:
1541\(                              #  (
1542[^\\\x80-\xff\n\015()] *                             #     normal*
1543(?:                                 #       (
1544(?:  \\ [^\x80-\xff]  |
1545\(                            #  (
1546[^\\\x80-\xff\n\015()] *                            #     normal*
1547(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1548\)                           #                       )
1549)    #         special
1550[^\\\x80-\xff\n\015()] *                         #         normal*
1551)*                                  #            )*
1552\)                             #                )
1553[\040\t]* )*    # If comment found, allow more spaces.
1554# optional trailing comments
1555)*
1556)*  # additional domains
1557:
1558[\040\t]*                    # Nab whitespace.
1559(?:
1560\(                              #  (
1561[^\\\x80-\xff\n\015()] *                             #     normal*
1562(?:                                 #       (
1563(?:  \\ [^\x80-\xff]  |
1564\(                            #  (
1565[^\\\x80-\xff\n\015()] *                            #     normal*
1566(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1567\)                           #                       )
1568)    #         special
1569[^\\\x80-\xff\n\015()] *                         #         normal*
1570)*                                  #            )*
1571\)                             #                )
1572[\040\t]* )*    # If comment found, allow more spaces.
1573# optional trailing comments
1574)?     #       optional route
1575(?:
1576[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1577(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1578# Atom
1579|                       #  or
1580"                                     # "
1581[^\\\x80-\xff\n\015"] *                            #   normal
1582(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1583"                                     #        "
1584# Quoted string
1585)
1586[\040\t]*                    # Nab whitespace.
1587(?:
1588\(                              #  (
1589[^\\\x80-\xff\n\015()] *                             #     normal*
1590(?:                                 #       (
1591(?:  \\ [^\x80-\xff]  |
1592\(                            #  (
1593[^\\\x80-\xff\n\015()] *                            #     normal*
1594(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1595\)                           #                       )
1596)    #         special
1597[^\\\x80-\xff\n\015()] *                         #         normal*
1598)*                                  #            )*
1599\)                             #                )
1600[\040\t]* )*    # If comment found, allow more spaces.
1601(?:
1602\.
1603[\040\t]*                    # Nab whitespace.
1604(?:
1605\(                              #  (
1606[^\\\x80-\xff\n\015()] *                             #     normal*
1607(?:                                 #       (
1608(?:  \\ [^\x80-\xff]  |
1609\(                            #  (
1610[^\\\x80-\xff\n\015()] *                            #     normal*
1611(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1612\)                           #                       )
1613)    #         special
1614[^\\\x80-\xff\n\015()] *                         #         normal*
1615)*                                  #            )*
1616\)                             #                )
1617[\040\t]* )*    # If comment found, allow more spaces.
1618(?:
1619[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1620(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1621# Atom
1622|                       #  or
1623"                                     # "
1624[^\\\x80-\xff\n\015"] *                            #   normal
1625(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1626"                                     #        "
1627# Quoted string
1628)
1629[\040\t]*                    # Nab whitespace.
1630(?:
1631\(                              #  (
1632[^\\\x80-\xff\n\015()] *                             #     normal*
1633(?:                                 #       (
1634(?:  \\ [^\x80-\xff]  |
1635\(                            #  (
1636[^\\\x80-\xff\n\015()] *                            #     normal*
1637(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1638\)                           #                       )
1639)    #         special
1640[^\\\x80-\xff\n\015()] *                         #         normal*
1641)*                                  #            )*
1642\)                             #                )
1643[\040\t]* )*    # If comment found, allow more spaces.
1644# additional words
1645)*
1646@
1647[\040\t]*                    # Nab whitespace.
1648(?:
1649\(                              #  (
1650[^\\\x80-\xff\n\015()] *                             #     normal*
1651(?:                                 #       (
1652(?:  \\ [^\x80-\xff]  |
1653\(                            #  (
1654[^\\\x80-\xff\n\015()] *                            #     normal*
1655(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1656\)                           #                       )
1657)    #         special
1658[^\\\x80-\xff\n\015()] *                         #         normal*
1659)*                                  #            )*
1660\)                             #                )
1661[\040\t]* )*    # If comment found, allow more spaces.
1662(?:
1663[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1664(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1665|
1666\[                            # [
1667(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1668\]                           #           ]
1669)
1670[\040\t]*                    # Nab whitespace.
1671(?:
1672\(                              #  (
1673[^\\\x80-\xff\n\015()] *                             #     normal*
1674(?:                                 #       (
1675(?:  \\ [^\x80-\xff]  |
1676\(                            #  (
1677[^\\\x80-\xff\n\015()] *                            #     normal*
1678(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1679\)                           #                       )
1680)    #         special
1681[^\\\x80-\xff\n\015()] *                         #         normal*
1682)*                                  #            )*
1683\)                             #                )
1684[\040\t]* )*    # If comment found, allow more spaces.
1685# optional trailing comments
1686(?:
1687\.
1688[\040\t]*                    # Nab whitespace.
1689(?:
1690\(                              #  (
1691[^\\\x80-\xff\n\015()] *                             #     normal*
1692(?:                                 #       (
1693(?:  \\ [^\x80-\xff]  |
1694\(                            #  (
1695[^\\\x80-\xff\n\015()] *                            #     normal*
1696(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1697\)                           #                       )
1698)    #         special
1699[^\\\x80-\xff\n\015()] *                         #         normal*
1700)*                                  #            )*
1701\)                             #                )
1702[\040\t]* )*    # If comment found, allow more spaces.
1703(?:
1704[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1705(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1706|
1707\[                            # [
1708(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1709\]                           #           ]
1710)
1711[\040\t]*                    # Nab whitespace.
1712(?:
1713\(                              #  (
1714[^\\\x80-\xff\n\015()] *                             #     normal*
1715(?:                                 #       (
1716(?:  \\ [^\x80-\xff]  |
1717\(                            #  (
1718[^\\\x80-\xff\n\015()] *                            #     normal*
1719(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1720\)                           #                       )
1721)    #         special
1722[^\\\x80-\xff\n\015()] *                         #         normal*
1723)*                                  #            )*
1724\)                             #                )
1725[\040\t]* )*    # If comment found, allow more spaces.
1726# optional trailing comments
1727)*
1728#       address spec
1729>                    #                 >
1730# name and address
1731)
1732/x
1733    Alan Other <user\@dom.ain>
1734    <user\@dom.ain>
1735    user\@dom.ain
1736    \"A. Other\" <user.1234\@dom.ain> (a comment)
1737    A. Other <user.1234\@dom.ain> (a comment)
1738    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
1739    A missing angle <user\@some.where
1740\= Expect no match
1741    The quick brown fox
1742
1743/abc\0def\00pqr\000xyz\0000AB/
1744    abc\0def\00pqr\000xyz\0000AB
1745    abc456 abc\0def\00pqr\000xyz\0000ABCDE
1746
1747/abc\x0def\x00pqr\x000xyz\x0000AB/
1748    abc\x0def\x00pqr\x000xyz\x0000AB
1749    abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
1750
1751/^[\000-\037]/
1752    \0A
1753    \01B
1754    \037C
1755
1756/\0*/
1757    \0\0\0\0
1758
1759/A\x0{2,3}Z/
1760    The A\x0\x0Z
1761    An A\0\x0\0Z
1762\= Expect no match
1763    A\0Z
1764    A\0\x0\0\x0Z
1765
1766/^\s/
1767    \040abc
1768    \x0cabc
1769    \nabc
1770    \rabc
1771    \tabc
1772\= Expect no match
1773    abc
1774
1775/^a	b
1776      c/x
1777    abc
1778
1779/ab{1,3}bc/
1780    abbbbc
1781    abbbc
1782    abbc
1783\= Expect no match
1784    abc
1785    abbbbbc
1786
1787/([^.]*)\.([^:]*):[T ]+(.*)/
1788    track1.title:TBlah blah blah
1789
1790/([^.]*)\.([^:]*):[T ]+(.*)/i
1791    track1.title:TBlah blah blah
1792
1793/([^.]*)\.([^:]*):[t ]+(.*)/i
1794    track1.title:TBlah blah blah
1795
1796/^[W-c]+$/
1797    WXY_^abc
1798\= Expect no match
1799    wxy
1800
1801/^[W-c]+$/i
1802    WXY_^abc
1803    wxy_^ABC
1804
1805/^[\x3f-\x5F]+$/i
1806    WXY_^abc
1807    wxy_^ABC
1808
1809/^abc$/m
1810    abc
1811    qqq\nabc
1812    abc\nzzz
1813    qqq\nabc\nzzz
1814
1815/^abc$/
1816    abc
1817\= Expect no match
1818    qqq\nabc
1819    abc\nzzz
1820    qqq\nabc\nzzz
1821
1822/\Aabc\Z/m
1823    abc
1824    abc\n
1825\= Expect no match
1826    qqq\nabc
1827    abc\nzzz
1828    qqq\nabc\nzzz
1829
1830/\A(.)*\Z/s
1831    abc\ndef
1832
1833/\A(.)*\Z/m
1834\= Expect no match
1835    abc\ndef
1836
1837/(?:b)|(?::+)/
1838    b::c
1839    c::b
1840
1841/[-az]+/
1842    az-
1843\= Expect no match
1844    b
1845
1846/[az-]+/
1847    za-
1848\= Expect no match
1849    b
1850
1851/[a\-z]+/
1852    a-z
1853\= Expect no match
1854    b
1855
1856/[a-z]+/
1857    abcdxyz
1858
1859/[\d-]+/
1860    12-34
1861\= Expect no match
1862    aaa
1863
1864/[\d-z]+/
1865    12-34z
1866\= Expect no match
1867    aaa
1868
1869/\x5c/
1870    \\
1871
1872/\x20Z/
1873    the Zoo
1874\= Expect no match
1875    Zulu
1876
1877/ab{3cd/
1878    ab{3cd
1879
1880/ab{3,cd/
1881    ab{3,cd
1882
1883/ab{3,4a}cd/
1884    ab{3,4a}cd
1885
1886/{4,5a}bc/
1887    {4,5a}bc
1888
1889/^a.b/newline=lf
1890    a\rb
1891\= Expect no match
1892    a\nb
1893
1894/abc$/
1895    abc
1896    abc\n
1897\= Expect no match
1898    abc\ndef
1899
1900/(abc)\123/
1901    abc\x53
1902
1903/(abc)\223/
1904    abc\x93
1905
1906/(abc)\323/
1907    abc\xd3
1908
1909/(abc)\100/
1910    abc\x40
1911    abc\100
1912
1913/(abc)\1000/
1914    abc\x400
1915    abc\x40\x30
1916    abc\1000
1917    abc\100\x30
1918    abc\100\060
1919    abc\100\60
1920
1921/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
1922    abcdefghijk\12S
1923
1924/a{0}bc/
1925    bc
1926
1927/(a|(bc)){0,0}?xyz/
1928    xyz
1929
1930/abc[\10]de/
1931    abc\010de
1932
1933/abc[\1]de/
1934    abc\1de
1935
1936/(abc)[\1]de/
1937    abc\1de
1938
1939/(?s)a.b/
1940    a\nb
1941
1942/^([^a])([^\b])([^c]*)([^d]{3,4})/
1943    baNOTccccd
1944    baNOTcccd
1945    baNOTccd
1946    bacccd
1947\= Expect no match
1948    anything
1949    b\bc
1950    baccd
1951
1952/[^a]/
1953    Abc
1954
1955/[^a]/i
1956    Abc
1957
1958/[^a]+/
1959    AAAaAbc
1960
1961/[^a]+/i
1962    AAAaAbc
1963
1964/[^a]+/
1965    bbb\nccc
1966
1967/[^k]$/
1968    abc
1969\= Expect no match
1970    abk
1971
1972/[^k]{2,3}$/
1973    abc
1974    kbc
1975    kabc
1976\= Expect no match
1977    abk
1978    akb
1979    akk
1980
1981/^\d{8,}\@.+[^k]$/
1982    12345678\@a.b.c.d
1983    123456789\@x.y.z
1984\= Expect no match
1985    12345678\@x.y.uk
1986    1234567\@a.b.c.d
1987
1988/[^a]/
1989    aaaabcd
1990    aaAabcd
1991
1992/[^a]/i
1993    aaaabcd
1994    aaAabcd
1995
1996/[^az]/
1997    aaaabcd
1998    aaAabcd
1999
2000/[^az]/i
2001    aaaabcd
2002    aaAabcd
2003
2004/\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/
2005 \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
2006
2007/P[^*]TAIRE[^*]{1,6}?LL/
2008    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2009
2010/P[^*]TAIRE[^*]{1,}?LL/
2011    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2012
2013/(\.\d\d[1-9]?)\d+/
2014    1.230003938
2015    1.875000282
2016    1.235
2017
2018/(\.\d\d((?=0)|\d(?=\d)))/
2019    1.230003938
2020    1.875000282
2021\= Expect no match
2022    1.235
2023
2024/a(?)b/
2025    ab
2026
2027/\b(foo)\s+(\w+)/i
2028    Food is on the foo table
2029
2030/foo(.*)bar/
2031    The food is under the bar in the barn.
2032
2033/foo(.*?)bar/
2034    The food is under the bar in the barn.
2035
2036/(.*)(\d*)/no_auto_possess
2037    I have 2 numbers: 53147
2038
2039/(.*)(\d+)/
2040    I have 2 numbers: 53147
2041
2042/(.*?)(\d*)/no_auto_possess
2043    I have 2 numbers: 53147
2044
2045/(.*?)(\d+)/
2046    I have 2 numbers: 53147
2047
2048/(.*)(\d+)$/
2049    I have 2 numbers: 53147
2050
2051/(.*?)(\d+)$/
2052    I have 2 numbers: 53147
2053
2054/(.*)\b(\d+)$/
2055    I have 2 numbers: 53147
2056
2057/(.*\D)(\d+)$/
2058    I have 2 numbers: 53147
2059
2060/^\D*(?!123)/
2061    ABC123
2062
2063/^(\D*)(?=\d)(?!123)/
2064    ABC445
2065\= Expect no match
2066    ABC123
2067
2068/^[W-]46]/
2069    W46]789
2070    -46]789
2071\= Expect no match
2072    Wall
2073    Zebra
2074    42
2075    [abcd]
2076    ]abcd[
2077
2078/^[W-\]46]/
2079    W46]789
2080    Wall
2081    Zebra
2082    Xylophone
2083    42
2084    [abcd]
2085    ]abcd[
2086    \\backslash
2087\= Expect no match
2088    -46]789
2089    well
2090
2091/\d\d\/\d\d\/\d\d\d\d/
2092    01/01/2000
2093
2094/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
2095  word cat dog elephant mussel cow horse canary baboon snake shark otherword
2096\= Expect no match
2097  word cat dog elephant mussel cow horse canary baboon snake shark
2098
2099/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
2100\= Expect no match
2101  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
2102
2103/^(a){0,0}/
2104    bcd
2105    abc
2106    aab
2107
2108/^(a){0,1}/
2109    bcd
2110    abc
2111    aab
2112
2113/^(a){0,2}/
2114    bcd
2115    abc
2116    aab
2117
2118/^(a){0,3}/
2119    bcd
2120    abc
2121    aab
2122    aaa
2123
2124/^(a){0,}/
2125    bcd
2126    abc
2127    aab
2128    aaa
2129    aaaaaaaa
2130
2131/^(a){1,1}/
2132    abc
2133    aab
2134\= Expect no match
2135    bcd
2136
2137/^(a){1,2}/
2138    abc
2139    aab
2140\= Expect no match
2141    bcd
2142
2143/^(a){1,3}/
2144    abc
2145    aab
2146    aaa
2147\= Expect no match
2148    bcd
2149
2150/^(a){1,}/
2151    abc
2152    aab
2153    aaa
2154    aaaaaaaa
2155\= Expect no match
2156    bcd
2157
2158/.*\.gif/
2159    borfle\nbib.gif\nno
2160
2161/.{0,}\.gif/
2162    borfle\nbib.gif\nno
2163
2164/.*\.gif/m
2165    borfle\nbib.gif\nno
2166
2167/.*\.gif/s
2168    borfle\nbib.gif\nno
2169
2170/.*\.gif/ms
2171    borfle\nbib.gif\nno
2172
2173/.*$/
2174    borfle\nbib.gif\nno
2175
2176/.*$/m
2177    borfle\nbib.gif\nno
2178
2179/.*$/s
2180    borfle\nbib.gif\nno
2181
2182/.*$/ms
2183    borfle\nbib.gif\nno
2184
2185/.*$/
2186    borfle\nbib.gif\nno\n
2187
2188/.*$/m
2189    borfle\nbib.gif\nno\n
2190
2191/.*$/s
2192    borfle\nbib.gif\nno\n
2193
2194/.*$/ms
2195    borfle\nbib.gif\nno\n
2196
2197/(.*X|^B)/
2198    abcde\n1234Xyz
2199    BarFoo
2200\= Expect no match
2201    abcde\nBar
2202
2203/(.*X|^B)/m
2204    abcde\n1234Xyz
2205    BarFoo
2206    abcde\nBar
2207
2208/(.*X|^B)/s
2209    abcde\n1234Xyz
2210    BarFoo
2211\= Expect no match
2212    abcde\nBar
2213
2214/(.*X|^B)/ms
2215    abcde\n1234Xyz
2216    BarFoo
2217    abcde\nBar
2218
2219/(?s)(.*X|^B)/
2220    abcde\n1234Xyz
2221    BarFoo
2222\= Expect no match
2223    abcde\nBar
2224
2225/(?s:.*X|^B)/
2226    abcde\n1234Xyz
2227    BarFoo
2228\= Expect no match
2229    abcde\nBar
2230
2231/^.*B/
2232\= Expect no match
2233    abc\nB
2234
2235/(?s)^.*B/
2236    abc\nB
2237
2238/(?m)^.*B/
2239    abc\nB
2240
2241/(?ms)^.*B/
2242    abc\nB
2243
2244/(?ms)^B/
2245    abc\nB
2246
2247/(?s)B$/
2248    B\n
2249
2250/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
2251    123456654321
2252
2253/^\d\d\d\d\d\d\d\d\d\d\d\d/
2254    123456654321
2255
2256/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
2257    123456654321
2258
2259/^[abc]{12}/
2260    abcabcabcabc
2261
2262/^[a-c]{12}/
2263    abcabcabcabc
2264
2265/^(a|b|c){12}/
2266    abcabcabcabc
2267
2268/^[abcdefghijklmnopqrstuvwxy0123456789]/
2269    n
2270\= Expect no match
2271    z
2272
2273/abcde{0,0}/
2274    abcd
2275\= Expect no match
2276    abce
2277
2278/ab[cd]{0,0}e/
2279    abe
2280\= Expect no match
2281    abcde
2282
2283/ab(c){0,0}d/
2284    abd
2285\= Expect no match
2286    abcd
2287
2288/a(b*)/
2289    a
2290    ab
2291    abbbb
2292\= Expect no match
2293    bbbbb
2294
2295/ab\d{0}e/
2296    abe
2297\= Expect no match
2298    ab1e
2299
2300/"([^\\"]+|\\.)*"/
2301    the \"quick\" brown fox
2302    \"the \\\"quick\\\" brown fox\"
2303
2304/.*?/g,aftertext
2305    abc
2306
2307/\b/g,aftertext
2308    abc
2309
2310/\b/g,aftertext
2311    abc
2312
2313//g
2314    abc
2315
2316/<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
2317  <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>
2318
2319/a[^a]b/
2320    acb
2321    a\nb
2322
2323/a.b/
2324    acb
2325\= Expect no match
2326    a\nb
2327
2328/a[^a]b/s
2329    acb
2330    a\nb
2331
2332/a.b/s
2333    acb
2334    a\nb
2335
2336/^(b+?|a){1,2}?c/
2337    bac
2338    bbac
2339    bbbac
2340    bbbbac
2341    bbbbbac
2342
2343/^(b+|a){1,2}?c/
2344    bac
2345    bbac
2346    bbbac
2347    bbbbac
2348    bbbbbac
2349
2350/(?!\A)x/m
2351    a\bx\n
2352\= Expect no match
2353    x\nb\n
2354
2355/\x0{ab}/
2356    \0{ab}
2357
2358/(A|B)*?CD/
2359    CD
2360
2361/(A|B)*CD/
2362    CD
2363
2364/(?<!bar)foo/
2365    foo
2366    catfood
2367    arfootle
2368    rfoosh
2369\= Expect no match
2370    barfoo
2371    towbarfoo
2372
2373/\w{3}(?<!bar)foo/
2374    catfood
2375\= Expect no match
2376    foo
2377    barfoo
2378    towbarfoo
2379
2380/(?<=(foo)a)bar/
2381    fooabar
2382\= Expect no match
2383    bar
2384    foobbar
2385
2386/\Aabc\z/m
2387    abc
2388\= Expect no match
2389    abc\n
2390    qqq\nabc
2391    abc\nzzz
2392    qqq\nabc\nzzz
2393
2394"(?>.*/)foo"
2395\= Expect no match
2396    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
2397
2398"(?>.*/)foo"
2399    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
2400
2401/(?>(\.\d\d[1-9]?))\d+/
2402    1.230003938
2403    1.875000282
2404\= Expect no match
2405    1.235
2406
2407/^((?>\w+)|(?>\s+))*$/
2408    now is the time for all good men to come to the aid of the party
2409\= Expect no match
2410    this is not a line with only words and spaces!
2411
2412/(\d+)(\w)/
2413    12345a
2414    12345+
2415
2416/((?>\d+))(\w)/
2417    12345a
2418\= Expect no match
2419    12345+
2420
2421/(?>a+)b/
2422    aaab
2423
2424/((?>a+)b)/
2425    aaab
2426
2427/(?>(a+))b/
2428    aaab
2429
2430/(?>b)+/
2431    aaabbbccc
2432
2433/(?>a+|b+|c+)*c/
2434    aaabbbbccccd
2435
2436/(a+|b+|c+)*c/
2437    aaabbbbccccd
2438
2439/((?>[^()]+)|\([^()]*\))+/
2440    ((abc(ade)ufh()()x
2441
2442/\(((?>[^()]+)|\([^()]+\))+\)/
2443    (abc)
2444    (abc(def)xyz)
2445\= Expect no match
2446    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
2447
2448/a(?-i)b/i
2449    ab
2450    Ab
2451\= Expect no match
2452    aB
2453    AB
2454
2455/(a (?x)b c)d e/
2456    a bcd e
2457\= Expect no match
2458    a b cd e
2459    abcd e
2460    a bcde
2461
2462/(a b(?x)c d (?-x)e f)/
2463    a bcde f
2464\= Expect no match
2465    abcdef
2466
2467/(a(?i)b)c/
2468    abc
2469    aBc
2470\= Expect no match
2471    abC
2472    aBC
2473    Abc
2474    ABc
2475    ABC
2476    AbC
2477
2478/a(?i:b)c/
2479    abc
2480    aBc
2481\= Expect no match
2482    ABC
2483    abC
2484    aBC
2485
2486/a(?i:b)*c/
2487    aBc
2488    aBBc
2489\= Expect no match
2490    aBC
2491    aBBC
2492
2493/a(?=b(?i)c)\w\wd/
2494    abcd
2495    abCd
2496\= Expect no match
2497    aBCd
2498    abcD
2499
2500/(?s-i:more.*than).*million/i
2501    more than million
2502    more than MILLION
2503    more \n than Million
2504\= Expect no match
2505    MORE THAN MILLION
2506    more \n than \n million
2507
2508/(?:(?s-i)more.*than).*million/i
2509    more than million
2510    more than MILLION
2511    more \n than Million
2512\= Expect no match
2513    MORE THAN MILLION
2514    more \n than \n million
2515
2516/(?>a(?i)b+)+c/
2517    abc
2518    aBbc
2519    aBBc
2520\= Expect no match
2521    Abc
2522    abAb
2523    abbC
2524
2525/(?=a(?i)b)\w\wc/
2526    abc
2527    aBc
2528\= Expect no match
2529    Ab
2530    abC
2531    aBC
2532
2533/(?<=a(?i)b)(\w\w)c/
2534    abxxc
2535    aBxxc
2536\= Expect no match
2537    Abxxc
2538    ABxxc
2539    abxxC
2540
2541/^(?(?=abc)\w{3}:|\d\d)$/
2542    abc:
2543    12
2544\= Expect no match
2545    123
2546    xyz
2547
2548/^(?(?!abc)\d\d|\w{3}:)$/
2549    abc:
2550    12
2551\= Expect no match
2552    123
2553    xyz
2554
2555/(?(?<=foo)bar|cat)/
2556    foobar
2557    cat
2558    fcat
2559    focat
2560\= Expect no match
2561    foocat
2562
2563/(?(?<!foo)cat|bar)/
2564    foobar
2565    cat
2566    fcat
2567    focat
2568\= Expect no match
2569    foocat
2570
2571/(?>a*)*/
2572    a
2573    aa
2574    aaaa
2575
2576/(abc|)+/
2577    abc
2578    abcabc
2579    abcabcabc
2580    xyz
2581
2582/([a]*)*/
2583    a
2584    aaaaa
2585
2586/([ab]*)*/
2587    a
2588    b
2589    ababab
2590    aaaabcde
2591    bbbb
2592
2593/([^a]*)*/
2594    b
2595    bbbb
2596    aaa
2597
2598/([^ab]*)*/
2599    cccc
2600    abab
2601
2602/([a]*?)*/
2603    a
2604    aaaa
2605
2606/([ab]*?)*/
2607    a
2608    b
2609    abab
2610    baba
2611
2612/([^a]*?)*/
2613    b
2614    bbbb
2615    aaa
2616
2617/([^ab]*?)*/
2618    c
2619    cccc
2620    baba
2621
2622/(?>a*)*/
2623    a
2624    aaabcde
2625
2626/((?>a*))*/
2627    aaaaa
2628    aabbaa
2629
2630/((?>a*?))*/
2631    aaaaa
2632    aabbaa
2633
2634/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
2635    12-sep-98
2636    12-09-98
2637\= Expect no match
2638    sep-12-98
2639
2640/(?i:saturday|sunday)/
2641    saturday
2642    sunday
2643    Saturday
2644    Sunday
2645    SATURDAY
2646    SUNDAY
2647    SunDay
2648
2649/(a(?i)bc|BB)x/
2650    abcx
2651    aBCx
2652    bbx
2653    BBx
2654\= Expect no match
2655    abcX
2656    aBCX
2657    bbX
2658    BBX
2659
2660/^([ab](?i)[cd]|[ef])/
2661    ac
2662    aC
2663    bD
2664    elephant
2665    Europe
2666    frog
2667    France
2668\= Expect no match
2669    Africa
2670
2671/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
2672    ab
2673    aBd
2674    xy
2675    xY
2676    zebra
2677    Zambesi
2678\= Expect no match
2679    aCD
2680    XY
2681
2682/(?<=foo\n)^bar/m
2683    foo\nbar
2684\= Expect no match
2685    bar
2686    baz\nbar
2687
2688/(?<=(?<!foo)bar)baz/
2689    barbaz
2690    barbarbaz
2691    koobarbaz
2692\= Expect no match
2693    baz
2694    foobarbaz
2695
2696# The following tests are taken from the Perl 5.005 test suite; some of them
2697# are compatible with 5.004, but I'd rather not have to sort them out.
2698
2699/abc/
2700    abc
2701    xabcy
2702    ababc
2703\= Expect no match
2704    xbc
2705    axc
2706    abx
2707
2708/ab*c/
2709    abc
2710
2711/ab*bc/
2712    abc
2713    abbc
2714    abbbbc
2715
2716/.{1}/
2717    abbbbc
2718
2719/.{3,4}/
2720    abbbbc
2721
2722/ab{0,}bc/
2723    abbbbc
2724
2725/ab+bc/
2726    abbc
2727\= Expect no match
2728    abc
2729    abq
2730
2731/ab+bc/
2732    abbbbc
2733
2734/ab{1,}bc/
2735    abbbbc
2736
2737/ab{1,3}bc/
2738    abbbbc
2739
2740/ab{3,4}bc/
2741    abbbbc
2742
2743/ab{4,5}bc/
2744\= Expect no match
2745    abq
2746    abbbbc
2747
2748/ab?bc/
2749    abbc
2750    abc
2751
2752/ab{0,1}bc/
2753    abc
2754
2755/ab?bc/
2756
2757/ab?c/
2758    abc
2759
2760/ab{0,1}c/
2761    abc
2762
2763/^abc$/
2764    abc
2765\= Expect no match
2766    abbbbc
2767    abcc
2768
2769/^abc/
2770    abcc
2771
2772/^abc$/
2773
2774/abc$/
2775    aabc
2776    aabc
2777\= Expect no match
2778    aabcd
2779
2780/^/
2781    abc
2782
2783/$/
2784    abc
2785
2786/a.c/
2787    abc
2788    axc
2789
2790/a.*c/
2791    axyzc
2792
2793/a[bc]d/
2794    abd
2795\= Expect no match
2796    axyzd
2797    abc
2798
2799/a[b-d]e/
2800    ace
2801
2802/a[b-d]/
2803    aac
2804
2805/a[-b]/
2806    a-
2807
2808/a[b-]/
2809    a-
2810
2811/a]/
2812    a]
2813
2814/a[]]b/
2815    a]b
2816
2817/a[^bc]d/
2818    aed
2819\= Expect no match
2820    abd
2821    abd
2822
2823/a[^-b]c/
2824    adc
2825
2826/a[^]b]c/
2827    adc
2828    a-c
2829\= Expect no match
2830    a]c
2831
2832/\ba\b/
2833    a-
2834    -a
2835    -a-
2836
2837/\by\b/
2838\= Expect no match
2839    xy
2840    yz
2841    xyz
2842
2843/\Ba\B/
2844\= Expect no match
2845    a-
2846    -a
2847    -a-
2848
2849/\By\b/
2850    xy
2851
2852/\by\B/
2853    yz
2854
2855/\By\B/
2856    xyz
2857
2858/\w/
2859    a
2860
2861/\W/
2862    -
2863\= Expect no match
2864    a
2865
2866/a\sb/
2867    a b
2868
2869/a\Sb/
2870    a-b
2871\= Expect no match
2872    a b
2873
2874/\d/
2875    1
2876
2877/\D/
2878    -
2879\= Expect no match
2880    1
2881
2882/[\w]/
2883    a
2884
2885/[\W]/
2886    -
2887\= Expect no match
2888    a
2889
2890/a[\s]b/
2891    a b
2892
2893/a[\S]b/
2894    a-b
2895\= Expect no match
2896    a b
2897
2898/[\d]/
2899    1
2900
2901/[\D]/
2902    -
2903\= Expect no match
2904    1
2905
2906/ab|cd/
2907    abc
2908    abcd
2909
2910/()ef/
2911    def
2912
2913/$b/
2914
2915/a\(b/
2916    a(b
2917
2918/a\(*b/
2919    ab
2920    a((b
2921
2922/a\\b/
2923    a\\b
2924\= Expect no match
2925    a\b
2926
2927/((a))/
2928    abc
2929
2930/(a)b(c)/
2931    abc
2932
2933/a+b+c/
2934    aabbabc
2935
2936/a{1,}b{1,}c/
2937    aabbabc
2938
2939/a.+?c/
2940    abcabc
2941
2942/(a+|b)*/
2943    ab
2944
2945/(a+|b){0,}/
2946    ab
2947
2948/(a+|b)+/
2949    ab
2950
2951/(a+|b){1,}/
2952    ab
2953
2954/(a+|b)?/
2955    ab
2956
2957/(a+|b){0,1}/
2958    ab
2959
2960/[^ab]*/
2961    cde
2962
2963/abc/
2964\= Expect no match
2965    b
2966
2967/a*/
2968
2969/([abc])*d/
2970    abbbcd
2971
2972/([abc])*bcd/
2973    abcd
2974
2975/a|b|c|d|e/
2976    e
2977
2978/(a|b|c|d|e)f/
2979    ef
2980
2981/abcd*efg/
2982    abcdefg
2983
2984/ab*/
2985    xabyabbbz
2986    xayabbbz
2987
2988/(ab|cd)e/
2989    abcde
2990
2991/[abhgefdc]ij/
2992    hij
2993
2994/^(ab|cd)e/
2995
2996/(abc|)ef/
2997    abcdef
2998
2999/(a|b)c*d/
3000    abcd
3001
3002/(ab|ab*)bc/
3003    abc
3004
3005/a([bc]*)c*/
3006    abc
3007
3008/a([bc]*)(c*d)/
3009    abcd
3010
3011/a([bc]+)(c*d)/
3012    abcd
3013
3014/a([bc]*)(c+d)/
3015    abcd
3016
3017/a[bcd]*dcdcde/
3018    adcdcde
3019
3020/a[bcd]+dcdcde/
3021\= Expect no match
3022    abcde
3023    adcdcde
3024
3025/(ab|a)b*c/
3026    abc
3027
3028/((a)(b)c)(d)/
3029    abcd
3030
3031/[a-zA-Z_][a-zA-Z0-9_]*/
3032    alpha
3033
3034/^a(bc+|b[eh])g|.h$/
3035    abh
3036
3037/(bc+d$|ef*g.|h?i(j|k))/
3038    effgz
3039    ij
3040    reffgz
3041\= Expect no match
3042    effg
3043    bcdd
3044
3045/((((((((((a))))))))))/
3046    a
3047
3048/(((((((((a)))))))))/
3049    a
3050
3051/multiple words of text/
3052\= Expect no match
3053    aa
3054    uh-uh
3055
3056/multiple words/
3057    multiple words, yeah
3058
3059/(.*)c(.*)/
3060    abcde
3061
3062/\((.*), (.*)\)/
3063    (a, b)
3064
3065/[k]/
3066
3067/abcd/
3068    abcd
3069
3070/a(bc)d/
3071    abcd
3072
3073/a[-]?c/
3074    ac
3075
3076/abc/i
3077    ABC
3078    XABCY
3079    ABABC
3080\= Expect no match
3081    aaxabxbaxbbx
3082    XBC
3083    AXC
3084    ABX
3085
3086/ab*c/i
3087    ABC
3088
3089/ab*bc/i
3090    ABC
3091    ABBC
3092
3093/ab*?bc/i
3094    ABBBBC
3095
3096/ab{0,}?bc/i
3097    ABBBBC
3098
3099/ab+?bc/i
3100    ABBC
3101
3102/ab+bc/i
3103\= Expect no match
3104    ABC
3105    ABQ
3106
3107/ab{1,}bc/i
3108
3109/ab+bc/i
3110    ABBBBC
3111
3112/ab{1,}?bc/i
3113    ABBBBC
3114
3115/ab{1,3}?bc/i
3116    ABBBBC
3117
3118/ab{3,4}?bc/i
3119    ABBBBC
3120
3121/ab{4,5}?bc/i
3122\= Expect no match
3123    ABQ
3124    ABBBBC
3125
3126/ab??bc/i
3127    ABBC
3128    ABC
3129
3130/ab{0,1}?bc/i
3131    ABC
3132
3133/ab??bc/i
3134
3135/ab??c/i
3136    ABC
3137
3138/ab{0,1}?c/i
3139    ABC
3140
3141/^abc$/i
3142    ABC
3143\= Expect no match
3144    ABBBBC
3145    ABCC
3146
3147/^abc/i
3148    ABCC
3149
3150/^abc$/i
3151
3152/abc$/i
3153    AABC
3154
3155/^/i
3156    ABC
3157
3158/$/i
3159    ABC
3160
3161/a.c/i
3162    ABC
3163    AXC
3164
3165/a.*?c/i
3166    AXYZC
3167
3168/a.*c/i
3169    AABC
3170\= Expect no match
3171    AXYZD
3172
3173/a[bc]d/i
3174    ABD
3175
3176/a[b-d]e/i
3177    ACE
3178\= Expect no match
3179    ABC
3180    ABD
3181
3182/a[b-d]/i
3183    AAC
3184
3185/a[-b]/i
3186    A-
3187
3188/a[b-]/i
3189    A-
3190
3191/a]/i
3192    A]
3193
3194/a[]]b/i
3195    A]B
3196
3197/a[^bc]d/i
3198    AED
3199
3200/a[^-b]c/i
3201    ADC
3202\= Expect no match
3203    ABD
3204    A-C
3205
3206/a[^]b]c/i
3207    ADC
3208
3209/ab|cd/i
3210    ABC
3211    ABCD
3212
3213/()ef/i
3214    DEF
3215
3216/$b/i
3217\= Expect no match
3218    A]C
3219    B
3220
3221/a\(b/i
3222    A(B
3223
3224/a\(*b/i
3225    AB
3226    A((B
3227
3228/a\\b/i
3229\= Expect no match
3230    A\=notbol
3231
3232/((a))/i
3233    ABC
3234
3235/(a)b(c)/i
3236    ABC
3237
3238/a+b+c/i
3239    AABBABC
3240
3241/a{1,}b{1,}c/i
3242    AABBABC
3243
3244/a.+?c/i
3245    ABCABC
3246
3247/a.*?c/i
3248    ABCABC
3249
3250/a.{0,5}?c/i
3251    ABCABC
3252
3253/(a+|b)*/i
3254    AB
3255
3256/(a+|b){0,}/i
3257    AB
3258
3259/(a+|b)+/i
3260    AB
3261
3262/(a+|b){1,}/i
3263    AB
3264
3265/(a+|b)?/i
3266    AB
3267
3268/(a+|b){0,1}/i
3269    AB
3270
3271/(a+|b){0,1}?/i
3272    AB
3273
3274/[^ab]*/i
3275    CDE
3276
3277/abc/i
3278
3279/a*/i
3280
3281/([abc])*d/i
3282    ABBBCD
3283
3284/([abc])*bcd/i
3285    ABCD
3286
3287/a|b|c|d|e/i
3288    E
3289
3290/(a|b|c|d|e)f/i
3291    EF
3292
3293/abcd*efg/i
3294    ABCDEFG
3295
3296/ab*/i
3297    XABYABBBZ
3298    XAYABBBZ
3299
3300/(ab|cd)e/i
3301    ABCDE
3302
3303/[abhgefdc]ij/i
3304    HIJ
3305
3306/^(ab|cd)e/i
3307\= Expect no match
3308    ABCDE
3309
3310/(abc|)ef/i
3311    ABCDEF
3312
3313/(a|b)c*d/i
3314    ABCD
3315
3316/(ab|ab*)bc/i
3317    ABC
3318
3319/a([bc]*)c*/i
3320    ABC
3321
3322/a([bc]*)(c*d)/i
3323    ABCD
3324
3325/a([bc]+)(c*d)/i
3326    ABCD
3327
3328/a([bc]*)(c+d)/i
3329    ABCD
3330
3331/a[bcd]*dcdcde/i
3332    ADCDCDE
3333
3334/a[bcd]+dcdcde/i
3335
3336/(ab|a)b*c/i
3337    ABC
3338
3339/((a)(b)c)(d)/i
3340    ABCD
3341
3342/[a-zA-Z_][a-zA-Z0-9_]*/i
3343    ALPHA
3344
3345/^a(bc+|b[eh])g|.h$/i
3346    ABH
3347
3348/(bc+d$|ef*g.|h?i(j|k))/i
3349    EFFGZ
3350    IJ
3351    REFFGZ
3352\= Expect no match
3353    ADCDCDE
3354    EFFG
3355    BCDD
3356
3357/((((((((((a))))))))))/i
3358    A
3359
3360/(((((((((a)))))))))/i
3361    A
3362
3363/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
3364    A
3365
3366/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
3367    C
3368
3369/multiple words of text/i
3370\= Expect no match
3371    AA
3372    UH-UH
3373
3374/multiple words/i
3375    MULTIPLE WORDS, YEAH
3376
3377/(.*)c(.*)/i
3378    ABCDE
3379
3380/\((.*), (.*)\)/i
3381    (A, B)
3382
3383/[k]/i
3384
3385/abcd/i
3386    ABCD
3387
3388/a(bc)d/i
3389    ABCD
3390
3391/a[-]?c/i
3392    AC
3393
3394/a(?!b)./
3395    abad
3396
3397/a(?=d)./
3398    abad
3399
3400/a(?=c|d)./
3401    abad
3402
3403/a(?:b|c|d)(.)/
3404    ace
3405
3406/a(?:b|c|d)*(.)/
3407    ace
3408
3409/a(?:b|c|d)+?(.)/
3410    ace
3411    acdbcdbe
3412
3413/a(?:b|c|d)+(.)/
3414    acdbcdbe
3415
3416/a(?:b|c|d){2}(.)/
3417    acdbcdbe
3418
3419/a(?:b|c|d){4,5}(.)/
3420    acdbcdbe
3421
3422/a(?:b|c|d){4,5}?(.)/
3423    acdbcdbe
3424
3425/((foo)|(bar))*/
3426    foobar
3427
3428/a(?:b|c|d){6,7}(.)/
3429    acdbcdbe
3430
3431/a(?:b|c|d){6,7}?(.)/
3432    acdbcdbe
3433
3434/a(?:b|c|d){5,6}(.)/
3435    acdbcdbe
3436
3437/a(?:b|c|d){5,6}?(.)/
3438    acdbcdbe
3439
3440/a(?:b|c|d){5,7}(.)/
3441    acdbcdbe
3442
3443/a(?:b|c|d){5,7}?(.)/
3444    acdbcdbe
3445
3446/a(?:b|(c|e){1,2}?|d)+?(.)/
3447    ace
3448
3449/^(.+)?B/
3450    AB
3451
3452/^([^a-z])|(\^)$/
3453    .
3454
3455/^[<>]&/
3456    <&OUT
3457
3458/(?:(f)(o)(o)|(b)(a)(r))*/
3459    foobar
3460
3461/(?<=a)b/
3462    ab
3463\= Expect no match
3464    cb
3465    b
3466
3467/(?<!c)b/
3468    ab
3469    b
3470    b
3471
3472/(?:..)*a/
3473    aba
3474
3475/(?:..)*?a/
3476    aba
3477
3478/^(){3,5}/
3479    abc
3480
3481/^(a+)*ax/
3482    aax
3483
3484/^((a|b)+)*ax/
3485    aax
3486
3487/^((a|bc)+)*ax/
3488    aax
3489
3490/(a|x)*ab/
3491    cab
3492
3493/(a)*ab/
3494    cab
3495
3496/(?:(?i)a)b/
3497    ab
3498
3499/((?i)a)b/
3500    ab
3501
3502/(?:(?i)a)b/
3503    Ab
3504
3505/((?i)a)b/
3506    Ab
3507
3508/(?:(?i)a)b/
3509\= Expect no match
3510    cb
3511    aB
3512
3513/((?i)a)b/
3514
3515/(?i:a)b/
3516    ab
3517
3518/((?i:a))b/
3519    ab
3520
3521/(?i:a)b/
3522    Ab
3523
3524/((?i:a))b/
3525    Ab
3526
3527/(?i:a)b/
3528\= Expect no match
3529    aB
3530    aB
3531
3532/((?i:a))b/
3533
3534/(?:(?-i)a)b/i
3535    ab
3536
3537/((?-i)a)b/i
3538    ab
3539
3540/(?:(?-i)a)b/i
3541    aB
3542
3543/((?-i)a)b/i
3544    aB
3545
3546/(?:(?-i)a)b/i
3547    aB
3548\= Expect no match
3549    Ab
3550
3551/((?-i)a)b/i
3552
3553/(?:(?-i)a)b/i
3554    aB
3555
3556/((?-i)a)b/i
3557    aB
3558
3559/(?:(?-i)a)b/i
3560\= Expect no match
3561    Ab
3562    AB
3563
3564/((?-i)a)b/i
3565
3566/(?-i:a)b/i
3567    ab
3568
3569/((?-i:a))b/i
3570    ab
3571
3572/(?-i:a)b/i
3573    aB
3574
3575/((?-i:a))b/i
3576    aB
3577
3578/(?-i:a)b/i
3579\= Expect no match
3580    AB
3581    Ab
3582
3583/((?-i:a))b/i
3584
3585/(?-i:a)b/i
3586    aB
3587
3588/((?-i:a))b/i
3589    aB
3590
3591/(?-i:a)b/i
3592\= Expect no match
3593    Ab
3594    AB
3595
3596/((?-i:a))b/i
3597
3598/((?-i:a.))b/i
3599\= Expect no match
3600    AB
3601    a\nB
3602
3603/((?s-i:a.))b/i
3604    a\nB
3605
3606/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
3607    cabbbb
3608
3609/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
3610    caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
3611
3612/foo\w*\d{4}baz/
3613    foobar1234baz
3614
3615/x(~~)*(?:(?:F)?)?/
3616    x~~
3617
3618/^a(?#xxx){3}c/
3619    aaac
3620
3621/^a (?#xxx) (?#yyy) {3}c/x
3622    aaac
3623
3624/(?<![cd])b/
3625\= Expect no match
3626    B\nB
3627    dbcb
3628
3629/(?<![cd])[ab]/
3630    dbaacb
3631
3632/(?<!(c|d))b/
3633
3634/(?<!(c|d))[ab]/
3635    dbaacb
3636
3637/(?<!cd)[ab]/
3638    cdaccb
3639
3640/^(?:a?b?)*$/
3641\= Expect no match
3642    dbcb
3643    a--
3644
3645/((?s)^a(.))((?m)^b$)/
3646    a\nb\nc\n
3647
3648/((?m)^b$)/
3649    a\nb\nc\n
3650
3651/(?m)^b/
3652    a\nb\n
3653
3654/(?m)^(b)/
3655    a\nb\n
3656
3657/((?m)^b)/
3658    a\nb\n
3659
3660/\n((?m)^b)/
3661    a\nb\n
3662
3663/((?s).)c(?!.)/
3664    a\nb\nc\n
3665    a\nb\nc\n
3666
3667/((?s)b.)c(?!.)/
3668    a\nb\nc\n
3669    a\nb\nc\n
3670
3671/^b/
3672
3673/()^b/
3674\= Expect no match
3675    a\nb\nc\n
3676    a\nb\nc\n
3677
3678/((?m)^b)/
3679    a\nb\nc\n
3680
3681/(?(?!a)a|b)/
3682
3683/(?(?!a)b|a)/
3684    a
3685
3686/(?(?=a)b|a)/
3687\= Expect no match
3688    a
3689    a
3690
3691/(?(?=a)a|b)/
3692    a
3693
3694/(\w+:)+/
3695    one:
3696
3697/$(?<=^(a))/
3698    a
3699
3700/([\w:]+::)?(\w+)$/
3701    abcd
3702    xy:z:::abcd
3703
3704/^[^bcd]*(c+)/
3705    aexycd
3706
3707/(a*)b+/
3708    caab
3709
3710/([\w:]+::)?(\w+)$/
3711    abcd
3712    xy:z:::abcd
3713\= Expect no match
3714    abcd:
3715    abcd:
3716
3717/^[^bcd]*(c+)/
3718    aexycd
3719
3720/(>a+)ab/
3721
3722/(?>a+)b/
3723    aaab
3724
3725/([[:]+)/
3726    a:[b]:
3727
3728/([[=]+)/
3729    a=[b]=
3730
3731/([[.]+)/
3732    a.[b].
3733
3734/((?>a+)b)/
3735    aaab
3736
3737/(?>(a+))b/
3738    aaab
3739
3740/((?>[^()]+)|\([^()]*\))+/
3741    ((abc(ade)ufh()()x
3742
3743/a\Z/
3744\= Expect no match
3745    aaab
3746    a\nb\n
3747
3748/b\Z/
3749    a\nb\n
3750
3751/b\z/
3752
3753/b\Z/
3754    a\nb
3755
3756/b\z/
3757    a\nb
3758
3759/(?>.*)(?<=(abcd|wxyz))/
3760    alphabetabcd
3761    endingwxyz
3762\= Expect no match
3763    a rather long string that doesn't end with one of them
3764
3765/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
3766    word cat dog elephant mussel cow horse canary baboon snake shark otherword
3767\= Expect no match
3768    word cat dog elephant mussel cow horse canary baboon snake shark
3769
3770/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
3771\= Expect no match
3772    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
3773
3774/(?<=\d{3}(?!999))foo/
3775    999foo
3776    123999foo
3777\= Expect no match
3778    123abcfoo
3779
3780/(?<=(?!...999)\d{3})foo/
3781    999foo
3782    123999foo
3783\= Expect no match
3784    123abcfoo
3785
3786/(?<=\d{3}(?!999)...)foo/
3787    123abcfoo
3788    123456foo
3789\= Expect no match
3790    123999foo
3791
3792/(?<=\d{3}...)(?<!999)foo/
3793    123abcfoo
3794    123456foo
3795\= Expect no match
3796    123999foo
3797
3798/((Z)+|A)*/
3799    ZABCDEFG
3800
3801/(Z()|A)*/
3802    ZABCDEFG
3803
3804/(Z(())|A)*/
3805    ZABCDEFG
3806
3807/((?>Z)+|A)*/
3808    ZABCDEFG
3809
3810/((?>)+|A)*/
3811    ZABCDEFG
3812
3813/a*/g
3814    abbab
3815
3816/^[\d-a]/
3817    abcde
3818    -things
3819    0digit
3820\= Expect no match
3821    bcdef
3822
3823/[[:space:]]+/
3824    > \x09\x0a\x0c\x0d\x0b<
3825
3826/[[:blank:]]+/
3827    > \x09\x0a\x0c\x0d\x0b<
3828
3829/[\s]+/
3830    > \x09\x0a\x0c\x0d\x0b<
3831
3832/\s+/
3833    > \x09\x0a\x0c\x0d\x0b<
3834
3835/ab/x
3836    ab
3837
3838/(?!\A)x/m
3839  a\nxb\n
3840
3841/(?!^)x/m
3842\= Expect no match
3843    a\nxb\n
3844
3845/abc\Qabc\Eabc/
3846    abcabcabc
3847
3848/abc\Q(*+|\Eabc/
3849    abc(*+|abc
3850
3851/   abc\Q abc\Eabc/x
3852    abc abcabc
3853\= Expect no match
3854    abcabcabc
3855
3856/abc#comment
3857    \Q#not comment
3858    literal\E/x
3859    abc#not comment\n    literal
3860
3861/abc#comment
3862    \Q#not comment
3863    literal/x
3864    abc#not comment\n    literal
3865
3866/abc#comment
3867    \Q#not comment
3868    literal\E #more comment
3869    /x
3870    abc#not comment\n    literal
3871
3872/abc#comment
3873    \Q#not comment
3874    literal\E #more comment/x
3875    abc#not comment\n    literal
3876
3877/\Qabc\$xyz\E/
3878    abc\\\$xyz
3879
3880/\Qabc\E\$\Qxyz\E/
3881    abc\$xyz
3882
3883/\Gabc/
3884    abc
3885\= Expect no match
3886    xyzabc
3887
3888/\Gabc./g
3889    abc1abc2xyzabc3
3890
3891/abc./g
3892    abc1abc2xyzabc3
3893
3894/a(?x: b c )d/
3895    XabcdY
3896\= Expect no match
3897    Xa b c d Y
3898
3899/((?x)x y z | a b c)/
3900    XabcY
3901    AxyzB
3902
3903/(?i)AB(?-i)C/
3904    XabCY
3905\= Expect no match
3906    XabcY
3907
3908/((?i)AB(?-i)C|D)E/
3909    abCE
3910    DE
3911\= Expect no match
3912    abcE
3913    abCe
3914    dE
3915    De
3916
3917/[z\Qa-d]\E]/
3918    z
3919    a
3920    -
3921    d
3922    ]
3923\= Expect no match
3924    b
3925
3926/(a+)*b/
3927\= Expect no match
3928    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3929
3930/(?i)reg(?:ul(?:[a�]|ae)r|ex)/
3931    REGular
3932    regulaer
3933    Regex
3934    regul�r
3935
3936/����[�-��-�]+/
3937    �����
3938    �����
3939    �����
3940    �����
3941
3942/(?<=Z)X./
3943    \x84XAZXB
3944
3945/^(?(2)a|(1)(2))+$/
3946    123a
3947
3948/(?<=a|bbbb)c/
3949    ac
3950    bbbbc
3951
3952/line\nbreak/
3953    this is a line\nbreak
3954    line one\nthis is a line\nbreak in the second line
3955
3956/line\nbreak/firstline
3957    this is a line\nbreak
3958\= Expect no match
3959    line one\nthis is a line\nbreak in the second line
3960
3961/line\nbreak/m,firstline
3962    this is a line\nbreak
3963\= Expect no match
3964    line one\nthis is a line\nbreak in the second line
3965
3966/1234/
3967    123\=ps
3968\= Expect no match
3969    a4\=ps,dfa_restart
3970
3971/1234/
3972    123\=ps
3973    4\=ps,dfa_restart
3974
3975/^/gm
3976    a\nb\nc\n
3977    \
3978
3979/(?<=C\n)^/gm
3980    A\nC\nC\n
3981
3982/(?s)A?B/
3983    AB
3984    aB
3985
3986/(?s)A*B/
3987    AB
3988    aB
3989
3990/(?m)A?B/
3991    AB
3992    aB
3993
3994/(?m)A*B/
3995    AB
3996    aB
3997
3998/Content-Type\x3A[^\r\n]{6,}/
3999    Content-Type:xxxxxyyy
4000
4001/Content-Type\x3A[^\r\n]{6,}z/
4002    Content-Type:xxxxxyyyz
4003
4004/Content-Type\x3A[^a]{6,}/
4005    Content-Type:xxxyyy
4006
4007/Content-Type\x3A[^a]{6,}z/
4008    Content-Type:xxxyyyz
4009
4010/^abc/Im,newline=lf
4011    xyz\nabc
4012    xyz\r\nabc
4013\= Expect no match
4014    xyz\rabc
4015    xyzabc\r
4016    xyzabc\rpqr
4017    xyzabc\r\n
4018    xyzabc\r\npqr
4019
4020/^abc/Im,newline=crlf
4021    xyz\r\nabclf>
4022\= Expect no match
4023    xyz\nabclf
4024    xyz\rabclf
4025
4026/^abc/Im,newline=cr
4027    xyz\rabc
4028\= Expect no match
4029    xyz\nabc
4030    xyz\r\nabc
4031
4032/.*/I,newline=lf
4033    abc\ndef
4034    abc\rdef
4035    abc\r\ndef
4036
4037/.*/I,newline=cr
4038    abc\ndef
4039    abc\rdef
4040    abc\r\ndef
4041
4042/.*/I,newline=crlf
4043    abc\ndef
4044    abc\rdef
4045    abc\r\ndef
4046
4047/\w+(.)(.)?def/Is
4048    abc\ndef
4049    abc\rdef
4050    abc\r\ndef
4051
4052/\w+(.)(.)?def/s
4053    abc\ndef
4054    abc\rdef
4055    abc\r\ndef
4056
4057/^\w+=.*(\\\n.*)*/
4058    abc=xyz\\\npqr
4059
4060/^(a()*)*/
4061    aaaa
4062
4063/^(?:a(?:(?:))*)*/
4064    aaaa
4065
4066/^(a()+)+/
4067    aaaa
4068
4069/^(?:a(?:(?:))+)+/
4070    aaaa
4071
4072/(a|)*\d/
4073  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
4074\= Expect no match
4075  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4076
4077/(?>a|)*\d/
4078  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
4079\= Expect no match
4080  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4081
4082/(?:a|)*\d/
4083  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
4084\= Expect no match
4085  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4086
4087/^a.b/newline=lf
4088    a\rb
4089\= Expect no match
4090    a\nb
4091
4092/^a.b/newline=cr
4093    a\nb
4094\= Expect no match
4095    a\rb
4096
4097/^a.b/newline=anycrlf
4098    a\x85b
4099\= Expect no match
4100    a\rb
4101
4102/^a.b/newline=any
4103\= Expect no match
4104    a\nb
4105    a\rb
4106    a\x85b
4107
4108/^abc./gmx,newline=any
4109    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
4110
4111/abc.$/gmx,newline=any
4112    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
4113
4114/^a\Rb/bsr=unicode
4115    a\nb
4116    a\rb
4117    a\r\nb
4118    a\x0bb
4119    a\x0cb
4120    a\x85b
4121\= Expect no match
4122    a\n\rb
4123
4124/^a\R*b/bsr=unicode
4125    ab
4126    a\nb
4127    a\rb
4128    a\r\nb
4129    a\x0bb
4130    a\x0cb
4131    a\x85b
4132    a\n\rb
4133    a\n\r\x85\x0cb
4134
4135/^a\R+b/bsr=unicode
4136    a\nb
4137    a\rb
4138    a\r\nb
4139    a\x0bb
4140    a\x0cb
4141    a\x85b
4142    a\n\rb
4143    a\n\r\x85\x0cb
4144\= Expect no match
4145    ab
4146
4147/^a\R{1,3}b/bsr=unicode
4148    a\nb
4149    a\n\rb
4150    a\n\r\x85b
4151    a\r\n\r\nb
4152    a\r\n\r\n\r\nb
4153    a\n\r\n\rb
4154    a\n\n\r\nb
4155\= Expect no match
4156    a\n\n\n\rb
4157    a\r
4158
4159/.+foo/
4160    afoo
4161\= Expect no match
4162    \r\nfoo
4163    \nfoo
4164
4165/.+foo/newline=crlf
4166    afoo
4167    \nfoo
4168\= Expect no match
4169    \r\nfoo
4170
4171/.+foo/newline=any
4172    afoo
4173\= Expect no match
4174    \nfoo
4175    \r\nfoo
4176
4177/.+foo/s
4178    afoo
4179    \r\nfoo
4180    \nfoo
4181
4182/^$/gm,newline=any
4183    abc\r\rxyz
4184    abc\n\rxyz
4185\= Expect no match
4186    abc\r\nxyz
4187
4188/^X/m
4189    XABC
4190\= Expect no match
4191    XABC\=notbol
4192
4193/(?m)^$/g,newline=any,aftertext
4194    abc\r\n\r\n
4195
4196/(?m)^$|^\r\n/g,newline=any,aftertext
4197    abc\r\n\r\n
4198
4199/(?m)$/g,newline=any,aftertext
4200    abc\r\n\r\n
4201
4202/(?|(abc)|(xyz))/
4203   >abc<
4204   >xyz<
4205
4206/(x)(?|(abc)|(xyz))(x)/
4207    xabcx
4208    xxyzx
4209
4210/(x)(?|(abc)(pqr)|(xyz))(x)/
4211    xabcpqrx
4212    xxyzx
4213
4214/(?|(abc)|(xyz))(?1)/
4215    abcabc
4216    xyzabc
4217\= Expect no match
4218    xyzxyz
4219
4220/\H\h\V\v/
4221    X X\x0a
4222    X\x09X\x0b
4223\= Expect no match
4224    \xa0 X\x0a
4225
4226/\H*\h+\V?\v{3,4}/
4227    \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
4228    \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
4229    \x09\x20\xa0\x0a\x0b\x0c
4230\= Expect no match
4231    \x09\x20\xa0\x0a\x0b
4232
4233/\H{3,4}/
4234    XY  ABCDE
4235    XY  PQR ST
4236
4237/.\h{3,4}./
4238    XY  AB    PQRS
4239
4240/\h*X\h?\H+Y\H?Z/
4241    >XNNNYZ
4242    >  X NYQZ
4243\= Expect no match
4244    >XYZ
4245    >  X NY Z
4246
4247/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
4248    >XY\x0aZ\x0aA\x0bNN\x0c
4249    >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
4250
4251/.+A/newline=crlf
4252\= Expect no match
4253    \r\nA
4254
4255/\nA/newline=crlf
4256    \r\nA
4257
4258/[\r\n]A/newline=crlf
4259    \r\nA
4260
4261/(\r|\n)A/newline=crlf
4262    \r\nA
4263
4264/a\Rb/I,bsr=anycrlf
4265    a\rb
4266    a\nb
4267    a\r\nb
4268\= Expect no match
4269    a\x85b
4270    a\x0bb
4271
4272/a\Rb/I,bsr=unicode
4273    a\rb
4274    a\nb
4275    a\r\nb
4276    a\x85b
4277    a\x0bb
4278
4279/a\R?b/I,bsr=anycrlf
4280    a\rb
4281    a\nb
4282    a\r\nb
4283\= Expect no match
4284    a\x85b
4285    a\x0bb
4286
4287/a\R?b/I,bsr=unicode
4288    a\rb
4289    a\nb
4290    a\r\nb
4291    a\x85b
4292    a\x0bb
4293
4294/a\R{2,4}b/I,bsr=anycrlf
4295    a\r\n\nb
4296    a\n\r\rb
4297    a\r\n\r\n\r\n\r\nb
4298\= Expect no match
4299    a\x0b\x0bb
4300    a\x85\x85b
4301
4302/a\R{2,4}b/I,bsr=unicode
4303    a\r\rb
4304    a\n\n\nb
4305    a\r\n\n\r\rb
4306    a\x85\x85b
4307    a\x0b\x0bb
4308\= Expect no match
4309    a\r\r\r\r\rb
4310
4311/a(?!)|\wbc/
4312    abc
4313
4314/a[]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
4315\= Expect no match
4316    ab
4317
4318/a[]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
4319\= Expect no match
4320    ab
4321
4322/a[]*+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
4323\= Expect no match
4324    ab
4325
4326/a[^]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
4327    aXb
4328    a\nb
4329\= Expect no match
4330    ab
4331
4332/a[^]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
4333    aXb
4334    a\nX\nXb
4335\= Expect no match
4336    ab
4337
4338/X$/dollar_endonly
4339    X
4340\= Expect no match
4341    X\n
4342
4343/X$/
4344    X
4345    X\n
4346
4347/xyz/auto_callout
4348  xyz
4349  abcxyz
4350\= Expect no match
4351  abc
4352  abcxypqr
4353
4354/xyz/auto_callout,no_start_optimize
4355  abcxyz
4356\= Expect no match
4357  abc
4358  abcxypqr
4359
4360/(*NO_START_OPT)xyz/auto_callout
4361  abcxyz
4362
4363/(?C)ab/
4364  ab
4365  ab\=callout_none
4366
4367/ab/auto_callout
4368  ab
4369  ab\=callout_none
4370
4371/^"((?(?=[a])[^"])|b)*"$/auto_callout
4372    "ab"
4373    "ab"\=callout_none
4374
4375/\d+X|9+Y/
4376    ++++123999\=ps
4377    ++++123999Y\=ps
4378
4379/Z(*F)/
4380\= Expect no match
4381    Z\=ps
4382    ZA\=ps
4383
4384/Z(?!)/
4385\= Expect no match
4386    Z\=ps
4387    ZA\=ps
4388
4389/dog(sbody)?/
4390    dogs\=ps
4391    dogs\=ph
4392
4393/dog(sbody)??/
4394    dogs\=ps
4395    dogs\=ph
4396
4397/dog|dogsbody/
4398    dogs\=ps
4399    dogs\=ph
4400
4401/dogsbody|dog/
4402    dogs\=ps
4403    dogs\=ph
4404
4405/Z(*F)Q|ZXY/
4406    Z\=ps
4407\= Expect no match
4408    ZA\=ps
4409    X\=ps
4410
4411/\bthe cat\b/
4412    the cat\=ps
4413    the cat\=ph
4414
4415/dog(sbody)?/
4416    dogs\=ps
4417    body\=dfa_restart
4418
4419/dog(sbody)?/
4420    dogs\=ph
4421    body\=dfa_restart
4422
4423/abc/
4424   abc\=ps
4425   abc\=ph
4426
4427/abc\K123/
4428    xyzabc123pqr
4429
4430/(?<=abc)123/
4431    xyzabc123pqr
4432    xyzabc12\=ps
4433    xyzabc12\=ph
4434
4435/\babc\b/
4436    +++abc+++
4437    +++ab\=ps
4438    +++ab\=ph
4439
4440/(?=C)/g,aftertext
4441    ABCDECBA
4442
4443/(abc|def|xyz)/I
4444    terhjk;abcdaadsfe
4445    the quick xyz brown fox
4446\= Expect no match
4447    thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
4448
4449/(abc|def|xyz)/I,no_start_optimize
4450    terhjk;abcdaadsfe
4451    the quick xyz brown fox
4452\= Expect no match
4453    thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
4454
4455/abcd*/aftertext
4456    xxxxabcd\=ps
4457    xxxxabcd\=ph
4458    dddxxx\=dfa_restart
4459    xxxxabcd\=ph
4460    xxx\=dfa_restart
4461
4462/abcd*/i
4463    xxxxabcd\=ps
4464    xxxxabcd\=ph
4465    XXXXABCD\=ps
4466    XXXXABCD\=ph
4467
4468/abc\d*/
4469    xxxxabc1\=ps
4470    xxxxabc1\=ph
4471
4472/abc[de]*/
4473    xxxxabcde\=ps
4474    xxxxabcde\=ph
4475
4476/(?:(?1)|B)(A(*F)|C)/
4477    ABCD
4478    CCD
4479\= Expect no match
4480    CAD
4481
4482/^(?:(?1)|B)(A(*F)|C)/
4483    CCD
4484    BCD
4485\= Expect no match
4486    ABCD
4487    CAD
4488    BAD
4489
4490/^(?!a(*SKIP)b)/
4491    ac
4492
4493/^(?=a(*SKIP)b|ac)/
4494    ac
4495
4496/^(?=a(*THEN)b|ac)/
4497    ac
4498
4499/^(?=a(*PRUNE)b)/
4500    ab
4501
4502/^(?(?!a(*SKIP)b))/
4503    ac
4504
4505/(?<=abc)def/
4506    abc\=ph
4507
4508/abc$/
4509    abc
4510    abc\=ps
4511    abc\=ph
4512
4513/abc$/m
4514    abc
4515    abc\n
4516    abc\=ph
4517    abc\n\=ph
4518    abc\=ps
4519    abc\n\=ps
4520
4521/abc\z/
4522    abc
4523    abc\=ps
4524    abc\=ph
4525
4526/abc\Z/
4527    abc
4528    abc\=ps
4529    abc\=ph
4530
4531/abc\b/
4532    abc
4533    abc\=ps
4534    abc\=ph
4535
4536/abc\B/
4537    abc\=ps
4538    abc\=ph
4539\= Expect no match
4540    abc
4541
4542/.+/
4543    abc\=offset=0
4544    abc\=offset=1
4545    abc\=offset=2
4546\= Bad offsets
4547    abc\=offset=4
4548    abc\=offset=-4
4549\= Expect no match
4550    abc\=offset=3
4551
4552/^(?:a)++\w/
4553     aaaab
4554\= Expect no match
4555     aaaa
4556     bbb
4557
4558/^(?:aa|(?:a)++\w)/
4559     aaaab
4560     aaaa
4561\= Expect no match
4562     bbb
4563
4564/^(?:a)*+\w/
4565     aaaab
4566     bbb
4567\= Expect no match
4568     aaaa
4569
4570/^(a)++\w/
4571     aaaab
4572\= Expect no match
4573     aaaa
4574     bbb
4575
4576/^(a|)++\w/
4577     aaaab
4578\= Expect no match
4579     aaaa
4580     bbb
4581
4582/(?=abc){3}abc/aftertext
4583    abcabcabc
4584\= Expect no match
4585    xyz
4586
4587/(?=abc)+abc/aftertext
4588    abcabcabc
4589\= Expect no match
4590    xyz
4591
4592/(?=abc)++abc/aftertext
4593    abcabcabc
4594\= Expect no match
4595    xyz
4596
4597/(?=abc){0}xyz/
4598    xyz
4599
4600/(?=abc){1}xyz/
4601\= Expect no match
4602    xyz
4603
4604/(?=(a))?./
4605    ab
4606    bc
4607
4608/(?=(a))??./
4609    ab
4610    bc
4611
4612/^(?=(a)){0}b(?1)/
4613    backgammon
4614
4615/^(?=(?1))?[az]([abc])d/
4616    abd
4617    zcdxx
4618
4619/^(?!a){0}\w+/
4620    aaaaa
4621
4622/(?<=(abc))?xyz/
4623    abcxyz
4624    pqrxyz
4625
4626/((?2))((?1))/
4627    abc
4628
4629/(?(R)a+|(?R)b)/
4630    aaaabcde
4631
4632/(?(R)a+|((?R))b)/
4633    aaaabcde
4634
4635/((?(R)a+|(?1)b))/
4636    aaaabcde
4637
4638/((?(R2)a+|(?1)b))/
4639    aaaabcde
4640
4641/(?(R)a*(?1)|((?R))b)/
4642    aaaabcde
4643
4644/(a+)/no_auto_possess
4645    aaaa\=ovector=3
4646    aaaa\=ovector=4
4647
4648/^\R/
4649    \r\=ps
4650    \r\=ph
4651
4652/^\R{2,3}x/
4653    \r\=ps
4654    \r\=ph
4655    \r\r\=ps
4656    \r\r\=ph
4657    \r\r\r\=ps
4658    \r\r\r\=ph
4659    \r\rx
4660    \r\r\rx
4661
4662/^\R{2,3}?x/
4663    \r\=ps
4664    \r\=ph
4665    \r\r\=ps
4666    \r\r\=ph
4667    \r\r\r\=ps
4668    \r\r\r\=ph
4669    \r\rx
4670    \r\r\rx
4671
4672/^\R?x/
4673    \r\=ps
4674    \r\=ph
4675    x
4676    \rx
4677
4678/^\R+x/
4679    \r\=ps
4680    \r\=ph
4681    \r\n\=ps
4682    \r\n\=ph
4683    \rx
4684
4685/^a$/newline=crlf
4686    a\r\=ps
4687    a\r\=ph
4688
4689/^a$/m,newline=crlf
4690    a\r\=ps
4691    a\r\=ph
4692
4693/^(a$|a\r)/newline=crlf
4694    a\r\=ps
4695    a\r\=ph
4696
4697/^(a$|a\r)/m,newline=crlf
4698    a\r\=ps
4699    a\r\=ph
4700
4701/./newline=crlf
4702    \r\=ps
4703    \r\=ph
4704
4705/.{2,3}/newline=crlf
4706    \r\=ps
4707    \r\=ph
4708    \r\r\=ps
4709    \r\r\=ph
4710    \r\r\r\=ps
4711    \r\r\r\=ph
4712
4713/.{2,3}?/newline=crlf
4714    \r\=ps
4715    \r\=ph
4716    \r\r\=ps
4717    \r\r\=ph
4718    \r\r\r\=ps
4719    \r\r\r\=ph
4720
4721# Test simple validity check for restarts
4722
4723/abcdef/
4724   abc\=dfa_restart
4725
4726/<H((?(?!<H|F>)(.)|(?R))++)*F>/
4727    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.
4728
4729/^(?>.{4})abc|^\w\w.xabcd/
4730    xxxxabcd
4731    xx\xa0xabcd
4732
4733/^(.{4}){2}+abc|^\w\w.x\w\w\w\wabcd/
4734    xxxxxxxxabcd
4735    xx\xa0xxxxxabcd
4736
4737/abcd/
4738    abcd\=ovector=0
4739
4740# These tests show up auto-possessification
4741
4742/[ab]*/
4743    aaaa
4744
4745/[ab]*?/
4746    aaaa
4747
4748/[ab]?/
4749    aaaa
4750
4751/[ab]??/
4752    aaaa
4753
4754/[ab]+/
4755    aaaa
4756
4757/[ab]+?/
4758    aaaa
4759
4760/[ab]{2,3}/
4761    aaaa
4762
4763/[ab]{2,3}?/
4764    aaaa
4765
4766/[ab]{2,}/
4767    aaaa
4768
4769/[ab]{2,}?/
4770    aaaa
4771
4772'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++'
4773    NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
4774
4775'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
4776    NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
4777
4778/abc(?=xyz)/allusedtext
4779    abcxyzpqr
4780    abcxyzpqr\=aftertext
4781
4782/(?<=pqr)abc(?=xyz)/allusedtext
4783    xyzpqrabcxyzpqr
4784    xyzpqrabcxyzpqr\=aftertext
4785
4786/a\b/
4787    a.\=allusedtext
4788    a\=allusedtext
4789
4790/abc(?=abcde)(?=ab)/allusedtext
4791    abcabcdefg
4792
4793/a*?b*?/
4794    ab
4795
4796/(*NOTEMPTY)a*?b*?/
4797    ab
4798    ba
4799    cb
4800
4801/(*NOTEMPTY_ATSTART)a*?b*?/aftertext
4802    ab
4803    cdab
4804
4805/(a)(b)|(c)/
4806    XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
4807
4808/(?<A>aa)/
4809    aa\=get=A
4810    aa\=copy=A
4811
4812/a+/no_auto_possess
4813    a\=ovector=2,get=1,get=2,getall
4814    aaa\=ovector=2,get=1,get=2,getall
4815
4816/a(b)c(d)/
4817    abc\=ph,copy=0,copy=1,getall
4818
4819/ab(?C" any text with spaces ")cde/B
4820    abcde
4821    12abcde
4822
4823/^a(b)c(?C1)def/
4824      abcdef
4825
4826/^a(b)c(?C"AB")def/
4827      abcdef
4828
4829/^a(b)c(?C1)def/
4830      abcdef\=callout_capture
4831
4832/^a(b)c(?C{AB})def/B
4833      abcdef\=callout_capture
4834
4835/^(?(?C25)(?=abc)abcd|xyz)/B
4836    abcdefg
4837    xyz123
4838
4839/^(?(?C$abc$)(?=abc)abcd|xyz)/B
4840    abcdefg
4841    xyz123
4842
4843/^ab(?C'first')cd(?C"second")ef/
4844    abcdefg
4845
4846/(?:a(?C`code`)){3}X/
4847    aaaXY
4848
4849# Binary zero in callout string
4850/"a(?C'x" 00 "z')b"/hex
4851    abcdefgh
4852
4853/(?(?!)a|b)/
4854    bbb
4855\= Expect no match
4856    aaa
4857
4858/^/gm
4859    \n\n\n
4860
4861/^/gm,alt_circumflex
4862    \n\n\n
4863
4864/abc/use_offset_limit
4865    1234abcde\=offset_limit=100
4866    1234abcde\=offset_limit=9
4867    1234abcde\=offset_limit=4
4868    1234abcde\=offset_limit=4,offset=4
4869\= Expect no match
4870    1234abcde\=offset_limit=4,offset=5
4871    1234abcde\=offset_limit=3
4872
4873/(?<=abc)/use_offset_limit
4874    1234abc\=offset_limit=7
4875\= Expect no match
4876    1234abc\=offset_limit=6
4877
4878/abcd/null_context
4879    abcd\=null_context
4880
4881/()()a+/no_auto_possess
4882    aaa\=dfa,allcaptures
4883    a\=dfa,allcaptures
4884
4885# End of testinput6
4886