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