new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / external / pcre2-10.32 / testdata / testinput6
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 /^\\81/
658     \81
659
660 /^ÿ/
661     Ã¿
662
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     \f  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 /\x5c/
1865     \\
1866
1867 /\x20Z/
1868     the Zoo
1869 \= Expect no match
1870     Zulu
1871
1872 /ab{3cd/
1873     ab{3cd
1874
1875 /ab{3,cd/
1876     ab{3,cd
1877
1878 /ab{3,4a}cd/
1879     ab{3,4a}cd
1880
1881 /{4,5a}bc/
1882     {4,5a}bc
1883
1884 /^a.b/newline=lf
1885     a\rb
1886 \= Expect no match
1887     a\nb
1888
1889 /abc$/
1890     abc
1891     abc\n
1892 \= Expect no match
1893     abc\ndef
1894
1895 /(abc)\123/
1896     abc\x53
1897
1898 /(abc)\223/
1899     abc\x93
1900
1901 /(abc)\323/
1902     abc\xd3
1903
1904 /(abc)\100/
1905     abc\x40
1906     abc\100
1907
1908 /(abc)\1000/
1909     abc\x400
1910     abc\x40\x30
1911     abc\1000
1912     abc\100\x30
1913     abc\100\060
1914     abc\100\60
1915
1916 /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
1917     abcdefghijk\12S
1918
1919 /a{0}bc/
1920     bc
1921
1922 /(a|(bc)){0,0}?xyz/
1923     xyz
1924
1925 /abc[\10]de/
1926     abc\010de
1927
1928 /abc[\1]de/
1929     abc\1de
1930
1931 /(abc)[\1]de/
1932     abc\1de
1933
1934 /(?s)a.b/
1935     a\nb
1936
1937 /^([^a])([^\b])([^c]*)([^d]{3,4})/
1938     baNOTccccd
1939     baNOTcccd
1940     baNOTccd
1941     bacccd
1942 \= Expect no match
1943     anything
1944     b\bc   
1945     baccd
1946
1947 /[^a]/
1948     Abc
1949   
1950 /[^a]/i
1951     Abc 
1952
1953 /[^a]+/
1954     AAAaAbc
1955   
1956 /[^a]+/i
1957     AAAaAbc 
1958
1959 /[^a]+/
1960     bbb\nccc
1961    
1962 /[^k]$/
1963     abc
1964 \= Expect no match
1965     abk   
1966    
1967 /[^k]{2,3}$/
1968     abc
1969     kbc
1970     kabc 
1971 \= Expect no match
1972     abk
1973     akb
1974     akk 
1975
1976 /^\d{8,}\@.+[^k]$/
1977     12345678\@a.b.c.d
1978     123456789\@x.y.z
1979 \= Expect no match
1980     12345678\@x.y.uk
1981     1234567\@a.b.c.d       
1982
1983 /[^a]/
1984     aaaabcd
1985     aaAabcd 
1986
1987 /[^a]/i
1988     aaaabcd
1989     aaAabcd 
1990
1991 /[^az]/
1992     aaaabcd
1993     aaAabcd 
1994
1995 /[^az]/i
1996     aaaabcd
1997     aaAabcd 
1998
1999 /\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/
2000  \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
2001
2002 /P[^*]TAIRE[^*]{1,6}?LL/
2003     xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2004
2005 /P[^*]TAIRE[^*]{1,}?LL/
2006     xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2007
2008 /(\.\d\d[1-9]?)\d+/
2009     1.230003938
2010     1.875000282   
2011     1.235  
2012                   
2013 /(\.\d\d((?=0)|\d(?=\d)))/
2014     1.230003938      
2015     1.875000282
2016 \= Expect no match 
2017     1.235 
2018     
2019 /a(?)b/
2020     ab 
2021  
2022 /\b(foo)\s+(\w+)/i
2023     Food is on the foo table
2024     
2025 /foo(.*)bar/
2026     The food is under the bar in the barn.
2027     
2028 /foo(.*?)bar/
2029     The food is under the bar in the barn.
2030
2031 /(.*)(\d*)/no_auto_possess
2032     I have 2 numbers: 53147
2033     
2034 /(.*)(\d+)/
2035     I have 2 numbers: 53147
2036  
2037 /(.*?)(\d*)/no_auto_possess
2038     I have 2 numbers: 53147
2039
2040 /(.*?)(\d+)/
2041     I have 2 numbers: 53147
2042
2043 /(.*)(\d+)$/
2044     I have 2 numbers: 53147
2045
2046 /(.*?)(\d+)$/
2047     I have 2 numbers: 53147
2048
2049 /(.*)\b(\d+)$/
2050     I have 2 numbers: 53147
2051
2052 /(.*\D)(\d+)$/
2053     I have 2 numbers: 53147
2054
2055 /^\D*(?!123)/
2056     ABC123
2057      
2058 /^(\D*)(?=\d)(?!123)/
2059     ABC445
2060 \= Expect no match
2061     ABC123
2062     
2063 /^[W-]46]/
2064     W46]789 
2065     -46]789
2066 \= Expect no match
2067     Wall
2068     Zebra
2069     42
2070     [abcd] 
2071     ]abcd[
2072        
2073 /^[W-\]46]/
2074     W46]789 
2075     Wall
2076     Zebra
2077     Xylophone  
2078     42
2079     [abcd] 
2080     ]abcd[
2081     \\backslash 
2082 \= Expect no match
2083     -46]789
2084     well
2085     
2086 /\d\d\/\d\d\/\d\d\d\d/
2087     01/01/2000
2088
2089 /word (?:[a-zA-Z0-9]+ ){0,10}otherword/
2090   word cat dog elephant mussel cow horse canary baboon snake shark otherword
2091 \= Expect no match
2092   word cat dog elephant mussel cow horse canary baboon snake shark
2093
2094 /word (?:[a-zA-Z0-9]+ ){0,300}otherword/
2095 \= Expect no match
2096   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
2097
2098 /^(a){0,0}/
2099     bcd
2100     abc
2101     aab     
2102
2103 /^(a){0,1}/
2104     bcd
2105     abc
2106     aab  
2107
2108 /^(a){0,2}/
2109     bcd
2110     abc
2111     aab  
2112
2113 /^(a){0,3}/
2114     bcd
2115     abc
2116     aab
2117     aaa   
2118
2119 /^(a){0,}/
2120     bcd
2121     abc
2122     aab
2123     aaa
2124     aaaaaaaa    
2125
2126 /^(a){1,1}/
2127     abc
2128     aab  
2129 \= Expect no match
2130     bcd
2131
2132 /^(a){1,2}/
2133     abc
2134     aab  
2135 \= Expect no match
2136     bcd
2137
2138 /^(a){1,3}/
2139     abc
2140     aab
2141     aaa   
2142 \= Expect no match
2143     bcd
2144
2145 /^(a){1,}/
2146     abc
2147     aab
2148     aaa
2149     aaaaaaaa    
2150 \= Expect no match
2151     bcd
2152
2153 /.*\.gif/
2154     borfle\nbib.gif\nno
2155
2156 /.{0,}\.gif/
2157     borfle\nbib.gif\nno
2158
2159 /.*\.gif/m
2160     borfle\nbib.gif\nno
2161
2162 /.*\.gif/s
2163     borfle\nbib.gif\nno
2164
2165 /.*\.gif/ms
2166     borfle\nbib.gif\nno
2167     
2168 /.*$/
2169     borfle\nbib.gif\nno
2170
2171 /.*$/m
2172     borfle\nbib.gif\nno
2173
2174 /.*$/s
2175     borfle\nbib.gif\nno
2176
2177 /.*$/ms
2178     borfle\nbib.gif\nno
2179     
2180 /.*$/
2181     borfle\nbib.gif\nno\n
2182
2183 /.*$/m
2184     borfle\nbib.gif\nno\n
2185
2186 /.*$/s
2187     borfle\nbib.gif\nno\n
2188
2189 /.*$/ms
2190     borfle\nbib.gif\nno\n
2191     
2192 /(.*X|^B)/
2193     abcde\n1234Xyz
2194     BarFoo 
2195 \= Expect no match
2196     abcde\nBar  
2197
2198 /(.*X|^B)/m
2199     abcde\n1234Xyz
2200     BarFoo 
2201     abcde\nBar  
2202
2203 /(.*X|^B)/s
2204     abcde\n1234Xyz
2205     BarFoo 
2206 \= Expect no match
2207     abcde\nBar  
2208
2209 /(.*X|^B)/ms
2210     abcde\n1234Xyz
2211     BarFoo 
2212     abcde\nBar  
2213
2214 /(?s)(.*X|^B)/
2215     abcde\n1234Xyz
2216     BarFoo 
2217 \= Expect no match 
2218     abcde\nBar  
2219
2220 /(?s:.*X|^B)/
2221     abcde\n1234Xyz
2222     BarFoo 
2223 \= Expect no match 
2224     abcde\nBar  
2225
2226 /^.*B/
2227 \= Expect no match
2228     abc\nB
2229      
2230 /(?s)^.*B/
2231     abc\nB
2232
2233 /(?m)^.*B/
2234     abc\nB
2235      
2236 /(?ms)^.*B/
2237     abc\nB
2238
2239 /(?ms)^B/
2240     abc\nB
2241
2242 /(?s)B$/
2243     B\n
2244
2245 /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
2246     123456654321
2247   
2248 /^\d\d\d\d\d\d\d\d\d\d\d\d/
2249     123456654321 
2250
2251 /^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
2252     123456654321
2253   
2254 /^[abc]{12}/
2255     abcabcabcabc
2256     
2257 /^[a-c]{12}/
2258     abcabcabcabc
2259     
2260 /^(a|b|c){12}/
2261     abcabcabcabc 
2262
2263 /^[abcdefghijklmnopqrstuvwxy0123456789]/
2264     n
2265 \= Expect no match 
2266     z 
2267
2268 /abcde{0,0}/
2269     abcd
2270 \= Expect no match
2271     abce  
2272
2273 /ab[cd]{0,0}e/
2274     abe
2275 \= Expect no match
2276     abcde 
2277     
2278 /ab(c){0,0}d/
2279     abd
2280 \= Expect no match
2281     abcd   
2282
2283 /a(b*)/
2284     a
2285     ab
2286     abbbb
2287 \= Expect no match
2288     bbbbb    
2289     
2290 /ab\d{0}e/
2291     abe
2292 \= Expect no match
2293     ab1e   
2294     
2295 /"([^\\"]+|\\.)*"/
2296     the \"quick\" brown fox
2297     \"the \\\"quick\\\" brown fox\" 
2298
2299 /.*?/g,aftertext
2300     abc
2301   
2302 /\b/g,aftertext
2303     abc 
2304
2305 /\b/g,aftertext
2306     abc 
2307
2308 //g
2309     abc
2310
2311 /<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
2312   <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>
2313
2314 /a[^a]b/
2315     acb
2316     a\nb
2317     
2318 /a.b/
2319     acb
2320 \= Expect no match 
2321     a\nb   
2322     
2323 /a[^a]b/s
2324     acb
2325     a\nb  
2326     
2327 /a.b/s
2328     acb
2329     a\nb  
2330
2331 /^(b+?|a){1,2}?c/
2332     bac
2333     bbac
2334     bbbac
2335     bbbbac
2336     bbbbbac 
2337
2338 /^(b+|a){1,2}?c/
2339     bac
2340     bbac
2341     bbbac
2342     bbbbac
2343     bbbbbac 
2344     
2345 /(?!\A)x/m
2346     a\bx\n  
2347 \= Expect no match
2348     x\nb\n
2349     
2350 /\x0{ab}/
2351     \0{ab} 
2352
2353 /(A|B)*?CD/
2354     CD 
2355     
2356 /(A|B)*CD/
2357     CD 
2358
2359 /(?<!bar)foo/
2360     foo
2361     catfood
2362     arfootle
2363     rfoosh
2364 \= Expect no match
2365     barfoo
2366     towbarfoo
2367
2368 /\w{3}(?<!bar)foo/
2369     catfood
2370 \= Expect no match
2371     foo
2372     barfoo
2373     towbarfoo
2374
2375 /(?<=(foo)a)bar/
2376     fooabar
2377 \= Expect no match
2378     bar
2379     foobbar
2380       
2381 /\Aabc\z/m
2382     abc
2383 \= Expect no match
2384     abc\n   
2385     qqq\nabc
2386     abc\nzzz
2387     qqq\nabc\nzzz
2388
2389 "(?>.*/)foo"
2390 \= Expect no match
2391     /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
2392
2393 "(?>.*/)foo"
2394     /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
2395
2396 /(?>(\.\d\d[1-9]?))\d+/
2397     1.230003938
2398     1.875000282
2399 \= Expect no match 
2400     1.235 
2401
2402 /^((?>\w+)|(?>\s+))*$/
2403     now is the time for all good men to come to the aid of the party
2404 \= Expect no match
2405     this is not a line with only words and spaces!
2406     
2407 /(\d+)(\w)/
2408     12345a
2409     12345+ 
2410
2411 /((?>\d+))(\w)/
2412     12345a
2413 \= Expect no match
2414     12345+ 
2415
2416 /(?>a+)b/
2417     aaab
2418
2419 /((?>a+)b)/
2420     aaab
2421
2422 /(?>(a+))b/
2423     aaab
2424
2425 /(?>b)+/
2426     aaabbbccc
2427
2428 /(?>a+|b+|c+)*c/
2429     aaabbbbccccd
2430     
2431 /(a+|b+|c+)*c/
2432     aaabbbbccccd
2433
2434 /((?>[^()]+)|\([^()]*\))+/
2435     ((abc(ade)ufh()()x
2436     
2437 /\(((?>[^()]+)|\([^()]+\))+\)/
2438     (abc)
2439     (abc(def)xyz)
2440 \= Expect no match
2441     ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa   
2442
2443 /a(?-i)b/i
2444     ab
2445     Ab
2446 \= Expect no match 
2447     aB
2448     AB
2449         
2450 /(a (?x)b c)d e/
2451     a bcd e
2452 \= Expect no match
2453     a b cd e
2454     abcd e   
2455     a bcde 
2456  
2457 /(a b(?x)c d (?-x)e f)/
2458     a bcde f
2459 \= Expect no match
2460     abcdef  
2461
2462 /(a(?i)b)c/
2463     abc
2464     aBc
2465 \= Expect no match
2466     abC
2467     aBC  
2468     Abc
2469     ABc
2470     ABC
2471     AbC
2472     
2473 /a(?i:b)c/
2474     abc
2475     aBc
2476 \= Expect no match 
2477     ABC
2478     abC
2479     aBC
2480     
2481 /a(?i:b)*c/
2482     aBc
2483     aBBc
2484 \= Expect no match 
2485     aBC
2486     aBBC
2487     
2488 /a(?=b(?i)c)\w\wd/
2489     abcd
2490     abCd
2491 \= Expect no match
2492     aBCd
2493     abcD     
2494     
2495 /(?s-i:more.*than).*million/i
2496     more than million
2497     more than MILLION
2498     more \n than Million 
2499 \= Expect no match
2500     MORE THAN MILLION    
2501     more \n than \n million 
2502
2503 /(?:(?s-i)more.*than).*million/i
2504     more than million
2505     more than MILLION
2506     more \n than Million 
2507 \= Expect no match
2508     MORE THAN MILLION    
2509     more \n than \n million 
2510     
2511 /(?>a(?i)b+)+c/
2512     abc
2513     aBbc
2514     aBBc 
2515 \= Expect no match
2516     Abc
2517     abAb    
2518     abbC 
2519     
2520 /(?=a(?i)b)\w\wc/
2521     abc
2522     aBc
2523 \= Expect no match
2524     Ab 
2525     abC
2526     aBC     
2527     
2528 /(?<=a(?i)b)(\w\w)c/
2529     abxxc
2530     aBxxc
2531 \= Expect no match
2532     Abxxc
2533     ABxxc
2534     abxxC      
2535
2536 /^(?(?=abc)\w{3}:|\d\d)$/
2537     abc:
2538     12
2539 \= Expect no match
2540     123
2541     xyz    
2542
2543 /^(?(?!abc)\d\d|\w{3}:)$/
2544     abc:
2545     12
2546 \= Expect no match
2547     123
2548     xyz    
2549     
2550 /(?(?<=foo)bar|cat)/
2551     foobar
2552     cat
2553     fcat
2554     focat   
2555 \= Expect no match
2556     foocat  
2557
2558 /(?(?<!foo)cat|bar)/
2559     foobar
2560     cat
2561     fcat
2562     focat   
2563 \= Expect no match
2564     foocat  
2565
2566 /(?>a*)*/
2567     a
2568     aa
2569     aaaa
2570     
2571 /(abc|)+/
2572     abc
2573     abcabc
2574     abcabcabc
2575     xyz      
2576
2577 /([a]*)*/
2578     a
2579     aaaaa 
2580  
2581 /([ab]*)*/
2582     a
2583     b
2584     ababab
2585     aaaabcde
2586     bbbb    
2587  
2588 /([^a]*)*/
2589     b
2590     bbbb
2591     aaa   
2592  
2593 /([^ab]*)*/
2594     cccc
2595     abab  
2596  
2597 /([a]*?)*/
2598     a
2599     aaaa 
2600  
2601 /([ab]*?)*/
2602     a
2603     b
2604     abab
2605     baba   
2606  
2607 /([^a]*?)*/
2608     b
2609     bbbb
2610     aaa   
2611  
2612 /([^ab]*?)*/
2613     c
2614     cccc
2615     baba   
2616  
2617 /(?>a*)*/
2618     a
2619     aaabcde 
2620  
2621 /((?>a*))*/
2622     aaaaa
2623     aabbaa 
2624  
2625 /((?>a*?))*/
2626     aaaaa
2627     aabbaa 
2628
2629 /(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
2630     12-sep-98
2631     12-09-98
2632 \= Expect no match
2633     sep-12-98
2634         
2635 /(?i:saturday|sunday)/
2636     saturday
2637     sunday
2638     Saturday
2639     Sunday
2640     SATURDAY
2641     SUNDAY
2642     SunDay
2643     
2644 /(a(?i)bc|BB)x/
2645     abcx
2646     aBCx
2647     bbx
2648     BBx
2649 \= Expect no match
2650     abcX
2651     aBCX
2652     bbX
2653     BBX               
2654
2655 /^([ab](?i)[cd]|[ef])/
2656     ac
2657     aC
2658     bD
2659     elephant
2660     Europe 
2661     frog
2662     France
2663 \= Expect no match
2664     Africa     
2665
2666 /^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
2667     ab
2668     aBd
2669     xy
2670     xY
2671     zebra
2672     Zambesi
2673 \= Expect no match
2674     aCD  
2675     XY  
2676
2677 /(?<=foo\n)^bar/m
2678     foo\nbar
2679 \= Expect no match
2680     bar
2681     baz\nbar   
2682
2683 /(?<=(?<!foo)bar)baz/
2684     barbaz
2685     barbarbaz 
2686     koobarbaz 
2687 \= Expect no match
2688     baz
2689     foobarbaz 
2690
2691 # The following tests are taken from the Perl 5.005 test suite; some of them
2692 # are compatible with 5.004, but I'd rather not have to sort them out.
2693
2694 /abc/
2695     abc
2696     xabcy
2697     ababc
2698 \= Expect no match
2699     xbc
2700     axc
2701     abx
2702
2703 /ab*c/
2704     abc
2705
2706 /ab*bc/
2707     abc
2708     abbc
2709     abbbbc
2710
2711 /.{1}/
2712     abbbbc
2713
2714 /.{3,4}/
2715     abbbbc
2716
2717 /ab{0,}bc/
2718     abbbbc
2719
2720 /ab+bc/
2721     abbc
2722 \= Expect no match
2723     abc
2724     abq
2725
2726 /ab+bc/
2727     abbbbc
2728
2729 /ab{1,}bc/
2730     abbbbc
2731
2732 /ab{1,3}bc/
2733     abbbbc
2734
2735 /ab{3,4}bc/
2736     abbbbc
2737
2738 /ab{4,5}bc/
2739 \= Expect no match
2740     abq
2741     abbbbc
2742
2743 /ab?bc/
2744     abbc
2745     abc
2746
2747 /ab{0,1}bc/
2748     abc
2749
2750 /ab?bc/
2751
2752 /ab?c/
2753     abc
2754
2755 /ab{0,1}c/
2756     abc
2757
2758 /^abc$/
2759     abc
2760 \= Expect no match
2761     abbbbc
2762     abcc
2763
2764 /^abc/
2765     abcc
2766
2767 /^abc$/
2768
2769 /abc$/
2770     aabc
2771     aabc
2772 \= Expect no match
2773     aabcd
2774
2775 /^/
2776     abc
2777
2778 /$/
2779     abc
2780
2781 /a.c/
2782     abc
2783     axc
2784
2785 /a.*c/
2786     axyzc
2787
2788 /a[bc]d/
2789     abd
2790 \= Expect no match
2791     axyzd
2792     abc
2793
2794 /a[b-d]e/
2795     ace
2796
2797 /a[b-d]/
2798     aac
2799
2800 /a[-b]/
2801     a-
2802
2803 /a[b-]/
2804     a-
2805
2806 /a]/
2807     a]
2808
2809 /a[]]b/
2810     a]b
2811
2812 /a[^bc]d/
2813     aed
2814 \= Expect no match
2815     abd
2816     abd
2817
2818 /a[^-b]c/
2819     adc
2820
2821 /a[^]b]c/
2822     adc
2823     a-c
2824 \= Expect no match
2825     a]c
2826
2827 /\ba\b/
2828     a-
2829     -a
2830     -a-
2831
2832 /\by\b/
2833 \= Expect no match
2834     xy
2835     yz
2836     xyz
2837
2838 /\Ba\B/
2839 \= Expect no match
2840     a-
2841     -a
2842     -a-
2843
2844 /\By\b/
2845     xy
2846
2847 /\by\B/
2848     yz
2849
2850 /\By\B/
2851     xyz
2852
2853 /\w/
2854     a
2855
2856 /\W/
2857     -
2858 \= Expect no match
2859     a
2860
2861 /a\sb/
2862     a b
2863
2864 /a\Sb/
2865     a-b
2866 \= Expect no match
2867     a b
2868
2869 /\d/
2870     1
2871
2872 /\D/
2873     -
2874 \= Expect no match
2875     1
2876
2877 /[\w]/
2878     a
2879
2880 /[\W]/
2881     -
2882 \= Expect no match
2883     a
2884
2885 /a[\s]b/
2886     a b
2887
2888 /a[\S]b/
2889     a-b
2890 \= Expect no match
2891     a b
2892
2893 /[\d]/
2894     1
2895
2896 /[\D]/
2897     -
2898 \= Expect no match
2899     1
2900
2901 /ab|cd/
2902     abc
2903     abcd
2904
2905 /()ef/
2906     def
2907
2908 /$b/
2909
2910 /a\(b/
2911     a(b
2912
2913 /a\(*b/
2914     ab
2915     a((b
2916
2917 /a\\b/
2918     a\\b
2919 \= Expect no match
2920     a\b
2921
2922 /((a))/
2923     abc
2924
2925 /(a)b(c)/
2926     abc
2927
2928 /a+b+c/
2929     aabbabc
2930
2931 /a{1,}b{1,}c/
2932     aabbabc
2933
2934 /a.+?c/
2935     abcabc
2936
2937 /(a+|b)*/
2938     ab
2939
2940 /(a+|b){0,}/
2941     ab
2942
2943 /(a+|b)+/
2944     ab
2945
2946 /(a+|b){1,}/
2947     ab
2948
2949 /(a+|b)?/
2950     ab
2951
2952 /(a+|b){0,1}/
2953     ab
2954
2955 /[^ab]*/
2956     cde
2957
2958 /abc/
2959 \= Expect no match
2960     b
2961
2962 /a*/
2963
2964 /([abc])*d/
2965     abbbcd
2966
2967 /([abc])*bcd/
2968     abcd
2969
2970 /a|b|c|d|e/
2971     e
2972
2973 /(a|b|c|d|e)f/
2974     ef
2975
2976 /abcd*efg/
2977     abcdefg
2978
2979 /ab*/
2980     xabyabbbz
2981     xayabbbz
2982
2983 /(ab|cd)e/
2984     abcde
2985
2986 /[abhgefdc]ij/
2987     hij
2988
2989 /^(ab|cd)e/
2990
2991 /(abc|)ef/
2992     abcdef
2993
2994 /(a|b)c*d/
2995     abcd
2996
2997 /(ab|ab*)bc/
2998     abc
2999
3000 /a([bc]*)c*/
3001     abc
3002
3003 /a([bc]*)(c*d)/
3004     abcd
3005
3006 /a([bc]+)(c*d)/
3007     abcd
3008
3009 /a([bc]*)(c+d)/
3010     abcd
3011
3012 /a[bcd]*dcdcde/
3013     adcdcde
3014
3015 /a[bcd]+dcdcde/
3016 \= Expect no match
3017     abcde
3018     adcdcde
3019
3020 /(ab|a)b*c/
3021     abc
3022
3023 /((a)(b)c)(d)/
3024     abcd
3025
3026 /[a-zA-Z_][a-zA-Z0-9_]*/
3027     alpha
3028
3029 /^a(bc+|b[eh])g|.h$/
3030     abh
3031
3032 /(bc+d$|ef*g.|h?i(j|k))/
3033     effgz
3034     ij
3035     reffgz
3036 \= Expect no match
3037     effg
3038     bcdd
3039
3040 /((((((((((a))))))))))/
3041     a
3042
3043 /(((((((((a)))))))))/
3044     a
3045
3046 /multiple words of text/
3047 \= Expect no match
3048     aa
3049     uh-uh
3050
3051 /multiple words/
3052     multiple words, yeah
3053
3054 /(.*)c(.*)/
3055     abcde
3056
3057 /\((.*), (.*)\)/
3058     (a, b)
3059
3060 /[k]/
3061
3062 /abcd/
3063     abcd
3064
3065 /a(bc)d/
3066     abcd
3067
3068 /a[-]?c/
3069     ac
3070
3071 /abc/i
3072     ABC
3073     XABCY
3074     ABABC
3075 \= Expect no match
3076     aaxabxbaxbbx
3077     XBC
3078     AXC
3079     ABX
3080
3081 /ab*c/i
3082     ABC
3083
3084 /ab*bc/i
3085     ABC
3086     ABBC
3087
3088 /ab*?bc/i
3089     ABBBBC
3090
3091 /ab{0,}?bc/i
3092     ABBBBC
3093
3094 /ab+?bc/i
3095     ABBC
3096
3097 /ab+bc/i
3098 \= Expect no match
3099     ABC
3100     ABQ
3101
3102 /ab{1,}bc/i
3103
3104 /ab+bc/i
3105     ABBBBC
3106
3107 /ab{1,}?bc/i
3108     ABBBBC
3109
3110 /ab{1,3}?bc/i
3111     ABBBBC
3112
3113 /ab{3,4}?bc/i
3114     ABBBBC
3115
3116 /ab{4,5}?bc/i
3117 \= Expect no match
3118     ABQ
3119     ABBBBC
3120
3121 /ab??bc/i
3122     ABBC
3123     ABC
3124
3125 /ab{0,1}?bc/i
3126     ABC
3127
3128 /ab??bc/i
3129
3130 /ab??c/i
3131     ABC
3132
3133 /ab{0,1}?c/i
3134     ABC
3135
3136 /^abc$/i
3137     ABC
3138 \= Expect no match
3139     ABBBBC
3140     ABCC
3141
3142 /^abc/i
3143     ABCC
3144
3145 /^abc$/i
3146
3147 /abc$/i
3148     AABC
3149
3150 /^/i
3151     ABC
3152
3153 /$/i
3154     ABC
3155
3156 /a.c/i
3157     ABC
3158     AXC
3159
3160 /a.*?c/i
3161     AXYZC
3162
3163 /a.*c/i
3164     AABC
3165 \= Expect no match
3166     AXYZD
3167
3168 /a[bc]d/i
3169     ABD
3170
3171 /a[b-d]e/i
3172     ACE
3173 \= Expect no match
3174     ABC
3175     ABD
3176
3177 /a[b-d]/i
3178     AAC
3179
3180 /a[-b]/i
3181     A-
3182
3183 /a[b-]/i
3184     A-
3185
3186 /a]/i
3187     A]
3188
3189 /a[]]b/i
3190     A]B
3191
3192 /a[^bc]d/i
3193     AED
3194
3195 /a[^-b]c/i
3196     ADC
3197 \= Expect no match
3198     ABD
3199     A-C
3200
3201 /a[^]b]c/i
3202     ADC
3203
3204 /ab|cd/i
3205     ABC
3206     ABCD
3207
3208 /()ef/i
3209     DEF
3210
3211 /$b/i
3212 \= Expect no match
3213     A]C
3214     B
3215
3216 /a\(b/i
3217     A(B
3218
3219 /a\(*b/i
3220     AB
3221     A((B
3222
3223 /a\\b/i
3224 \= Expect no match
3225     A\=notbol
3226
3227 /((a))/i
3228     ABC
3229
3230 /(a)b(c)/i
3231     ABC
3232
3233 /a+b+c/i
3234     AABBABC
3235
3236 /a{1,}b{1,}c/i
3237     AABBABC
3238
3239 /a.+?c/i
3240     ABCABC
3241
3242 /a.*?c/i
3243     ABCABC
3244
3245 /a.{0,5}?c/i
3246     ABCABC
3247
3248 /(a+|b)*/i
3249     AB
3250
3251 /(a+|b){0,}/i
3252     AB
3253
3254 /(a+|b)+/i
3255     AB
3256
3257 /(a+|b){1,}/i
3258     AB
3259
3260 /(a+|b)?/i
3261     AB
3262
3263 /(a+|b){0,1}/i
3264     AB
3265
3266 /(a+|b){0,1}?/i
3267     AB
3268
3269 /[^ab]*/i
3270     CDE
3271
3272 /abc/i
3273
3274 /a*/i
3275
3276 /([abc])*d/i
3277     ABBBCD
3278
3279 /([abc])*bcd/i
3280     ABCD
3281
3282 /a|b|c|d|e/i
3283     E
3284
3285 /(a|b|c|d|e)f/i
3286     EF
3287
3288 /abcd*efg/i
3289     ABCDEFG
3290
3291 /ab*/i
3292     XABYABBBZ
3293     XAYABBBZ
3294
3295 /(ab|cd)e/i
3296     ABCDE
3297
3298 /[abhgefdc]ij/i
3299     HIJ
3300
3301 /^(ab|cd)e/i
3302 \= Expect no match
3303     ABCDE
3304
3305 /(abc|)ef/i
3306     ABCDEF
3307
3308 /(a|b)c*d/i
3309     ABCD
3310
3311 /(ab|ab*)bc/i
3312     ABC
3313
3314 /a([bc]*)c*/i
3315     ABC
3316
3317 /a([bc]*)(c*d)/i
3318     ABCD
3319
3320 /a([bc]+)(c*d)/i
3321     ABCD
3322
3323 /a([bc]*)(c+d)/i
3324     ABCD
3325
3326 /a[bcd]*dcdcde/i
3327     ADCDCDE
3328
3329 /a[bcd]+dcdcde/i
3330
3331 /(ab|a)b*c/i
3332     ABC
3333
3334 /((a)(b)c)(d)/i
3335     ABCD
3336
3337 /[a-zA-Z_][a-zA-Z0-9_]*/i
3338     ALPHA
3339
3340 /^a(bc+|b[eh])g|.h$/i
3341     ABH
3342
3343 /(bc+d$|ef*g.|h?i(j|k))/i
3344     EFFGZ
3345     IJ
3346     REFFGZ
3347 \= Expect no match
3348     ADCDCDE
3349     EFFG
3350     BCDD
3351
3352 /((((((((((a))))))))))/i
3353     A
3354
3355 /(((((((((a)))))))))/i
3356     A
3357
3358 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
3359     A
3360
3361 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
3362     C
3363
3364 /multiple words of text/i
3365 \= Expect no match
3366     AA
3367     UH-UH
3368
3369 /multiple words/i
3370     MULTIPLE WORDS, YEAH
3371
3372 /(.*)c(.*)/i
3373     ABCDE
3374
3375 /\((.*), (.*)\)/i
3376     (A, B)
3377
3378 /[k]/i
3379
3380 /abcd/i
3381     ABCD
3382
3383 /a(bc)d/i
3384     ABCD
3385
3386 /a[-]?c/i
3387     AC
3388
3389 /a(?!b)./
3390     abad
3391
3392 /a(?=d)./
3393     abad
3394
3395 /a(?=c|d)./
3396     abad
3397
3398 /a(?:b|c|d)(.)/
3399     ace
3400
3401 /a(?:b|c|d)*(.)/
3402     ace
3403
3404 /a(?:b|c|d)+?(.)/
3405     ace
3406     acdbcdbe
3407
3408 /a(?:b|c|d)+(.)/
3409     acdbcdbe
3410
3411 /a(?:b|c|d){2}(.)/
3412     acdbcdbe
3413
3414 /a(?:b|c|d){4,5}(.)/
3415     acdbcdbe
3416
3417 /a(?:b|c|d){4,5}?(.)/
3418     acdbcdbe
3419
3420 /((foo)|(bar))*/
3421     foobar
3422
3423 /a(?:b|c|d){6,7}(.)/
3424     acdbcdbe
3425
3426 /a(?:b|c|d){6,7}?(.)/
3427     acdbcdbe
3428
3429 /a(?:b|c|d){5,6}(.)/
3430     acdbcdbe
3431
3432 /a(?:b|c|d){5,6}?(.)/
3433     acdbcdbe
3434
3435 /a(?:b|c|d){5,7}(.)/
3436     acdbcdbe
3437
3438 /a(?:b|c|d){5,7}?(.)/
3439     acdbcdbe
3440
3441 /a(?:b|(c|e){1,2}?|d)+?(.)/
3442     ace
3443
3444 /^(.+)?B/
3445     AB
3446
3447 /^([^a-z])|(\^)$/
3448     .
3449
3450 /^[<>]&/
3451     <&OUT
3452
3453 /(?:(f)(o)(o)|(b)(a)(r))*/
3454     foobar
3455
3456 /(?<=a)b/
3457     ab
3458 \= Expect no match
3459     cb
3460     b
3461
3462 /(?<!c)b/
3463     ab
3464     b
3465     b
3466
3467 /(?:..)*a/
3468     aba
3469
3470 /(?:..)*?a/
3471     aba
3472
3473 /^(){3,5}/
3474     abc
3475
3476 /^(a+)*ax/
3477     aax
3478
3479 /^((a|b)+)*ax/
3480     aax
3481
3482 /^((a|bc)+)*ax/
3483     aax
3484
3485 /(a|x)*ab/
3486     cab
3487
3488 /(a)*ab/
3489     cab
3490
3491 /(?:(?i)a)b/
3492     ab
3493
3494 /((?i)a)b/
3495     ab
3496
3497 /(?:(?i)a)b/
3498     Ab
3499
3500 /((?i)a)b/
3501     Ab
3502
3503 /(?:(?i)a)b/
3504 \= Expect no match
3505     cb
3506     aB
3507
3508 /((?i)a)b/
3509
3510 /(?i:a)b/
3511     ab
3512
3513 /((?i:a))b/
3514     ab
3515
3516 /(?i:a)b/
3517     Ab
3518
3519 /((?i:a))b/
3520     Ab
3521
3522 /(?i:a)b/
3523 \= Expect no match
3524     aB
3525     aB
3526
3527 /((?i:a))b/
3528
3529 /(?:(?-i)a)b/i
3530     ab
3531
3532 /((?-i)a)b/i
3533     ab
3534
3535 /(?:(?-i)a)b/i
3536     aB
3537
3538 /((?-i)a)b/i
3539     aB
3540
3541 /(?:(?-i)a)b/i
3542     aB
3543 \= Expect no match
3544     Ab
3545
3546 /((?-i)a)b/i
3547
3548 /(?:(?-i)a)b/i
3549     aB
3550
3551 /((?-i)a)b/i
3552     aB
3553
3554 /(?:(?-i)a)b/i
3555 \= Expect no match
3556     Ab
3557     AB
3558
3559 /((?-i)a)b/i
3560
3561 /(?-i:a)b/i
3562     ab
3563
3564 /((?-i:a))b/i
3565     ab
3566
3567 /(?-i:a)b/i
3568     aB
3569
3570 /((?-i:a))b/i
3571     aB
3572
3573 /(?-i:a)b/i
3574 \= Expect no match
3575     AB
3576     Ab
3577
3578 /((?-i:a))b/i
3579
3580 /(?-i:a)b/i
3581     aB
3582
3583 /((?-i:a))b/i
3584     aB
3585
3586 /(?-i:a)b/i
3587 \= Expect no match
3588     Ab
3589     AB
3590
3591 /((?-i:a))b/i
3592
3593 /((?-i:a.))b/i
3594 \= Expect no match
3595     AB
3596     a\nB
3597
3598 /((?s-i:a.))b/i
3599     a\nB
3600
3601 /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
3602     cabbbb
3603
3604 /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
3605     caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
3606
3607 /foo\w*\d{4}baz/
3608     foobar1234baz
3609
3610 /x(~~)*(?:(?:F)?)?/
3611     x~~
3612
3613 /^a(?#xxx){3}c/
3614     aaac
3615
3616 /^a (?#xxx) (?#yyy) {3}c/x
3617     aaac
3618
3619 /(?<![cd])b/
3620 \= Expect no match
3621     B\nB
3622     dbcb
3623
3624 /(?<![cd])[ab]/
3625     dbaacb
3626
3627 /(?<!(c|d))b/
3628
3629 /(?<!(c|d))[ab]/
3630     dbaacb
3631
3632 /(?<!cd)[ab]/
3633     cdaccb
3634
3635 /^(?:a?b?)*$/
3636 \= Expect no match
3637     dbcb
3638     a--
3639
3640 /((?s)^a(.))((?m)^b$)/
3641     a\nb\nc\n
3642
3643 /((?m)^b$)/
3644     a\nb\nc\n
3645
3646 /(?m)^b/
3647     a\nb\n
3648
3649 /(?m)^(b)/
3650     a\nb\n
3651
3652 /((?m)^b)/
3653     a\nb\n
3654
3655 /\n((?m)^b)/
3656     a\nb\n
3657
3658 /((?s).)c(?!.)/
3659     a\nb\nc\n
3660     a\nb\nc\n
3661
3662 /((?s)b.)c(?!.)/
3663     a\nb\nc\n
3664     a\nb\nc\n
3665
3666 /^b/
3667
3668 /()^b/
3669 \= Expect no match
3670     a\nb\nc\n
3671     a\nb\nc\n
3672
3673 /((?m)^b)/
3674     a\nb\nc\n
3675
3676 /(?(?!a)a|b)/
3677
3678 /(?(?!a)b|a)/
3679     a
3680
3681 /(?(?=a)b|a)/
3682 \= Expect no match
3683     a
3684     a
3685
3686 /(?(?=a)a|b)/
3687     a
3688
3689 /(\w+:)+/
3690     one:
3691
3692 /$(?<=^(a))/
3693     a
3694
3695 /([\w:]+::)?(\w+)$/
3696     abcd
3697     xy:z:::abcd
3698
3699 /^[^bcd]*(c+)/
3700     aexycd
3701
3702 /(a*)b+/
3703     caab
3704
3705 /([\w:]+::)?(\w+)$/
3706     abcd
3707     xy:z:::abcd
3708 \= Expect no match
3709     abcd:
3710     abcd:
3711
3712 /^[^bcd]*(c+)/
3713     aexycd
3714
3715 /(>a+)ab/
3716
3717 /(?>a+)b/
3718     aaab
3719
3720 /([[:]+)/
3721     a:[b]:
3722
3723 /([[=]+)/
3724     a=[b]=
3725
3726 /([[.]+)/
3727     a.[b].
3728
3729 /((?>a+)b)/
3730     aaab
3731
3732 /(?>(a+))b/
3733     aaab
3734
3735 /((?>[^()]+)|\([^()]*\))+/
3736     ((abc(ade)ufh()()x
3737
3738 /a\Z/
3739 \= Expect no match
3740     aaab
3741     a\nb\n
3742
3743 /b\Z/
3744     a\nb\n
3745
3746 /b\z/
3747
3748 /b\Z/
3749     a\nb
3750
3751 /b\z/
3752     a\nb
3753     
3754 /(?>.*)(?<=(abcd|wxyz))/
3755     alphabetabcd
3756     endingwxyz
3757 \= Expect no match
3758     a rather long string that doesn't end with one of them
3759
3760 /word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
3761     word cat dog elephant mussel cow horse canary baboon snake shark otherword
3762 \= Expect no match
3763     word cat dog elephant mussel cow horse canary baboon snake shark
3764   
3765 /word (?>[a-zA-Z0-9]+ ){0,30}otherword/
3766 \= Expect no match
3767     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
3768
3769 /(?<=\d{3}(?!999))foo/
3770     999foo
3771     123999foo 
3772 \= Expect no match
3773     123abcfoo
3774     
3775 /(?<=(?!...999)\d{3})foo/
3776     999foo
3777     123999foo 
3778 \= Expect no match
3779     123abcfoo
3780
3781 /(?<=\d{3}(?!999)...)foo/
3782     123abcfoo
3783     123456foo 
3784 \= Expect no match
3785     123999foo  
3786     
3787 /(?<=\d{3}...)(?<!999)foo/
3788     123abcfoo   
3789     123456foo 
3790 \= Expect no match
3791     123999foo  
3792
3793 /((Z)+|A)*/
3794     ZABCDEFG
3795
3796 /(Z()|A)*/
3797     ZABCDEFG
3798
3799 /(Z(())|A)*/
3800     ZABCDEFG
3801
3802 /((?>Z)+|A)*/
3803     ZABCDEFG
3804
3805 /((?>)+|A)*/
3806     ZABCDEFG
3807
3808 /a*/g
3809     abbab
3810
3811 /[[:space:]]+/
3812     > \x09\x0a\x0c\x0d\x0b<
3813      
3814 /[[:blank:]]+/
3815     > \x09\x0a\x0c\x0d\x0b<
3816      
3817 /[\s]+/
3818     > \x09\x0a\x0c\x0d\x0b<
3819      
3820 /\s+/
3821     > \x09\x0a\x0c\x0d\x0b<
3822      
3823 /a\vb/x
3824     ab
3825
3826 /(?!\A)x/m
3827   a\nxb\n
3828
3829 /(?!^)x/m
3830 \= Expect no match
3831     a\nxb\n
3832
3833 /abc\Qabc\Eabc/
3834     abcabcabc
3835     
3836 /abc\Q(*+|\Eabc/
3837     abc(*+|abc 
3838
3839 /   abc\Q abc\Eabc/x
3840     abc abcabc
3841 \= Expect no match
3842     abcabcabc  
3843     
3844 /abc#comment
3845     \Q#not comment
3846     literal\E/x
3847     abc#not comment\n    literal     
3848
3849 /abc#comment
3850     \Q#not comment
3851     literal/x
3852     abc#not comment\n    literal     
3853
3854 /abc#comment
3855     \Q#not comment
3856     literal\E #more comment
3857     /x
3858     abc#not comment\n    literal     
3859
3860 /abc#comment
3861     \Q#not comment
3862     literal\E #more comment/x
3863     abc#not comment\n    literal     
3864
3865 /\Qabc\$xyz\E/
3866     abc\\\$xyz
3867
3868 /\Qabc\E\$\Qxyz\E/
3869     abc\$xyz
3870
3871 /\Gabc/
3872     abc
3873 \= Expect no match
3874     xyzabc  
3875
3876 /\Gabc./g
3877     abc1abc2xyzabc3
3878
3879 /abc./g
3880     abc1abc2xyzabc3 
3881
3882 /a(?x: b c )d/
3883     XabcdY
3884 \= Expect no match 
3885     Xa b c d Y 
3886
3887 /((?x)x y z | a b c)/
3888     XabcY
3889     AxyzB 
3890
3891 /(?i)AB(?-i)C/
3892     XabCY
3893 \= Expect no match
3894     XabcY  
3895
3896 /((?i)AB(?-i)C|D)E/
3897     abCE
3898     DE
3899 \= Expect no match
3900     abcE
3901     abCe  
3902     dE
3903     De    
3904
3905 /[z\Qa-d]\E]/
3906     z
3907     a
3908     -
3909     d
3910     ] 
3911 \= Expect no match
3912     b     
3913
3914 /(a+)*b/
3915 \= Expect no match
3916     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
3917     
3918 /(?i)reg(?:ul(?:[aä]|ae)r|ex)/
3919     REGular
3920     regulaer
3921     Regex  
3922     regulär 
3923
3924 /Åæåä[à-ÿÀ-ß]+/
3925     Ã…æåäà
3926     Ã…æåäÿ
3927     Ã…æåäÀ
3928     Ã…æåäß
3929
3930 /(?<=Z)X./
3931     \x84XAZXB
3932
3933 /^(?(2)a|(1)(2))+$/
3934     123a
3935
3936 /(?<=a|bbbb)c/
3937     ac
3938     bbbbc
3939
3940 /line\nbreak/
3941     this is a line\nbreak
3942     line one\nthis is a line\nbreak in the second line 
3943
3944 /line\nbreak/firstline
3945     this is a line\nbreak
3946 \= Expect no match 
3947     line one\nthis is a line\nbreak in the second line 
3948
3949 /line\nbreak/m,firstline
3950     this is a line\nbreak
3951 \= Expect no match 
3952     line one\nthis is a line\nbreak in the second line 
3953
3954 /1234/
3955     123\=ps
3956 \= Expect no match 
3957     a4\=ps,dfa_restart
3958
3959 /1234/
3960     123\=ps
3961     4\=ps,dfa_restart
3962
3963 /^/gm
3964     a\nb\nc\n
3965     \ 
3966     
3967 /(?<=C\n)^/gm
3968     A\nC\nC\n 
3969
3970 /(?s)A?B/
3971     AB
3972     aB  
3973
3974 /(?s)A*B/
3975     AB
3976     aB  
3977
3978 /(?m)A?B/
3979     AB
3980     aB  
3981
3982 /(?m)A*B/
3983     AB
3984     aB  
3985
3986 /Content-Type\x3A[^\r\n]{6,}/
3987     Content-Type:xxxxxyyy 
3988
3989 /Content-Type\x3A[^\r\n]{6,}z/
3990     Content-Type:xxxxxyyyz
3991
3992 /Content-Type\x3A[^a]{6,}/
3993     Content-Type:xxxyyy 
3994
3995 /Content-Type\x3A[^a]{6,}z/
3996     Content-Type:xxxyyyz
3997
3998 /^abc/Im,newline=lf
3999     xyz\nabc
4000     xyz\r\nabc
4001 \= Expect no match
4002     xyz\rabc
4003     xyzabc\r
4004     xyzabc\rpqr
4005     xyzabc\r\n
4006     xyzabc\r\npqr
4007
4008 /^abc/Im,newline=crlf
4009     xyz\r\nabclf>
4010 \= Expect no match
4011     xyz\nabclf
4012     xyz\rabclf
4013     
4014 /^abc/Im,newline=cr
4015     xyz\rabc
4016 \= Expect no match
4017     xyz\nabc
4018     xyz\r\nabc
4019
4020 /.*/I,newline=lf
4021     abc\ndef
4022     abc\rdef
4023     abc\r\ndef
4024
4025 /.*/I,newline=cr
4026     abc\ndef
4027     abc\rdef
4028     abc\r\ndef
4029
4030 /.*/I,newline=crlf
4031     abc\ndef
4032     abc\rdef
4033     abc\r\ndef
4034
4035 /\w+(.)(.)?def/Is
4036     abc\ndef
4037     abc\rdef
4038     abc\r\ndef
4039
4040 /\w+(.)(.)?def/s
4041     abc\ndef
4042     abc\rdef
4043     abc\r\ndef
4044
4045 /^\w+=.*(\\\n.*)*/
4046     abc=xyz\\\npqr
4047
4048 /^(a()*)*/
4049     aaaa
4050
4051 /^(?:a(?:(?:))*)*/
4052     aaaa
4053
4054 /^(a()+)+/
4055     aaaa
4056
4057 /^(?:a(?:(?:))+)+/
4058     aaaa
4059
4060 /(a|)*\d/
4061   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
4062 \= Expect no match
4063   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4064
4065 /(?>a|)*\d/
4066   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
4067 \= Expect no match
4068   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4069
4070 /(?:a|)*\d/
4071   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
4072 \= Expect no match
4073   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4074
4075 /^a.b/newline=lf
4076     a\rb
4077 \= Expect no match
4078     a\nb
4079
4080 /^a.b/newline=cr
4081     a\nb
4082 \= Expect no match
4083     a\rb
4084
4085 /^a.b/newline=anycrlf
4086     a\x85b
4087 \= Expect no match
4088     a\rb
4089
4090 /^a.b/newline=any
4091 \= Expect no match
4092     a\nb
4093     a\rb
4094     a\x85b
4095
4096 /^abc./gmx,newline=any
4097     abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
4098
4099 /abc.$/gmx,newline=any
4100     abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
4101
4102 /^a\Rb/bsr=unicode
4103     a\nb
4104     a\rb
4105     a\r\nb
4106     a\x0bb
4107     a\x0cb
4108     a\x85b   
4109 \= Expect no match
4110     a\n\rb    
4111
4112 /^a\R*b/bsr=unicode
4113     ab
4114     a\nb
4115     a\rb
4116     a\r\nb
4117     a\x0bb
4118     a\x0cb
4119     a\x85b   
4120     a\n\rb    
4121     a\n\r\x85\x0cb 
4122
4123 /^a\R+b/bsr=unicode
4124     a\nb
4125     a\rb
4126     a\r\nb
4127     a\x0bb
4128     a\x0cb
4129     a\x85b   
4130     a\n\rb    
4131     a\n\r\x85\x0cb 
4132 \= Expect no match
4133     ab  
4134     
4135 /^a\R{1,3}b/bsr=unicode
4136     a\nb
4137     a\n\rb
4138     a\n\r\x85b
4139     a\r\n\r\nb 
4140     a\r\n\r\n\r\nb 
4141     a\n\r\n\rb
4142     a\n\n\r\nb 
4143 \= Expect no match
4144     a\n\n\n\rb
4145     a\r
4146
4147 /.+foo/
4148     afoo
4149 \= Expect no match 
4150     \r\nfoo 
4151     \nfoo 
4152
4153 /.+foo/newline=crlf
4154     afoo
4155     \nfoo 
4156 \= Expect no match 
4157     \r\nfoo 
4158
4159 /.+foo/newline=any
4160     afoo
4161 \= Expect no match 
4162     \nfoo 
4163     \r\nfoo 
4164
4165 /.+foo/s
4166     afoo
4167     \r\nfoo 
4168     \nfoo 
4169
4170 /^$/gm,newline=any
4171     abc\r\rxyz
4172     abc\n\rxyz  
4173 \= Expect no match 
4174     abc\r\nxyz
4175
4176 /^X/m
4177     XABC
4178 \= Expect no match 
4179     XABC\=notbol
4180
4181 /(?m)^$/g,newline=any,aftertext
4182     abc\r\n\r\n
4183
4184 /(?m)^$|^\r\n/g,newline=any,aftertext
4185     abc\r\n\r\n
4186     
4187 /(?m)$/g,newline=any,aftertext
4188     abc\r\n\r\n
4189
4190 /(?|(abc)|(xyz))/
4191    >abc<
4192    >xyz< 
4193
4194 /(x)(?|(abc)|(xyz))(x)/
4195     xabcx
4196     xxyzx 
4197
4198 /(x)(?|(abc)(pqr)|(xyz))(x)/
4199     xabcpqrx
4200     xxyzx 
4201
4202 /(?|(abc)|(xyz))(?1)/
4203     abcabc
4204     xyzabc 
4205 \= Expect no match 
4206     xyzxyz 
4207  
4208 /\H\h\V\v/
4209     X X\x0a
4210     X\x09X\x0b
4211 \= Expect no match
4212     \xa0 X\x0a   
4213     
4214 /\H*\h+\V?\v{3,4}/
4215     \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
4216     \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
4217     \x09\x20\xa0\x0a\x0b\x0c
4218 \= Expect no match 
4219     \x09\x20\xa0\x0a\x0b
4220      
4221 /\H{3,4}/
4222     XY  ABCDE
4223     XY  PQR ST 
4224     
4225 /.\h{3,4}./
4226     XY  AB    PQRS
4227
4228 /\h*X\h?\H+Y\H?Z/
4229     >XNNNYZ
4230     >  X NYQZ
4231 \= Expect no match
4232     >XYZ   
4233     >  X NY Z
4234
4235 /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
4236     >XY\x0aZ\x0aA\x0bNN\x0c
4237     >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
4238
4239 /.+A/newline=crlf
4240 \= Expect no match
4241     \r\nA
4242     
4243 /\nA/newline=crlf
4244     \r\nA 
4245
4246 /[\r\n]A/newline=crlf
4247     \r\nA 
4248
4249 /(\r|\n)A/newline=crlf
4250     \r\nA 
4251
4252 /a\Rb/I,bsr=anycrlf
4253     a\rb
4254     a\nb
4255     a\r\nb
4256 \= Expect no match
4257     a\x85b
4258     a\x0bb     
4259
4260 /a\Rb/I,bsr=unicode
4261     a\rb
4262     a\nb
4263     a\r\nb
4264     a\x85b
4265     a\x0bb     
4266     
4267 /a\R?b/I,bsr=anycrlf
4268     a\rb
4269     a\nb
4270     a\r\nb
4271 \= Expect no match
4272     a\x85b
4273     a\x0bb     
4274
4275 /a\R?b/I,bsr=unicode
4276     a\rb
4277     a\nb
4278     a\r\nb
4279     a\x85b
4280     a\x0bb     
4281     
4282 /a\R{2,4}b/I,bsr=anycrlf
4283     a\r\n\nb
4284     a\n\r\rb
4285     a\r\n\r\n\r\n\r\nb
4286 \= Expect no match
4287     a\x0b\x0bb     
4288     a\x85\x85b
4289
4290 /a\R{2,4}b/I,bsr=unicode
4291     a\r\rb
4292     a\n\n\nb
4293     a\r\n\n\r\rb
4294     a\x85\x85b
4295     a\x0b\x0bb     
4296 \= Expect no match 
4297     a\r\r\r\r\rb 
4298     
4299 /a(?!)|\wbc/
4300     abc 
4301
4302 /a[]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
4303 \= Expect no match
4304     ab
4305
4306 /a[]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
4307 \= Expect no match
4308     ab 
4309
4310 /a[]*+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
4311 \= Expect no match
4312     ab 
4313
4314 /a[^]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
4315     aXb
4316     a\nb 
4317 \= Expect no match
4318     ab  
4319     
4320 /a[^]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
4321     aXb
4322     a\nX\nXb 
4323 \= Expect no match
4324     ab  
4325
4326 /X$/dollar_endonly
4327     X
4328 \= Expect no match 
4329     X\n 
4330
4331 /X$/
4332     X
4333     X\n 
4334
4335 /xyz/auto_callout
4336   xyz 
4337   abcxyz 
4338 \= Expect no match 
4339   abc
4340   abcxypqr  
4341
4342 /xyz/auto_callout,no_start_optimize
4343   abcxyz 
4344 \= Expect no match 
4345   abc
4346   abcxypqr  
4347
4348 /(*NO_START_OPT)xyz/auto_callout
4349   abcxyz 
4350   
4351 /(?C)ab/
4352   ab
4353   ab\=callout_none
4354   
4355 /ab/auto_callout
4356   ab
4357   ab\=callout_none
4358
4359 /^"((?(?=[a])[^"])|b)*"$/auto_callout
4360     "ab"
4361     "ab"\=callout_none
4362
4363 /\d+X|9+Y/
4364     ++++123999\=ps
4365     ++++123999Y\=ps
4366
4367 /Z(*F)/
4368 \= Expect no match 
4369     Z\=ps
4370     ZA\=ps
4371     
4372 /Z(?!)/
4373 \= Expect no match 
4374     Z\=ps
4375     ZA\=ps
4376
4377 /dog(sbody)?/
4378     dogs\=ps
4379     dogs\=ph
4380     
4381 /dog(sbody)??/
4382     dogs\=ps
4383     dogs\=ph
4384
4385 /dog|dogsbody/
4386     dogs\=ps
4387     dogs\=ph
4388  
4389 /dogsbody|dog/
4390     dogs\=ps
4391     dogs\=ph
4392
4393 /Z(*F)Q|ZXY/
4394     Z\=ps
4395 \= Expect no match 
4396     ZA\=ps
4397     X\=ps
4398
4399 /\bthe cat\b/
4400     the cat\=ps
4401     the cat\=ph
4402
4403 /dog(sbody)?/
4404     dogs\=ps
4405     body\=dfa_restart
4406
4407 /dog(sbody)?/
4408     dogs\=ph
4409     body\=dfa_restart
4410
4411 /abc/
4412    abc\=ps
4413    abc\=ph
4414
4415 /abc\K123/
4416     xyzabc123pqr
4417     
4418 /(?<=abc)123/
4419     xyzabc123pqr 
4420     xyzabc12\=ps
4421     xyzabc12\=ph
4422
4423 /\babc\b/
4424     +++abc+++
4425     +++ab\=ps
4426     +++ab\=ph
4427
4428 /(?=C)/g,aftertext
4429     ABCDECBA
4430
4431 /(abc|def|xyz)/I
4432     terhjk;abcdaadsfe
4433     the quick xyz brown fox 
4434 \= Expect no match
4435     thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
4436
4437 /(abc|def|xyz)/I,no_start_optimize
4438     terhjk;abcdaadsfe
4439     the quick xyz brown fox
4440 \= Expect no match
4441     thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
4442
4443 /abcd*/aftertext
4444     xxxxabcd\=ps
4445     xxxxabcd\=ph
4446     dddxxx\=dfa_restart
4447     xxxxabcd\=ph
4448     xxx\=dfa_restart
4449
4450 /abcd*/i
4451     xxxxabcd\=ps
4452     xxxxabcd\=ph
4453     XXXXABCD\=ps
4454     XXXXABCD\=ph
4455
4456 /abc\d*/
4457     xxxxabc1\=ps
4458     xxxxabc1\=ph
4459
4460 /abc[de]*/
4461     xxxxabcde\=ps
4462     xxxxabcde\=ph
4463
4464 /(?:(?1)|B)(A(*F)|C)/
4465     ABCD
4466     CCD
4467 \= Expect no match
4468     CAD   
4469
4470 /^(?:(?1)|B)(A(*F)|C)/
4471     CCD
4472     BCD 
4473 \= Expect no match
4474     ABCD
4475     CAD
4476     BAD    
4477
4478 /^(?!a(*SKIP)b)/
4479     ac
4480     
4481 /^(?=a(*SKIP)b|ac)/
4482     ac
4483     
4484 /^(?=a(*THEN)b|ac)/
4485     ac
4486     
4487 /^(?=a(*PRUNE)b)/
4488     ab  
4489
4490 /^(?(?!a(*SKIP)b))/
4491     ac
4492
4493 /(?<=abc)def/
4494     abc\=ph
4495
4496 /abc$/
4497     abc
4498     abc\=ps
4499     abc\=ph
4500
4501 /abc$/m
4502     abc
4503     abc\n
4504     abc\=ph
4505     abc\n\=ph
4506     abc\=ps
4507     abc\n\=ps
4508
4509 /abc\z/
4510     abc
4511     abc\=ps
4512     abc\=ph
4513
4514 /abc\Z/
4515     abc
4516     abc\=ps
4517     abc\=ph
4518
4519 /abc\b/
4520     abc
4521     abc\=ps
4522     abc\=ph
4523
4524 /abc\B/
4525     abc\=ps
4526     abc\=ph
4527 \= Expect no match 
4528     abc
4529
4530 /.+/
4531     abc\=offset=0
4532     abc\=offset=1
4533     abc\=offset=2
4534 \= Bad offsets
4535     abc\=offset=4
4536     abc\=offset=-4 
4537 \= Expect no match 
4538     abc\=offset=3
4539
4540 /^(?:a)++\w/
4541      aaaab
4542 \= Expect no match 
4543      aaaa 
4544      bbb 
4545
4546 /^(?:aa|(?:a)++\w)/
4547      aaaab
4548      aaaa 
4549 \= Expect no match 
4550      bbb 
4551
4552 /^(?:a)*+\w/
4553      aaaab
4554      bbb 
4555 \= Expect no match 
4556      aaaa 
4557
4558 /^(a)++\w/
4559      aaaab
4560 \= Expect no match 
4561      aaaa 
4562      bbb 
4563
4564 /^(a|)++\w/
4565      aaaab
4566 \= Expect no match 
4567      aaaa 
4568      bbb 
4569
4570 /(?=abc){3}abc/aftertext
4571     abcabcabc
4572 \= Expect no match
4573     xyz  
4574     
4575 /(?=abc)+abc/aftertext
4576     abcabcabc
4577 \= Expect no match
4578     xyz  
4579     
4580 /(?=abc)++abc/aftertext
4581     abcabcabc
4582 \= Expect no match
4583     xyz  
4584     
4585 /(?=abc){0}xyz/
4586     xyz 
4587
4588 /(?=abc){1}xyz/
4589 \= Expect no match
4590     xyz 
4591     
4592 /(?=(a))?./
4593     ab
4594     bc
4595       
4596 /(?=(a))??./
4597     ab
4598     bc
4599
4600 /^(?=(a)){0}b(?1)/
4601     backgammon
4602
4603 /^(?=(?1))?[az]([abc])d/
4604     abd 
4605     zcdxx 
4606
4607 /^(?!a){0}\w+/
4608     aaaaa
4609
4610 /(?<=(abc))?xyz/
4611     abcxyz
4612     pqrxyz 
4613
4614 /((?2))((?1))/
4615     abc
4616
4617 /(?(R)a+|(?R)b)/
4618     aaaabcde
4619
4620 /(?(R)a+|((?R))b)/
4621     aaaabcde
4622
4623 /((?(R)a+|(?1)b))/
4624     aaaabcde
4625
4626 /((?(R2)a+|(?1)b))()/
4627     aaaabcde
4628
4629 /(?(R)a*(?1)|((?R))b)/
4630     aaaabcde
4631
4632 /(a+)/no_auto_possess
4633     aaaa\=ovector=3
4634     aaaa\=ovector=4
4635
4636 /^\R/
4637     \r\=ps
4638     \r\=ph
4639     
4640 /^\R{2,3}x/
4641     \r\=ps
4642     \r\=ph
4643     \r\r\=ps
4644     \r\r\=ph
4645     \r\r\r\=ps
4646     \r\r\r\=ph
4647     \r\rx
4648     \r\r\rx    
4649
4650 /^\R{2,3}?x/
4651     \r\=ps
4652     \r\=ph
4653     \r\r\=ps
4654     \r\r\=ph
4655     \r\r\r\=ps
4656     \r\r\r\=ph
4657     \r\rx
4658     \r\r\rx    
4659     
4660 /^\R?x/
4661     \r\=ps
4662     \r\=ph
4663     x
4664     \rx  
4665
4666 /^\R+x/
4667     \r\=ps
4668     \r\=ph
4669     \r\n\=ps
4670     \r\n\=ph
4671     \rx  
4672
4673 /^a$/newline=crlf
4674     a\r\=ps
4675     a\r\=ph
4676
4677 /^a$/m,newline=crlf
4678     a\r\=ps
4679     a\r\=ph
4680
4681 /^(a$|a\r)/newline=crlf
4682     a\r\=ps
4683     a\r\=ph
4684
4685 /^(a$|a\r)/m,newline=crlf
4686     a\r\=ps
4687     a\r\=ph
4688
4689 /./newline=crlf
4690     \r\=ps
4691     \r\=ph
4692   
4693 /.{2,3}/newline=crlf
4694     \r\=ps
4695     \r\=ph
4696     \r\r\=ps
4697     \r\r\=ph
4698     \r\r\r\=ps
4699     \r\r\r\=ph
4700
4701 /.{2,3}?/newline=crlf
4702     \r\=ps
4703     \r\=ph
4704     \r\r\=ps
4705     \r\r\=ph
4706     \r\r\r\=ps
4707     \r\r\r\=ph
4708
4709 # Test simple validity check for restarts 
4710
4711 /abcdef/
4712    abc\=dfa_restart
4713
4714 /<H((?(?!<H|F>)(.)|(?R))++)*F>/
4715     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.
4716
4717 /^(?>.{4})abc|^\w\w.xabcd/
4718     xxxxabcd
4719     xx\xa0xabcd 
4720
4721 /^(.{4}){2}+abc|^\w\w.x\w\w\w\wabcd/
4722     xxxxxxxxabcd
4723     xx\xa0xxxxxabcd 
4724
4725 /abcd/
4726     abcd\=ovector=0
4727
4728 # These tests show up auto-possessification 
4729
4730 /[ab]*/
4731     aaaa
4732     
4733 /[ab]*?/
4734     aaaa
4735     
4736 /[ab]?/
4737     aaaa
4738     
4739 /[ab]??/
4740     aaaa
4741     
4742 /[ab]+/
4743     aaaa
4744     
4745 /[ab]+?/
4746     aaaa
4747     
4748 /[ab]{2,3}/
4749     aaaa
4750     
4751 /[ab]{2,3}?/
4752     aaaa
4753     
4754 /[ab]{2,}/
4755     aaaa    
4756
4757 /[ab]{2,}?/
4758     aaaa    
4759
4760 '\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++'
4761     NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
4762
4763 '\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
4764     NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
4765
4766 /abc(?=xyz)/allusedtext
4767     abcxyzpqr
4768     abcxyzpqr\=aftertext
4769     
4770 /(?<=pqr)abc(?=xyz)/allusedtext
4771     xyzpqrabcxyzpqr
4772     xyzpqrabcxyzpqr\=aftertext
4773     
4774 /a\b/
4775     a.\=allusedtext
4776     a\=allusedtext  
4777
4778 /abc(?=abcde)(?=ab)/allusedtext
4779     abcabcdefg
4780
4781 /a*?b*?/
4782     ab
4783
4784 /(*NOTEMPTY)a*?b*?/
4785     ab
4786     ba
4787     cb  
4788
4789 /(*NOTEMPTY_ATSTART)a*?b*?/aftertext
4790     ab
4791     cdab 
4792
4793 /(a)(b)|(c)/
4794     XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
4795
4796 /(?<A>aa)/
4797     aa\=get=A
4798     aa\=copy=A 
4799
4800 /a+/no_auto_possess
4801     a\=ovector=2,get=1,get=2,getall
4802     aaa\=ovector=2,get=1,get=2,getall
4803
4804 /a(b)c(d)/
4805     abc\=ph,copy=0,copy=1,getall
4806
4807 /ab(?C" any text with spaces ")cde/B
4808     abcde
4809     12abcde
4810
4811 /^a(b)c(?C1)def/
4812       abcdef
4813
4814 /^a(b)c(?C"AB")def/
4815       abcdef
4816
4817 /^a(b)c(?C1)def/
4818       abcdef\=callout_capture
4819
4820 /^a(b)c(?C{AB})def/B
4821       abcdef\=callout_capture
4822
4823 /^(?(?C25)(?=abc)abcd|xyz)/B
4824     abcdefg
4825     xyz123 
4826
4827 /^(?(?C$abc$)(?=abc)abcd|xyz)/B
4828     abcdefg
4829     xyz123 
4830
4831 /^ab(?C'first')cd(?C"second")ef/
4832     abcdefg
4833
4834 /(?:a(?C`code`)){3}X/
4835     aaaXY
4836
4837 # Binary zero in callout string
4838 /"a(?C'x" 00 "z')b"/hex
4839     abcdefgh
4840
4841 /(?(?!)a|b)/
4842     bbb
4843 \= Expect no match
4844     aaa 
4845
4846 /^/gm
4847     \n\n\n
4848
4849 /^/gm,alt_circumflex
4850     \n\n\n
4851
4852 /abc/use_offset_limit
4853     1234abcde\=offset_limit=100
4854     1234abcde\=offset_limit=9
4855     1234abcde\=offset_limit=4
4856     1234abcde\=offset_limit=4,offset=4
4857 \= Expect no match
4858     1234abcde\=offset_limit=4,offset=5
4859     1234abcde\=offset_limit=3
4860
4861 /(?<=abc)/use_offset_limit
4862     1234abc\=offset_limit=7
4863 \= Expect no match
4864     1234abc\=offset_limit=6
4865
4866 /abcd/null_context
4867     abcd\=null_context
4868
4869 /()()a+/no_auto_possess
4870     aaa\=allcaptures
4871     a\=allcaptures
4872
4873 /(*LIMIT_DEPTH=100)^((.)(?1)|.)$/
4874 \= Expect depth limit exceeded
4875     a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
4876
4877 /(*LIMIT_HEAP=0)^((.)(?1)|.)$/
4878 \= Expect heap limit exceeded
4879     a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
4880
4881 /(*LIMIT_HEAP=50000)^((.)(?1)|.)$/
4882 \= Expect success
4883     a[00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]
4884
4885 /(02-)?[0-9]{3}-[0-9]{3}/
4886     02-123-123
4887
4888 /^(a(?2))(b)(?1)/
4889     abbab\=find_limits 
4890
4891 /abc/endanchored
4892     xyzabc
4893 \= Expect no match
4894     xyzabcdef
4895 \= Expect error
4896     xyzabc\=ph
4897
4898 /abc/
4899     xyzabc\=endanchored
4900 \= Expect no match
4901     xyzabcdef\=endanchored
4902 \= Expect error
4903     xyzabc\=ps,endanchored
4904
4905 /abc|bcd/endanchored
4906     xyzabcd
4907 \= Expect no match
4908     xyzabcdef
4909
4910 /(*NUL)^.*/
4911     a\nb\x00ccc
4912     
4913 /(*NUL)^.*/s
4914     a\nb\x00ccc
4915     
4916 /^x/m,newline=nul
4917     ab\x00xy
4918     
4919 /'#comment' 0d 0a 00 '^x\' 0a 'y'/x,newline=nul,hex
4920     x\nyz 
4921  
4922 /(*NUL)^X\NY/
4923     X\nY
4924     X\rY
4925 \= Expect no match
4926     X\x00Y      
4927
4928 /(?<=abc|)/
4929     abcde\=aftertext
4930     
4931 /(?<=|abc)/ 
4932     abcde\=aftertext
4933
4934 /(?<=abc|)/endanchored
4935     abcde\=aftertext
4936     
4937 /(?<=|abc)/endanchored
4938     abcde\=aftertext
4939
4940 /(*LIMIT_MATCH=100).*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00\v\x00\x00\x00\19H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\13\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););/no_dotstar_anchor
4941 \= Expect limit exceeded
4942 .*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00\v\x00\x00\x00\19H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\13\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););
4943
4944 /\n/firstline
4945     xyz\nabc
4946
4947 /\nabc/firstline
4948     xyz\nabc
4949
4950 /\x{0a}abc/firstline,newline=crlf
4951 \= Expect no match
4952     xyz\r\nabc
4953
4954 /[abc]/firstline
4955 \= Expect no match
4956     \na
4957     
4958 # End of testinput6