/[pcre]/code/trunk/testdata/testoutput7
ViewVC logotype

Contents of /code/trunk/testdata/testoutput7

Parent Directory Parent Directory | Revision Log Revision Log


Revision 463 - (hide annotations) (download)
Sun Oct 18 10:02:46 2009 UTC (3 years, 7 months ago) by ph10
File size: 116990 byte(s)
Further tidies to partial matching.

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