source: code/trunk/vendor/github.com/dlclark/regexp2/testoutput1@ 67

Last change on this file since 67 was 67, checked in by Izuru Yakumo, 23 months ago

Use vendored modules

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 105.8 KB
Line 
1# This set of tests is for features that are compatible with all versions of
2# Perl >= 5.10, in non-UTF mode. It should run clean for the 8-bit, 16-bit, and
3# 32-bit PCRE libraries, and also using the perltest.pl script.
4
5#forbid_utf
6#newline_default lf any anycrlf
7#perltest
8
9/the quick brown fox/
10 the quick brown fox
11 0: the quick brown fox
12 What do you know about the quick brown fox?
13 0: the quick brown fox
14\= Expect no match
15 The quick brown FOX
16No match
17 What do you know about THE QUICK BROWN FOX?
18No match
19
20/The quick brown fox/i
21 the quick brown fox
22 0: the quick brown fox
23 The quick brown FOX
24 0: The quick brown FOX
25 What do you know about the quick brown fox?
26 0: the quick brown fox
27 What do you know about THE QUICK BROWN FOX?
28 0: THE QUICK BROWN FOX
29
30/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
31 abcd\t\n\r\f\a\e9;\$\\?caxyz
32 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz
33
34/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
35 abxyzpqrrrabbxyyyypqAzz
36 0: abxyzpqrrrabbxyyyypqAzz
37 abxyzpqrrrabbxyyyypqAzz
38 0: abxyzpqrrrabbxyyyypqAzz
39 aabxyzpqrrrabbxyyyypqAzz
40 0: aabxyzpqrrrabbxyyyypqAzz
41 aaabxyzpqrrrabbxyyyypqAzz
42 0: aaabxyzpqrrrabbxyyyypqAzz
43 aaaabxyzpqrrrabbxyyyypqAzz
44 0: aaaabxyzpqrrrabbxyyyypqAzz
45 abcxyzpqrrrabbxyyyypqAzz
46 0: abcxyzpqrrrabbxyyyypqAzz
47 aabcxyzpqrrrabbxyyyypqAzz
48 0: aabcxyzpqrrrabbxyyyypqAzz
49 aaabcxyzpqrrrabbxyyyypAzz
50 0: aaabcxyzpqrrrabbxyyyypAzz
51 aaabcxyzpqrrrabbxyyyypqAzz
52 0: aaabcxyzpqrrrabbxyyyypqAzz
53 aaabcxyzpqrrrabbxyyyypqqAzz
54 0: aaabcxyzpqrrrabbxyyyypqqAzz
55 aaabcxyzpqrrrabbxyyyypqqqAzz
56 0: aaabcxyzpqrrrabbxyyyypqqqAzz
57 aaabcxyzpqrrrabbxyyyypqqqqAzz
58 0: aaabcxyzpqrrrabbxyyyypqqqqAzz
59 aaabcxyzpqrrrabbxyyyypqqqqqAzz
60 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz
61 aaabcxyzpqrrrabbxyyyypqqqqqqAzz
62 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz
63 aaaabcxyzpqrrrabbxyyyypqAzz
64 0: aaaabcxyzpqrrrabbxyyyypqAzz
65 abxyzzpqrrrabbxyyyypqAzz
66 0: abxyzzpqrrrabbxyyyypqAzz
67 aabxyzzzpqrrrabbxyyyypqAzz
68 0: aabxyzzzpqrrrabbxyyyypqAzz
69 aaabxyzzzzpqrrrabbxyyyypqAzz
70 0: aaabxyzzzzpqrrrabbxyyyypqAzz
71 aaaabxyzzzzpqrrrabbxyyyypqAzz
72 0: aaaabxyzzzzpqrrrabbxyyyypqAzz
73 abcxyzzpqrrrabbxyyyypqAzz
74 0: abcxyzzpqrrrabbxyyyypqAzz
75 aabcxyzzzpqrrrabbxyyyypqAzz
76 0: aabcxyzzzpqrrrabbxyyyypqAzz
77 aaabcxyzzzzpqrrrabbxyyyypqAzz
78 0: aaabcxyzzzzpqrrrabbxyyyypqAzz
79 aaaabcxyzzzzpqrrrabbxyyyypqAzz
80 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz
81 aaaabcxyzzzzpqrrrabbbxyyyypqAzz
82 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz
83 aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
84 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
85 aaabcxyzpqrrrabbxyyyypABzz
86 0: aaabcxyzpqrrrabbxyyyypABzz
87 aaabcxyzpqrrrabbxyyyypABBzz
88 0: aaabcxyzpqrrrabbxyyyypABBzz
89 >>>aaabxyzpqrrrabbxyyyypqAzz
90 0: aaabxyzpqrrrabbxyyyypqAzz
91 >aaaabxyzpqrrrabbxyyyypqAzz
92 0: aaaabxyzpqrrrabbxyyyypqAzz
93 >>>>abcxyzpqrrrabbxyyyypqAzz
94 0: abcxyzpqrrrabbxyyyypqAzz
95\= Expect no match
96 abxyzpqrrabbxyyyypqAzz
97No match
98 abxyzpqrrrrabbxyyyypqAzz
99No match
100 abxyzpqrrrabxyyyypqAzz
101No match
102 aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
103No match
104 aaaabcxyzzzzpqrrrabbbxyyypqAzz
105No match
106 aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
107No match
108
109/^(abc){1,2}zz/
110 abczz
111 0: abczz
112 1: abc
113 abcabczz
114 0: abcabczz
115 1: abc
116\= Expect no match
117 zz
118No match
119 abcabcabczz
120No match
121 >>abczz
122No match
123
124/^(b+?|a){1,2}?c/
125 bc
126 0: bc
127 1: b
128 bbc
129 0: bbc
130 1: b
131 bbbc
132 0: bbbc
133 1: bb
134 bac
135 0: bac
136 1: a
137 bbac
138 0: bbac
139 1: a
140 aac
141 0: aac
142 1: a
143 abbbbbbbbbbbc
144 0: abbbbbbbbbbbc
145 1: bbbbbbbbbbb
146 bbbbbbbbbbbac
147 0: bbbbbbbbbbbac
148 1: a
149\= Expect no match
150 aaac
151No match
152 abbbbbbbbbbbac
153No match
154
155/^(b+|a){1,2}c/
156 bc
157 0: bc
158 1: b
159 bbc
160 0: bbc
161 1: bb
162 bbbc
163 0: bbbc
164 1: bbb
165 bac
166 0: bac
167 1: a
168 bbac
169 0: bbac
170 1: a
171 aac
172 0: aac
173 1: a
174 abbbbbbbbbbbc
175 0: abbbbbbbbbbbc
176 1: bbbbbbbbbbb
177 bbbbbbbbbbbac
178 0: bbbbbbbbbbbac
179 1: a
180\= Expect no match
181 aaac
182No match
183 abbbbbbbbbbbac
184No match
185
186/^(b+|a){1,2}?bc/
187 bbc
188 0: bbc
189 1: b
190
191/^(b*|ba){1,2}?bc/
192 babc
193 0: babc
194 1: ba
195 bbabc
196 0: bbabc
197 1: ba
198 bababc
199 0: bababc
200 1: ba
201\= Expect no match
202 bababbc
203No match
204 babababc
205No match
206
207/^(ba|b*){1,2}?bc/
208 babc
209 0: babc
210 1: ba
211 bbabc
212 0: bbabc
213 1: ba
214 bababc
215 0: bababc
216 1: ba
217\= Expect no match
218 bababbc
219No match
220 babababc
221No match
222
223#/^\ca\cA\c[;\c:/
224# \x01\x01\e;z
225# 0: \x01\x01\x1b;z
226
227/^[ab\]cde]/
228 athing
229 0: a
230 bthing
231 0: b
232 ]thing
233 0: ]
234 cthing
235 0: c
236 dthing
237 0: d
238 ething
239 0: e
240\= Expect no match
241 fthing
242No match
243 [thing
244No match
245 \\thing
246No match
247
248/^[]cde]/
249 ]thing
250 0: ]
251 cthing
252 0: c
253 dthing
254 0: d
255 ething
256 0: e
257\= Expect no match
258 athing
259No match
260 fthing
261No match
262
263/^[^ab\]cde]/
264 fthing
265 0: f
266 [thing
267 0: [
268 \\thing
269 0: \
270\= Expect no match
271 athing
272No match
273 bthing
274No match
275 ]thing
276No match
277 cthing
278No match
279 dthing
280No match
281 ething
282No match
283
284/^[^]cde]/
285 athing
286 0: a
287 fthing
288 0: f
289\= Expect no match
290 ]thing
291No match
292 cthing
293No match
294 dthing
295No match
296 ething
297No match
298
299# DLC - I don't get this one
300#/^\/
301# 
302# 0: \x81
303
304#updated to handle 16-bits utf8
305/^ÿ/
306 ÿ
307 0: \xc3\xbf
308
309/^[0-9]+$/
310 0
311 0: 0
312 1
313 0: 1
314 2
315 0: 2
316 3
317 0: 3
318 4
319 0: 4
320 5
321 0: 5
322 6
323 0: 6
324 7
325 0: 7
326 8
327 0: 8
328 9
329 0: 9
330 10
331 0: 10
332 100
333 0: 100
334\= Expect no match
335 abc
336No match
337
338/^.*nter/
339 enter
340 0: enter
341 inter
342 0: inter
343 uponter
344 0: uponter
345
346/^xxx[0-9]+$/
347 xxx0
348 0: xxx0
349 xxx1234
350 0: xxx1234
351\= Expect no match
352 xxx
353No match
354
355/^.+[0-9][0-9][0-9]$/
356 x123
357 0: x123
358 x1234
359 0: x1234
360 xx123
361 0: xx123
362 123456
363 0: 123456
364\= Expect no match
365 123
366No match
367
368/^.+?[0-9][0-9][0-9]$/
369 x123
370 0: x123
371 x1234
372 0: x1234
373 xx123
374 0: xx123
375 123456
376 0: 123456
377\= Expect no match
378 123
379No match
380
381/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
382 abc!pqr=apquxz.ixr.zzz.ac.uk
383 0: abc!pqr=apquxz.ixr.zzz.ac.uk
384 1: abc
385 2: pqr
386\= Expect no match
387 !pqr=apquxz.ixr.zzz.ac.uk
388No match
389 abc!=apquxz.ixr.zzz.ac.uk
390No match
391 abc!pqr=apquxz:ixr.zzz.ac.uk
392No match
393 abc!pqr=apquxz.ixr.zzz.ac.ukk
394No match
395
396/:/
397 Well, we need a colon: somewhere
398 0: :
399\= Expect no match
400 Fail without a colon
401No match
402
403/([\da-f:]+)$/i
404 0abc
405 0: 0abc
406 1: 0abc
407 abc
408 0: abc
409 1: abc
410 fed
411 0: fed
412 1: fed
413 E
414 0: E
415 1: E
416 ::
417 0: ::
418 1: ::
419 5f03:12C0::932e
420 0: 5f03:12C0::932e
421 1: 5f03:12C0::932e
422 fed def
423 0: def
424 1: def
425 Any old stuff
426 0: ff
427 1: ff
428\= Expect no match
429 0zzz
430No match
431 gzzz
432No match
433 fed\x20
434No match
435 Any old rubbish
436No match
437
438/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
439 .1.2.3
440 0: .1.2.3
441 1: 1
442 2: 2
443 3: 3
444 A.12.123.0
445 0: A.12.123.0
446 1: 12
447 2: 123
448 3: 0
449\= Expect no match
450 .1.2.3333
451No match
452 1.2.3
453No match
454 1234.2.3
455No match
456
457/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
458 1 IN SOA non-sp1 non-sp2(
459 0: 1 IN SOA non-sp1 non-sp2(
460 1: 1
461 2: non-sp1
462 3: non-sp2
463 1 IN SOA non-sp1 non-sp2 (
464 0: 1 IN SOA non-sp1 non-sp2 (
465 1: 1
466 2: non-sp1
467 3: non-sp2
468\= Expect no match
469 1IN SOA non-sp1 non-sp2(
470No match
471
472/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
473 a.
474 0: a.
475 Z.
476 0: Z.
477 2.
478 0: 2.
479 ab-c.pq-r.
480 0: ab-c.pq-r.
481 1: .pq-r
482 sxk.zzz.ac.uk.
483 0: sxk.zzz.ac.uk.
484 1: .uk
485 x-.y-.
486 0: x-.y-.
487 1: .y-
488\= Expect no match
489 -abc.peq.
490No match
491
492/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
493 *.a
494 0: *.a
495 *.b0-a
496 0: *.b0-a
497 1: 0-a
498 *.c3-b.c
499 0: *.c3-b.c
500 1: 3-b
501 2: .c
502 *.c-a.b-c
503 0: *.c-a.b-c
504 1: -a
505 2: .b-c
506 3: -c
507\= Expect no match
508 *.0
509No match
510 *.a-
511No match
512 *.a-b.c-
513No match
514 *.c-a.0-c
515No match
516
517/^(?=ab(de))(abd)(e)/
518 abde
519 0: abde
520 1: de
521 2: abd
522 3: e
523
524/^(?!(ab)de|x)(abd)(f)/
525 abdf
526 0: abdf
527 1: <unset>
528 2: abd
529 3: f
530
531/^(?=(ab(cd)))(ab)/
532 abcd
533 0: ab
534 1: abcd
535 2: cd
536 3: ab
537
538/^[\da-f](\.[\da-f])*$/i
539 a.b.c.d
540 0: a.b.c.d
541 1: .d
542 A.B.C.D
543 0: A.B.C.D
544 1: .D
545 a.b.c.1.2.3.C
546 0: a.b.c.1.2.3.C
547 1: .C
548
549/^\".*\"\s*(;.*)?$/
550 \"1234\"
551 0: "1234"
552 \"abcd\" ;
553 0: "abcd" ;
554 1: ;
555 \"\" ; rhubarb
556 0: "" ; rhubarb
557 1: ; rhubarb
558\= Expect no match
559 \"1234\" : things
560No match
561
562/^$/
563 \
564 0:
565\= Expect no match
566 A non-empty line
567No match
568
569/ ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x
570 ab c
571 0: ab c
572\= Expect no match
573 abc
574No match
575 ab cde
576No match
577
578/(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/
579 ab c
580 0: ab c
581\= Expect no match
582 abc
583No match
584 ab cde
585No match
586
587/^ a\ b[c ]d $/x
588 a bcd
589 0: a bcd
590 a b d
591 0: a b d
592\= Expect no match
593 abcd
594No match
595 ab d
596No match
597
598/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
599 abcdefhijklm
600 0: abcdefhijklm
601 1: abc
602 2: bc
603 3: c
604 4: def
605 5: ef
606 6: f
607 7: hij
608 8: ij
609 9: j
61010: klm
61111: lm
61212: m
613
614/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
615 abcdefhijklm
616 0: abcdefhijklm
617 1: bc
618 2: c
619 3: ef
620 4: f
621 5: ij
622 6: j
623 7: lm
624 8: m
625
626#/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
627# a+ Z0+\x08\n\x1d\x12
628# 0: a+ Z0+\x08\x0a\x1d\x12
629
630/^[.^$|()*+?{,}]+/
631 .^\$(*+)|{?,?}
632 0: .^$(*+)|{?,?}
633
634/^a*\w/
635 z
636 0: z
637 az
638 0: az
639 aaaz
640 0: aaaz
641 a
642 0: a
643 aa
644 0: aa
645 aaaa
646 0: aaaa
647 a+
648 0: a
649 aa+
650 0: aa
651
652/^a*?\w/
653 z
654 0: z
655 az
656 0: a
657 aaaz
658 0: a
659 a
660 0: a
661 aa
662 0: a
663 aaaa
664 0: a
665 a+
666 0: a
667 aa+
668 0: a
669
670/^a+\w/
671 az
672 0: az
673 aaaz
674 0: aaaz
675 aa
676 0: aa
677 aaaa
678 0: aaaa
679 aa+
680 0: aa
681
682/^a+?\w/
683 az
684 0: az
685 aaaz
686 0: aa
687 aa
688 0: aa
689 aaaa
690 0: aa
691 aa+
692 0: aa
693
694/^\d{8}\w{2,}/
695 1234567890
696 0: 1234567890
697 12345678ab
698 0: 12345678ab
699 12345678__
700 0: 12345678__
701\= Expect no match
702 1234567
703No match
704
705/^[aeiou\d]{4,5}$/
706 uoie
707 0: uoie
708 1234
709 0: 1234
710 12345
711 0: 12345
712 aaaaa
713 0: aaaaa
714\= Expect no match
715 123456
716No match
717
718/^[aeiou\d]{4,5}?/
719 uoie
720 0: uoie
721 1234
722 0: 1234
723 12345
724 0: 1234
725 aaaaa
726 0: aaaa
727 123456
728 0: 1234
729
730/\A(abc|def)=(\1){2,3}\Z/
731 abc=abcabc
732 0: abc=abcabc
733 1: abc
734 2: abc
735 def=defdefdef
736 0: def=defdefdef
737 1: def
738 2: def
739\= Expect no match
740 abc=defdef
741No match
742
743/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
744 abcdefghijkcda2
745 0: abcdefghijkcda2
746 1: a
747 2: b
748 3: c
749 4: d
750 5: e
751 6: f
752 7: g
753 8: h
754 9: i
75510: j
75611: k
75712: cd
758 abcdefghijkkkkcda2
759 0: abcdefghijkkkkcda2
760 1: a
761 2: b
762 3: c
763 4: d
764 5: e
765 6: f
766 7: g
767 8: h
768 9: i
76910: j
77011: k
77112: cd
772
773/(cat(a(ract|tonic)|erpillar)) \1()2(3)/
774 cataract cataract23
775 0: cataract cataract23
776 1: cataract
777 2: aract
778 3: ract
779 4:
780 5: 3
781 catatonic catatonic23
782 0: catatonic catatonic23
783 1: catatonic
784 2: atonic
785 3: tonic
786 4:
787 5: 3
788 caterpillar caterpillar23
789 0: caterpillar caterpillar23
790 1: caterpillar
791 2: erpillar
792 3: <unset>
793 4:
794 5: 3
795
796
797/^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]/
798 From abcd Mon Sep 01 12:33:02 1997
799 0: From abcd Mon Sep 01 12:33
800 1: abcd
801
802/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
803 From abcd Mon Sep 01 12:33:02 1997
804 0: From abcd Mon Sep 01 12:33
805 1: Sep
806 From abcd Mon Sep 1 12:33:02 1997
807 0: From abcd Mon Sep 1 12:33
808 1: Sep
809\= Expect no match
810 From abcd Sep 01 12:33:02 1997
811No match
812
813/^12.34/s
814 12\n34
815 0: 12\x0a34
816 12\r34
817 0: 12\x0d34
818
819/\w+(?=\t)/
820 the quick brown\t fox
821 0: brown
822
823/foo(?!bar)(.*)/
824 foobar is foolish see?
825 0: foolish see?
826 1: lish see?
827
828/(?:(?!foo)...|^.{0,2})bar(.*)/
829 foobar crowbar etc
830 0: rowbar etc
831 1: etc
832 barrel
833 0: barrel
834 1: rel
835 2barrel
836 0: 2barrel
837 1: rel
838 A barrel
839 0: A barrel
840 1: rel
841
842/^(\D*)(?=\d)(?!123)/
843 abc456
844 0: abc
845 1: abc
846\= Expect no match
847 abc123
848No match
849
850/^1234(?# test newlines
851 inside)/
852 1234
853 0: 1234
854
855/^1234 #comment in extended re
856 /x
857 1234
858 0: 1234
859
860/#rhubarb
861 abcd/x
862 abcd
863 0: abcd
864
865/^abcd#rhubarb/x
866 abcd
867 0: abcd
868
869/^(a)\1{2,3}(.)/
870 aaab
871 0: aaab
872 1: a
873 2: b
874 aaaab
875 0: aaaab
876 1: a
877 2: b
878 aaaaab
879 0: aaaaa
880 1: a
881 2: a
882 aaaaaab
883 0: aaaaa
884 1: a
885 2: a
886
887/(?!^)abc/
888 the abc
889 0: abc
890\= Expect no match
891 abc
892No match
893
894/(?=^)abc/
895 abc
896 0: abc
897\= Expect no match
898 the abc
899No match
900
901/^[ab]{1,3}(ab*|b)/
902 aabbbbb
903 0: aabb
904 1: b
905
906/^[ab]{1,3}?(ab*|b)/
907 aabbbbb
908 0: aabbbbb
909 1: abbbbb
910
911/^[ab]{1,3}?(ab*?|b)/
912 aabbbbb
913 0: aa
914 1: a
915
916/^[ab]{1,3}(ab*?|b)/
917 aabbbbb
918 0: aabb
919 1: b
920
921/ (?: [\040\t] | \(
922(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
923\) )* # optional leading comment
924(?: (?:
925[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
926(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
927|
928" (?: # opening quote...
929[^\\\x80-\xff\n\015"] # Anything except backslash and quote
930| # or
931\\ [^\x80-\xff] # Escaped something (something != CR)
932)* " # closing quote
933) # initial word
934(?: (?: [\040\t] | \(
935(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
936\) )* \. (?: [\040\t] | \(
937(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
938\) )* (?:
939[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
940(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
941|
942" (?: # opening quote...
943[^\\\x80-\xff\n\015"] # Anything except backslash and quote
944| # or
945\\ [^\x80-\xff] # Escaped something (something != CR)
946)* " # closing quote
947) )* # further okay, if led by a period
948(?: [\040\t] | \(
949(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
950\) )* @ (?: [\040\t] | \(
951(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
952\) )* (?:
953[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
954(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
955| \[ # [
956(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
957\] # ]
958) # initial subdomain
959(?: #
960(?: [\040\t] | \(
961(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
962\) )* \. # if led by a period...
963(?: [\040\t] | \(
964(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
965\) )* (?:
966[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
967(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
968| \[ # [
969(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
970\] # ]
971) # ...further okay
972)*
973# address
974| # or
975(?:
976[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
977(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
978|
979" (?: # opening quote...
980[^\\\x80-\xff\n\015"] # Anything except backslash and quote
981| # or
982\\ [^\x80-\xff] # Escaped something (something != CR)
983)* " # closing quote
984) # one word, optionally followed by....
985(?:
986[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or...
987\(
988(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
989\) | # comments, or...
990
991" (?: # opening quote...
992[^\\\x80-\xff\n\015"] # Anything except backslash and quote
993| # or
994\\ [^\x80-\xff] # Escaped something (something != CR)
995)* " # closing quote
996# quoted strings
997)*
998< (?: [\040\t] | \(
999(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1000\) )* # leading <
1001(?: @ (?: [\040\t] | \(
1002(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1003\) )* (?:
1004[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1005(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1006| \[ # [
1007(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1008\] # ]
1009) # initial subdomain
1010(?: #
1011(?: [\040\t] | \(
1012(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1013\) )* \. # if led by a period...
1014(?: [\040\t] | \(
1015(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1016\) )* (?:
1017[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1018(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1019| \[ # [
1020(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1021\] # ]
1022) # ...further okay
1023)*
1024
1025(?: (?: [\040\t] | \(
1026(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1027\) )* , (?: [\040\t] | \(
1028(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1029\) )* @ (?: [\040\t] | \(
1030(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1031\) )* (?:
1032[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1033(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1034| \[ # [
1035(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1036\] # ]
1037) # initial subdomain
1038(?: #
1039(?: [\040\t] | \(
1040(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1041\) )* \. # if led by a period...
1042(?: [\040\t] | \(
1043(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1044\) )* (?:
1045[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1046(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1047| \[ # [
1048(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1049\] # ]
1050) # ...further okay
1051)*
1052)* # further okay, if led by comma
1053: # closing colon
1054(?: [\040\t] | \(
1055(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1056\) )* )? # optional route
1057(?:
1058[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1059(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1060|
1061" (?: # opening quote...
1062[^\\\x80-\xff\n\015"] # Anything except backslash and quote
1063| # or
1064\\ [^\x80-\xff] # Escaped something (something != CR)
1065)* " # closing quote
1066) # initial word
1067(?: (?: [\040\t] | \(
1068(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1069\) )* \. (?: [\040\t] | \(
1070(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1071\) )* (?:
1072[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1073(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1074|
1075" (?: # opening quote...
1076[^\\\x80-\xff\n\015"] # Anything except backslash and quote
1077| # or
1078\\ [^\x80-\xff] # Escaped something (something != CR)
1079)* " # closing quote
1080) )* # further okay, if led by a period
1081(?: [\040\t] | \(
1082(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1083\) )* @ (?: [\040\t] | \(
1084(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1085\) )* (?:
1086[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1087(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1088| \[ # [
1089(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1090\] # ]
1091) # initial subdomain
1092(?: #
1093(?: [\040\t] | \(
1094(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1095\) )* \. # if led by a period...
1096(?: [\040\t] | \(
1097(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1098\) )* (?:
1099[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1100(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1101| \[ # [
1102(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1103\] # ]
1104) # ...further okay
1105)*
1106# address spec
1107(?: [\040\t] | \(
1108(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1109\) )* > # trailing >
1110# name and address
1111) (?: [\040\t] | \(
1112(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
1113\) )* # optional trailing comment
1114/x
1115 Alan Other <user\@dom.ain>
1116 0: Alan Other <user@dom.ain>
1117 <user\@dom.ain>
1118 0: user@dom.ain
1119 user\@dom.ain
1120 0: user@dom.ain
1121 \"A. Other\" <user.1234\@dom.ain> (a comment)
1122 0: "A. Other" <user.1234@dom.ain> (a comment)
1123 A. Other <user.1234\@dom.ain> (a comment)
1124 0: Other <user.1234@dom.ain> (a comment)
1125 \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
1126 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
1127 A missing angle <user\@some.where
1128 0: user@some.where
1129\= Expect no match
1130 The quick brown fox
1131No match
1132
1133/[\040\t]* # Nab whitespace.
1134(?:
1135\( # (
1136[^\\\x80-\xff\n\015()] * # normal*
1137(?: # (
1138(?: \\ [^\x80-\xff] |
1139\( # (
1140[^\\\x80-\xff\n\015()] * # normal*
1141(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1142\) # )
1143) # special
1144[^\\\x80-\xff\n\015()] * # normal*
1145)* # )*
1146\) # )
1147[\040\t]* )* # If comment found, allow more spaces.
1148# optional leading comment
1149(?:
1150(?:
1151[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1152(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1153# Atom
1154| # or
1155" # "
1156[^\\\x80-\xff\n\015"] * # normal
1157(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
1158" # "
1159# Quoted string
1160)
1161[\040\t]* # Nab whitespace.
1162(?:
1163\( # (
1164[^\\\x80-\xff\n\015()] * # normal*
1165(?: # (
1166(?: \\ [^\x80-\xff] |
1167\( # (
1168[^\\\x80-\xff\n\015()] * # normal*
1169(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1170\) # )
1171) # special
1172[^\\\x80-\xff\n\015()] * # normal*
1173)* # )*
1174\) # )
1175[\040\t]* )* # If comment found, allow more spaces.
1176(?:
1177\.
1178[\040\t]* # Nab whitespace.
1179(?:
1180\( # (
1181[^\\\x80-\xff\n\015()] * # normal*
1182(?: # (
1183(?: \\ [^\x80-\xff] |
1184\( # (
1185[^\\\x80-\xff\n\015()] * # normal*
1186(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1187\) # )
1188) # special
1189[^\\\x80-\xff\n\015()] * # normal*
1190)* # )*
1191\) # )
1192[\040\t]* )* # If comment found, allow more spaces.
1193(?:
1194[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1195(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1196# Atom
1197| # or
1198" # "
1199[^\\\x80-\xff\n\015"] * # normal
1200(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
1201" # "
1202# Quoted string
1203)
1204[\040\t]* # Nab whitespace.
1205(?:
1206\( # (
1207[^\\\x80-\xff\n\015()] * # normal*
1208(?: # (
1209(?: \\ [^\x80-\xff] |
1210\( # (
1211[^\\\x80-\xff\n\015()] * # normal*
1212(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1213\) # )
1214) # special
1215[^\\\x80-\xff\n\015()] * # normal*
1216)* # )*
1217\) # )
1218[\040\t]* )* # If comment found, allow more spaces.
1219# additional words
1220)*
1221@
1222[\040\t]* # Nab whitespace.
1223(?:
1224\( # (
1225[^\\\x80-\xff\n\015()] * # normal*
1226(?: # (
1227(?: \\ [^\x80-\xff] |
1228\( # (
1229[^\\\x80-\xff\n\015()] * # normal*
1230(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1231\) # )
1232) # special
1233[^\\\x80-\xff\n\015()] * # normal*
1234)* # )*
1235\) # )
1236[\040\t]* )* # If comment found, allow more spaces.
1237(?:
1238[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1239(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1240|
1241\[ # [
1242(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1243\] # ]
1244)
1245[\040\t]* # Nab whitespace.
1246(?:
1247\( # (
1248[^\\\x80-\xff\n\015()] * # normal*
1249(?: # (
1250(?: \\ [^\x80-\xff] |
1251\( # (
1252[^\\\x80-\xff\n\015()] * # normal*
1253(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1254\) # )
1255) # special
1256[^\\\x80-\xff\n\015()] * # normal*
1257)* # )*
1258\) # )
1259[\040\t]* )* # If comment found, allow more spaces.
1260# optional trailing comments
1261(?:
1262\.
1263[\040\t]* # Nab whitespace.
1264(?:
1265\( # (
1266[^\\\x80-\xff\n\015()] * # normal*
1267(?: # (
1268(?: \\ [^\x80-\xff] |
1269\( # (
1270[^\\\x80-\xff\n\015()] * # normal*
1271(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1272\) # )
1273) # special
1274[^\\\x80-\xff\n\015()] * # normal*
1275)* # )*
1276\) # )
1277[\040\t]* )* # If comment found, allow more spaces.
1278(?:
1279[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1280(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1281|
1282\[ # [
1283(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1284\] # ]
1285)
1286[\040\t]* # Nab whitespace.
1287(?:
1288\( # (
1289[^\\\x80-\xff\n\015()] * # normal*
1290(?: # (
1291(?: \\ [^\x80-\xff] |
1292\( # (
1293[^\\\x80-\xff\n\015()] * # normal*
1294(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1295\) # )
1296) # special
1297[^\\\x80-\xff\n\015()] * # normal*
1298)* # )*
1299\) # )
1300[\040\t]* )* # If comment found, allow more spaces.
1301# optional trailing comments
1302)*
1303# address
1304| # or
1305(?:
1306[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1307(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1308# Atom
1309| # or
1310" # "
1311[^\\\x80-\xff\n\015"] * # normal
1312(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
1313" # "
1314# Quoted string
1315)
1316# leading word
1317[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces
1318(?:
1319(?:
1320\( # (
1321[^\\\x80-\xff\n\015()] * # normal*
1322(?: # (
1323(?: \\ [^\x80-\xff] |
1324\( # (
1325[^\\\x80-\xff\n\015()] * # normal*
1326(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1327\) # )
1328) # special
1329[^\\\x80-\xff\n\015()] * # normal*
1330)* # )*
1331\) # )
1332|
1333" # "
1334[^\\\x80-\xff\n\015"] * # normal
1335(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
1336" # "
1337) # "special" comment or quoted string
1338[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal"
1339)*
1340<
1341[\040\t]* # Nab whitespace.
1342(?:
1343\( # (
1344[^\\\x80-\xff\n\015()] * # normal*
1345(?: # (
1346(?: \\ [^\x80-\xff] |
1347\( # (
1348[^\\\x80-\xff\n\015()] * # normal*
1349(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1350\) # )
1351) # special
1352[^\\\x80-\xff\n\015()] * # normal*
1353)* # )*
1354\) # )
1355[\040\t]* )* # If comment found, allow more spaces.
1356# <
1357(?:
1358@
1359[\040\t]* # Nab whitespace.
1360(?:
1361\( # (
1362[^\\\x80-\xff\n\015()] * # normal*
1363(?: # (
1364(?: \\ [^\x80-\xff] |
1365\( # (
1366[^\\\x80-\xff\n\015()] * # normal*
1367(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1368\) # )
1369) # special
1370[^\\\x80-\xff\n\015()] * # normal*
1371)* # )*
1372\) # )
1373[\040\t]* )* # If comment found, allow more spaces.
1374(?:
1375[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1376(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1377|
1378\[ # [
1379(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1380\] # ]
1381)
1382[\040\t]* # Nab whitespace.
1383(?:
1384\( # (
1385[^\\\x80-\xff\n\015()] * # normal*
1386(?: # (
1387(?: \\ [^\x80-\xff] |
1388\( # (
1389[^\\\x80-\xff\n\015()] * # normal*
1390(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1391\) # )
1392) # special
1393[^\\\x80-\xff\n\015()] * # normal*
1394)* # )*
1395\) # )
1396[\040\t]* )* # If comment found, allow more spaces.
1397# optional trailing comments
1398(?:
1399\.
1400[\040\t]* # Nab whitespace.
1401(?:
1402\( # (
1403[^\\\x80-\xff\n\015()] * # normal*
1404(?: # (
1405(?: \\ [^\x80-\xff] |
1406\( # (
1407[^\\\x80-\xff\n\015()] * # normal*
1408(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1409\) # )
1410) # special
1411[^\\\x80-\xff\n\015()] * # normal*
1412)* # )*
1413\) # )
1414[\040\t]* )* # If comment found, allow more spaces.
1415(?:
1416[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1417(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1418|
1419\[ # [
1420(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1421\] # ]
1422)
1423[\040\t]* # Nab whitespace.
1424(?:
1425\( # (
1426[^\\\x80-\xff\n\015()] * # normal*
1427(?: # (
1428(?: \\ [^\x80-\xff] |
1429\( # (
1430[^\\\x80-\xff\n\015()] * # normal*
1431(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1432\) # )
1433) # special
1434[^\\\x80-\xff\n\015()] * # normal*
1435)* # )*
1436\) # )
1437[\040\t]* )* # If comment found, allow more spaces.
1438# optional trailing comments
1439)*
1440(?: ,
1441[\040\t]* # Nab whitespace.
1442(?:
1443\( # (
1444[^\\\x80-\xff\n\015()] * # normal*
1445(?: # (
1446(?: \\ [^\x80-\xff] |
1447\( # (
1448[^\\\x80-\xff\n\015()] * # normal*
1449(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1450\) # )
1451) # special
1452[^\\\x80-\xff\n\015()] * # normal*
1453)* # )*
1454\) # )
1455[\040\t]* )* # If comment found, allow more spaces.
1456@
1457[\040\t]* # Nab whitespace.
1458(?:
1459\( # (
1460[^\\\x80-\xff\n\015()] * # normal*
1461(?: # (
1462(?: \\ [^\x80-\xff] |
1463\( # (
1464[^\\\x80-\xff\n\015()] * # normal*
1465(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1466\) # )
1467) # special
1468[^\\\x80-\xff\n\015()] * # normal*
1469)* # )*
1470\) # )
1471[\040\t]* )* # If comment found, allow more spaces.
1472(?:
1473[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1474(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1475|
1476\[ # [
1477(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1478\] # ]
1479)
1480[\040\t]* # Nab whitespace.
1481(?:
1482\( # (
1483[^\\\x80-\xff\n\015()] * # normal*
1484(?: # (
1485(?: \\ [^\x80-\xff] |
1486\( # (
1487[^\\\x80-\xff\n\015()] * # normal*
1488(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1489\) # )
1490) # special
1491[^\\\x80-\xff\n\015()] * # normal*
1492)* # )*
1493\) # )
1494[\040\t]* )* # If comment found, allow more spaces.
1495# optional trailing comments
1496(?:
1497\.
1498[\040\t]* # Nab whitespace.
1499(?:
1500\( # (
1501[^\\\x80-\xff\n\015()] * # normal*
1502(?: # (
1503(?: \\ [^\x80-\xff] |
1504\( # (
1505[^\\\x80-\xff\n\015()] * # normal*
1506(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1507\) # )
1508) # special
1509[^\\\x80-\xff\n\015()] * # normal*
1510)* # )*
1511\) # )
1512[\040\t]* )* # If comment found, allow more spaces.
1513(?:
1514[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1515(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1516|
1517\[ # [
1518(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1519\] # ]
1520)
1521[\040\t]* # Nab whitespace.
1522(?:
1523\( # (
1524[^\\\x80-\xff\n\015()] * # normal*
1525(?: # (
1526(?: \\ [^\x80-\xff] |
1527\( # (
1528[^\\\x80-\xff\n\015()] * # normal*
1529(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1530\) # )
1531) # special
1532[^\\\x80-\xff\n\015()] * # normal*
1533)* # )*
1534\) # )
1535[\040\t]* )* # If comment found, allow more spaces.
1536# optional trailing comments
1537)*
1538)* # additional domains
1539:
1540[\040\t]* # Nab whitespace.
1541(?:
1542\( # (
1543[^\\\x80-\xff\n\015()] * # normal*
1544(?: # (
1545(?: \\ [^\x80-\xff] |
1546\( # (
1547[^\\\x80-\xff\n\015()] * # normal*
1548(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1549\) # )
1550) # special
1551[^\\\x80-\xff\n\015()] * # normal*
1552)* # )*
1553\) # )
1554[\040\t]* )* # If comment found, allow more spaces.
1555# optional trailing comments
1556)? # optional route
1557(?:
1558[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1559(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1560# Atom
1561| # or
1562" # "
1563[^\\\x80-\xff\n\015"] * # normal
1564(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
1565" # "
1566# Quoted string
1567)
1568[\040\t]* # Nab whitespace.
1569(?:
1570\( # (
1571[^\\\x80-\xff\n\015()] * # normal*
1572(?: # (
1573(?: \\ [^\x80-\xff] |
1574\( # (
1575[^\\\x80-\xff\n\015()] * # normal*
1576(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1577\) # )
1578) # special
1579[^\\\x80-\xff\n\015()] * # normal*
1580)* # )*
1581\) # )
1582[\040\t]* )* # If comment found, allow more spaces.
1583(?:
1584\.
1585[\040\t]* # Nab whitespace.
1586(?:
1587\( # (
1588[^\\\x80-\xff\n\015()] * # normal*
1589(?: # (
1590(?: \\ [^\x80-\xff] |
1591\( # (
1592[^\\\x80-\xff\n\015()] * # normal*
1593(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1594\) # )
1595) # special
1596[^\\\x80-\xff\n\015()] * # normal*
1597)* # )*
1598\) # )
1599[\040\t]* )* # If comment found, allow more spaces.
1600(?:
1601[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1602(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1603# Atom
1604| # or
1605" # "
1606[^\\\x80-\xff\n\015"] * # normal
1607(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
1608" # "
1609# Quoted string
1610)
1611[\040\t]* # Nab whitespace.
1612(?:
1613\( # (
1614[^\\\x80-\xff\n\015()] * # normal*
1615(?: # (
1616(?: \\ [^\x80-\xff] |
1617\( # (
1618[^\\\x80-\xff\n\015()] * # normal*
1619(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1620\) # )
1621) # special
1622[^\\\x80-\xff\n\015()] * # normal*
1623)* # )*
1624\) # )
1625[\040\t]* )* # If comment found, allow more spaces.
1626# additional words
1627)*
1628@
1629[\040\t]* # Nab whitespace.
1630(?:
1631\( # (
1632[^\\\x80-\xff\n\015()] * # normal*
1633(?: # (
1634(?: \\ [^\x80-\xff] |
1635\( # (
1636[^\\\x80-\xff\n\015()] * # normal*
1637(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1638\) # )
1639) # special
1640[^\\\x80-\xff\n\015()] * # normal*
1641)* # )*
1642\) # )
1643[\040\t]* )* # If comment found, allow more spaces.
1644(?:
1645[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1646(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1647|
1648\[ # [
1649(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1650\] # ]
1651)
1652[\040\t]* # Nab whitespace.
1653(?:
1654\( # (
1655[^\\\x80-\xff\n\015()] * # normal*
1656(?: # (
1657(?: \\ [^\x80-\xff] |
1658\( # (
1659[^\\\x80-\xff\n\015()] * # normal*
1660(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1661\) # )
1662) # special
1663[^\\\x80-\xff\n\015()] * # normal*
1664)* # )*
1665\) # )
1666[\040\t]* )* # If comment found, allow more spaces.
1667# optional trailing comments
1668(?:
1669\.
1670[\040\t]* # Nab whitespace.
1671(?:
1672\( # (
1673[^\\\x80-\xff\n\015()] * # normal*
1674(?: # (
1675(?: \\ [^\x80-\xff] |
1676\( # (
1677[^\\\x80-\xff\n\015()] * # normal*
1678(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1679\) # )
1680) # special
1681[^\\\x80-\xff\n\015()] * # normal*
1682)* # )*
1683\) # )
1684[\040\t]* )* # If comment found, allow more spaces.
1685(?:
1686[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1687(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1688|
1689\[ # [
1690(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1691\] # ]
1692)
1693[\040\t]* # Nab whitespace.
1694(?:
1695\( # (
1696[^\\\x80-\xff\n\015()] * # normal*
1697(?: # (
1698(?: \\ [^\x80-\xff] |
1699\( # (
1700[^\\\x80-\xff\n\015()] * # normal*
1701(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1702\) # )
1703) # special
1704[^\\\x80-\xff\n\015()] * # normal*
1705)* # )*
1706\) # )
1707[\040\t]* )* # If comment found, allow more spaces.
1708# optional trailing comments
1709)*
1710# address spec
1711> # >
1712# name and address
1713)
1714/x
1715 Alan Other <user\@dom.ain>
1716 0: Alan Other <user@dom.ain>
1717 <user\@dom.ain>
1718 0: user@dom.ain
1719 user\@dom.ain
1720 0: user@dom.ain
1721 \"A. Other\" <user.1234\@dom.ain> (a comment)
1722 0: "A. Other" <user.1234@dom.ain>
1723 A. Other <user.1234\@dom.ain> (a comment)
1724 0: Other <user.1234@dom.ain>
1725 \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
1726 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
1727 A missing angle <user\@some.where
1728 0: user@some.where
1729\= Expect no match
1730 The quick brown fox
1731No match
1732
1733/abc\0def\00pqr\000xyz\0000AB/
1734 abc\0def\00pqr\000xyz\0000AB
1735 0: abc\x00def\x00pqr\x00xyz\x000AB
1736 abc456 abc\0def\00pqr\000xyz\0000ABCDE
1737 0: abc\x00def\x00pqr\x00xyz\x000AB
1738
1739/abc\x0def\x00pqr\x000xyz\x0000AB/
1740 abc\x0def\x00pqr\x000xyz\x0000AB
1741 0: abc\x0def\x00pqr\x000xyz\x0000AB
1742 abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
1743 0: abc\x0def\x00pqr\x000xyz\x0000AB
1744
1745/^[\000-\037]/
1746 \0A
1747 0: \x00
1748 \01B
1749 0: \x01
1750 \037C
1751 0: \x1f
1752
1753#.NET doesn't do octal with 1 number
1754
1755/^(cow|)\1(bell)/
1756 cowcowbell
1757 0: cowcowbell
1758 1: cow
1759 2: bell
1760 bell
1761 0: bell
1762 1:
1763 2: bell
1764\= Expect no match
1765 cowbell
1766No match
1767
1768/^\s/
1769 \040abc
1770 0:
1771 \x0cabc
1772 0: \x0c
1773 \nabc
1774 0: \x0a
1775 \rabc
1776 0: \x0d
1777 \tabc
1778 0: \x09
1779\= Expect no match
1780 abc
1781No match
1782
1783/^a b
1784
1785 c/x
1786 abc
1787 0: abc
1788
1789/^(a|)\1*b/
1790 ab
1791 0: ab
1792 1: a
1793 aaaab
1794 0: aaaab
1795 1: a
1796 b
1797 0: b
1798 1:
1799\= Expect no match
1800 acb
1801No match
1802
1803/^(a|)\1+b/
1804 aab
1805 0: aab
1806 1: a
1807 aaaab
1808 0: aaaab
1809 1: a
1810 b
1811 0: b
1812 1:
1813\= Expect no match
1814 ab
1815No match
1816
1817/^(a|)\1?b/
1818 ab
1819 0: ab
1820 1: a
1821 aab
1822 0: aab
1823 1: a
1824 b
1825 0: b
1826 1:
1827\= Expect no match
1828 acb
1829No match
1830
1831/^(a|)\1{2}b/
1832 aaab
1833 0: aaab
1834 1: a
1835 b
1836 0: b
1837 1:
1838\= Expect no match
1839 ab
1840No match
1841 aab
1842No match
1843 aaaab
1844No match
1845
1846/^(a|)\1{2,3}b/
1847 aaab
1848 0: aaab
1849 1: a
1850 aaaab
1851 0: aaaab
1852 1: a
1853 b
1854 0: b
1855 1:
1856\= Expect no match
1857 ab
1858No match
1859 aab
1860No match
1861 aaaaab
1862No match
1863
1864/ab{1,3}bc/
1865 abbbbc
1866 0: abbbbc
1867 abbbc
1868 0: abbbc
1869 abbc
1870 0: abbc
1871\= Expect no match
1872 abc
1873No match
1874 abbbbbc
1875No match
1876
1877/([^.]*)\.([^:]*):[T ]+(.*)/
1878 track1.title:TBlah blah blah
1879 0: track1.title:TBlah blah blah
1880 1: track1
1881 2: title
1882 3: Blah blah blah
1883
1884/([^.]*)\.([^:]*):[T ]+(.*)/i
1885 track1.title:TBlah blah blah
1886 0: track1.title:TBlah blah blah
1887 1: track1
1888 2: title
1889 3: Blah blah blah
1890
1891/([^.]*)\.([^:]*):[t ]+(.*)/i
1892 track1.title:TBlah blah blah
1893 0: track1.title:TBlah blah blah
1894 1: track1
1895 2: title
1896 3: Blah blah blah
1897
1898/^[W-c]+$/
1899 WXY_^abc
1900 0: WXY_^abc
1901\= Expect no match
1902 wxy
1903No match
1904
1905/^[W-c]+$/i
1906 WXY_^abc
1907 0: WXY_^abc
1908 wxy_^ABC
1909 0: wxy_^ABC
1910
1911/^[\x3f-\x5F]+$/i
1912 WXY_^abc
1913 0: WXY_^abc
1914 wxy_^ABC
1915 0: wxy_^ABC
1916
1917/^abc$/m
1918 abc
1919 0: abc
1920 qqq\nabc
1921 0: abc
1922 abc\nzzz
1923 0: abc
1924 qqq\nabc\nzzz
1925 0: abc
1926
1927/^abc$/
1928 abc
1929 0: abc
1930\= Expect no match
1931 qqq\nabc
1932No match
1933 abc\nzzz
1934No match
1935 qqq\nabc\nzzz
1936No match
1937
1938/\Aabc\Z/m
1939 abc
1940 0: abc
1941 abc\n
1942 0: abc
1943\= Expect no match
1944 qqq\nabc
1945No match
1946 abc\nzzz
1947No match
1948 qqq\nabc\nzzz
1949No match
1950
1951/\A(.)*\Z/s
1952 abc\ndef
1953 0: abc\x0adef
1954 1: f
1955
1956/\A(.)*\Z/m
1957\= Expect no match
1958 abc\ndef
1959No match
1960
1961/(?:b)|(?::+)/
1962 b::c
1963 0: b
1964 c::b
1965 0: ::
1966
1967/[-az]+/
1968 az-
1969 0: az-
1970\= Expect no match
1971 b
1972No match
1973
1974/[az-]+/
1975 za-
1976 0: za-
1977\= Expect no match
1978 b
1979No match
1980
1981/[a\-z]+/
1982 a-z
1983 0: a-z
1984\= Expect no match
1985 b
1986No match
1987
1988/[a-z]+/
1989 abcdxyz
1990 0: abcdxyz
1991
1992/[\d-]+/
1993 12-34
1994 0: 12-34
1995\= Expect no match
1996 aaa
1997No match
1998
1999/[\d-z]+/
2000 12-34z
2001 0: 12-34z
2002\= Expect no match
2003 aaa
2004No match
2005
2006/\x5c/
2007 \\
2008 0: \
2009
2010/\x20Z/
2011 the Zoo
2012 0: Z
2013\= Expect no match
2014 Zulu
2015No match
2016
2017/(abc)\1/i
2018 abcabc
2019 0: abcabc
2020 1: abc
2021 ABCabc
2022 0: ABCabc
2023 1: ABC
2024 abcABC
2025 0: abcABC
2026 1: abc
2027
2028/abc$/
2029 abc
2030 0: abc
2031 abc\n
2032 0: abc
2033\= Expect no match
2034 abc\ndef
2035No match
2036
2037/(abc)\123/
2038 abc\x53
2039 0: abcS
2040 1: abc
2041
2042/(abc)\100/
2043 abc\x40
2044 0: abc@
2045 1: abc
2046 abc\100
2047 0: abc@
2048 1: abc
2049
2050/(abc)\1000/
2051 abc\x400
2052 0: abc@0
2053 1: abc
2054 abc\x40\x30
2055 0: abc@0
2056 1: abc
2057 abc\1000
2058 0: abc@0
2059 1: abc
2060 abc\100\x30
2061 0: abc@0
2062 1: abc
2063 abc\100\060
2064 0: abc@0
2065 1: abc
2066 abc\100\60
2067 0: abc@0
2068 1: abc
2069
2070/^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/
2071 ABCDEFGHIHI
2072 0: ABCDEFGHIHI
2073 1: A
2074 2: B
2075 3: C
2076 4: D
2077 5: E
2078 6: F
2079 7: G
2080 8: H
2081 9: I
2082
2083/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
2084 abcdefghijkllS
2085 0: abcdefghijkllS
2086 1: a
2087 2: b
2088 3: c
2089 4: d
2090 5: e
2091 6: f
2092 7: g
2093 8: h
2094 9: i
209510: j
209611: k
209712: l
2098
2099/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
2100 abcdefghijk\12S
2101 0: abcdefghijk\x0aS
2102 1: a
2103 2: b
2104 3: c
2105 4: d
2106 5: e
2107 6: f
2108 7: g
2109 8: h
2110 9: i
211110: j
211211: k
2113
2114/a{0}bc/
2115 bc
2116 0: bc
2117
2118/(a|(bc)){0,0}?xyz/
2119 xyz
2120 0: xyz
2121
2122/abc[\10]de/
2123 abc\010de
2124 0: abc\x08de
2125
2126/abc[\1]de/
2127 abc\1de
2128 0: abc\x01de
2129
2130/(abc)[\1]de/
2131 abc\1de
2132 0: abc\x01de
2133 1: abc
2134
2135/(?s)a.b/
2136 a\nb
2137 0: a\x0ab
2138
2139/^([^a])([^\b])([^c]*)([^d]{3,4})/
2140 baNOTccccd
2141 0: baNOTcccc
2142 1: b
2143 2: a
2144 3: NOT
2145 4: cccc
2146 baNOTcccd
2147 0: baNOTccc
2148 1: b
2149 2: a
2150 3: NOT
2151 4: ccc
2152 baNOTccd
2153 0: baNOTcc
2154 1: b
2155 2: a
2156 3: NO
2157 4: Tcc
2158 bacccd
2159 0: baccc
2160 1: b
2161 2: a
2162 3:
2163 4: ccc
2164\= Expect no match
2165 anything
2166No match
2167 b\bc
2168No match
2169 baccd
2170No match
2171
2172/[^a]/
2173 Abc
2174 0: A
2175
2176/[^a]/i
2177 Abc
2178 0: b
2179
2180/[^a]+/
2181 AAAaAbc
2182 0: AAA
2183
2184/[^a]+/i
2185 AAAaAbc
2186 0: bc
2187
2188/[^a]+/
2189 bbb\nccc
2190 0: bbb\x0accc
2191
2192/[^k]$/
2193 abc
2194 0: c
2195\= Expect no match
2196 abk
2197No match
2198
2199/[^k]{2,3}$/
2200 abc
2201 0: abc
2202 kbc
2203 0: bc
2204 kabc
2205 0: abc
2206\= Expect no match
2207 abk
2208No match
2209 akb
2210No match
2211 akk
2212No match
2213
2214/^\d{8,}\@.+[^k]$/
2215 12345678\@a.b.c.d
2216 0: 12345678@a.b.c.d
2217 123456789\@x.y.z
2218 0: 123456789@x.y.z
2219\= Expect no match
2220 12345678\@x.y.uk
2221No match
2222 1234567\@a.b.c.d
2223No match
2224
2225/(a)\1{8,}/
2226 aaaaaaaaa
2227 0: aaaaaaaaa
2228 1: a
2229 aaaaaaaaaa
2230 0: aaaaaaaaaa
2231 1: a
2232\= Expect no match
2233 aaaaaaa
2234No match
2235
2236/[^a]/
2237 aaaabcd
2238 0: b
2239 aaAabcd
2240 0: A
2241
2242/[^a]/i
2243 aaaabcd
2244 0: b
2245 aaAabcd
2246 0: b
2247
2248/[^az]/
2249 aaaabcd
2250 0: b
2251 aaAabcd
2252 0: A
2253
2254/[^az]/i
2255 aaaabcd
2256 0: b
2257 aaAabcd
2258 0: b
2259
2260# trimmed upper ascii since Go is UTF-8
2261/\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/
2262 \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
2263 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
2264
2265/P[^*]TAIRE[^*]{1,6}?LL/
2266 xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2267 0: PSTAIREISLL
2268
2269/P[^*]TAIRE[^*]{1,}?LL/
2270 xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
2271 0: PSTAIREISLL
2272
2273/(\.\d\d[1-9]?)\d+/
2274 1.230003938
2275 0: .230003938
2276 1: .23
2277 1.875000282
2278 0: .875000282
2279 1: .875
2280 1.235
2281 0: .235
2282 1: .23
2283
2284/(\.\d\d((?=0)|\d(?=\d)))/
2285 1.230003938
2286 0: .23
2287 1: .23
2288 2:
2289 1.875000282
2290 0: .875
2291 1: .875
2292 2: 5
2293\= Expect no match
2294 1.235
2295No match
2296
2297/\b(foo)\s+(\w+)/i
2298 Food is on the foo table
2299 0: foo table
2300 1: foo
2301 2: table
2302
2303/foo(.*)bar/
2304 The food is under the bar in the barn.
2305 0: food is under the bar in the bar
2306 1: d is under the bar in the
2307
2308/foo(.*?)bar/
2309 The food is under the bar in the barn.
2310 0: food is under the bar
2311 1: d is under the
2312
2313/(.*)(\d*)/
2314 I have 2 numbers: 53147
2315 0: I have 2 numbers: 53147
2316 1: I have 2 numbers: 53147
2317 2:
2318
2319/(.*)(\d+)/
2320 I have 2 numbers: 53147
2321 0: I have 2 numbers: 53147
2322 1: I have 2 numbers: 5314
2323 2: 7
2324
2325/(.*?)(\d*)/
2326 I have 2 numbers: 53147
2327 0:
2328 1:
2329 2:
2330
2331/(.*?)(\d+)/
2332 I have 2 numbers: 53147
2333 0: I have 2
2334 1: I have
2335 2: 2
2336
2337/(.*)(\d+)$/
2338 I have 2 numbers: 53147
2339 0: I have 2 numbers: 53147
2340 1: I have 2 numbers: 5314
2341 2: 7
2342
2343/(.*?)(\d+)$/
2344 I have 2 numbers: 53147
2345 0: I have 2 numbers: 53147
2346 1: I have 2 numbers:
2347 2: 53147
2348
2349/(.*)\b(\d+)$/
2350 I have 2 numbers: 53147
2351 0: I have 2 numbers: 53147
2352 1: I have 2 numbers:
2353 2: 53147
2354
2355/(.*\D)(\d+)$/
2356 I have 2 numbers: 53147
2357 0: I have 2 numbers: 53147
2358 1: I have 2 numbers:
2359 2: 53147
2360
2361/^\D*(?!123)/
2362 ABC123
2363 0: AB
2364
2365/^(\D*)(?=\d)(?!123)/
2366 ABC445
2367 0: ABC
2368 1: ABC
2369\= Expect no match
2370 ABC123
2371No match
2372
2373/^[W-]46]/
2374 W46]789
2375 0: W46]
2376 -46]789
2377 0: -46]
2378\= Expect no match
2379 Wall
2380No match
2381 Zebra
2382No match
2383 42
2384No match
2385 [abcd]
2386No match
2387 ]abcd[
2388No match
2389
2390/^[W-\]46]/
2391 W46]789
2392 0: W
2393 Wall
2394 0: W
2395 Zebra
2396 0: Z
2397 Xylophone
2398 0: X
2399 42
2400 0: 4
2401 [abcd]
2402 0: [
2403 ]abcd[
2404 0: ]
2405 \\backslash
2406 0: \
2407\= Expect no match
2408 -46]789
2409No match
2410 well
2411No match
2412
2413/\d\d\/\d\d\/\d\d\d\d/
2414 01/01/2000
2415 0: 01/01/2000
2416
2417/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
2418 word cat dog elephant mussel cow horse canary baboon snake shark otherword
2419 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
2420\= Expect no match
2421 word cat dog elephant mussel cow horse canary baboon snake shark
2422No match
2423
2424/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
2425\= Expect no match
2426 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
2427No match
2428
2429/^(a){0,0}/
2430 bcd
2431 0:
2432 abc
2433 0:
2434 aab
2435 0:
2436
2437/^(a){0,1}/
2438 bcd
2439 0:
2440 abc
2441 0: a
2442 1: a
2443 aab
2444 0: a
2445 1: a
2446
2447/^(a){0,2}/
2448 bcd
2449 0:
2450 abc
2451 0: a
2452 1: a
2453 aab
2454 0: aa
2455 1: a
2456
2457/^(a){0,3}/
2458 bcd
2459 0:
2460 abc
2461 0: a
2462 1: a
2463 aab
2464 0: aa
2465 1: a
2466 aaa
2467 0: aaa
2468 1: a
2469
2470/^(a){0,}/
2471 bcd
2472 0:
2473 abc
2474 0: a
2475 1: a
2476 aab
2477 0: aa
2478 1: a
2479 aaa
2480 0: aaa
2481 1: a
2482 aaaaaaaa
2483 0: aaaaaaaa
2484 1: a
2485
2486/^(a){1,1}/
2487 abc
2488 0: a
2489 1: a
2490 aab
2491 0: a
2492 1: a
2493\= Expect no match
2494 bcd
2495No match
2496
2497/^(a){1,2}/
2498 abc
2499 0: a
2500 1: a
2501 aab
2502 0: aa
2503 1: a
2504\= Expect no match
2505 bcd
2506No match
2507
2508/^(a){1,3}/
2509 abc
2510 0: a
2511 1: a
2512 aab
2513 0: aa
2514 1: a
2515 aaa
2516 0: aaa
2517 1: a
2518\= Expect no match
2519 bcd
2520No match
2521
2522/^(a){1,}/
2523 abc
2524 0: a
2525 1: a
2526 aab
2527 0: aa
2528 1: a
2529 aaa
2530 0: aaa
2531 1: a
2532 aaaaaaaa
2533 0: aaaaaaaa
2534 1: a
2535\= Expect no match
2536 bcd
2537No match
2538
2539/.*\.gif/
2540 borfle\nbib.gif\nno
2541 0: bib.gif
2542
2543/.{0,}\.gif/
2544 borfle\nbib.gif\nno
2545 0: bib.gif
2546
2547/.*\.gif/m
2548 borfle\nbib.gif\nno
2549 0: bib.gif
2550
2551/.*\.gif/s
2552 borfle\nbib.gif\nno
2553 0: borfle\x0abib.gif
2554
2555/.*\.gif/ms
2556 borfle\nbib.gif\nno
2557 0: borfle\x0abib.gif
2558
2559/.*$/
2560 borfle\nbib.gif\nno
2561 0: no
2562
2563/.*$/m
2564 borfle\nbib.gif\nno
2565 0: borfle
2566
2567/.*$/s
2568 borfle\nbib.gif\nno
2569 0: borfle\x0abib.gif\x0ano
2570
2571/.*$/ms
2572 borfle\nbib.gif\nno
2573 0: borfle\x0abib.gif\x0ano
2574
2575/.*$/
2576 borfle\nbib.gif\nno\n
2577 0: no
2578
2579/.*$/m
2580 borfle\nbib.gif\nno\n
2581 0: borfle
2582
2583/.*$/s
2584 borfle\nbib.gif\nno\n
2585 0: borfle\x0abib.gif\x0ano\x0a
2586
2587/.*$/ms
2588 borfle\nbib.gif\nno\n
2589 0: borfle\x0abib.gif\x0ano\x0a
2590
2591/(.*X|^B)/
2592 abcde\n1234Xyz
2593 0: 1234X
2594 1: 1234X
2595 BarFoo
2596 0: B
2597 1: B
2598\= Expect no match
2599 abcde\nBar
2600No match
2601
2602/(.*X|^B)/m
2603 abcde\n1234Xyz
2604 0: 1234X
2605 1: 1234X
2606 BarFoo
2607 0: B
2608 1: B
2609 abcde\nBar
2610 0: B
2611 1: B
2612
2613/(.*X|^B)/s
2614 abcde\n1234Xyz
2615 0: abcde\x0a1234X
2616 1: abcde\x0a1234X
2617 BarFoo
2618 0: B
2619 1: B
2620\= Expect no match
2621 abcde\nBar
2622No match
2623
2624/(.*X|^B)/ms
2625 abcde\n1234Xyz
2626 0: abcde\x0a1234X
2627 1: abcde\x0a1234X
2628 BarFoo
2629 0: B
2630 1: B
2631 abcde\nBar
2632 0: B
2633 1: B
2634
2635/(?s)(.*X|^B)/
2636 abcde\n1234Xyz
2637 0: abcde\x0a1234X
2638 1: abcde\x0a1234X
2639 BarFoo
2640 0: B
2641 1: B
2642\= Expect no match
2643 abcde\nBar
2644No match
2645
2646/(?s:.*X|^B)/
2647 abcde\n1234Xyz
2648 0: abcde\x0a1234X
2649 BarFoo
2650 0: B
2651\= Expect no match
2652 abcde\nBar
2653No match
2654
2655/^.*B/
2656\= Expect no match
2657 abc\nB
2658No match
2659
2660/(?s)^.*B/
2661 abc\nB
2662 0: abc\x0aB
2663
2664/(?m)^.*B/
2665 abc\nB
2666 0: B
2667
2668/(?ms)^.*B/
2669 abc\nB
2670 0: abc\x0aB
2671
2672/(?ms)^B/
2673 abc\nB
2674 0: B
2675
2676/(?s)B$/
2677 B\n
2678 0: B
2679
2680/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
2681 123456654321
2682 0: 123456654321
2683
2684/^\d\d\d\d\d\d\d\d\d\d\d\d/
2685 123456654321
2686 0: 123456654321
2687
2688/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
2689 123456654321
2690 0: 123456654321
2691
2692/^[abc]{12}/
2693 abcabcabcabc
2694 0: abcabcabcabc
2695
2696/^[a-c]{12}/
2697 abcabcabcabc
2698 0: abcabcabcabc
2699
2700/^(a|b|c){12}/
2701 abcabcabcabc
2702 0: abcabcabcabc
2703 1: c
2704
2705/^[abcdefghijklmnopqrstuvwxy0123456789]/
2706 n
2707 0: n
2708\= Expect no match
2709 z
2710No match
2711
2712/abcde{0,0}/
2713 abcd
2714 0: abcd
2715\= Expect no match
2716 abce
2717No match
2718
2719/ab[cd]{0,0}e/
2720 abe
2721 0: abe
2722\= Expect no match
2723 abcde
2724No match
2725
2726/ab(c){0,0}d/
2727 abd
2728 0: abd
2729\= Expect no match
2730 abcd
2731No match
2732
2733/a(b*)/
2734 a
2735 0: a
2736 1:
2737 ab
2738 0: ab
2739 1: b
2740 abbbb
2741 0: abbbb
2742 1: bbbb
2743\= Expect no match
2744 bbbbb
2745No match
2746
2747/ab\d{0}e/
2748 abe
2749 0: abe
2750\= Expect no match
2751 ab1e
2752No match
2753
2754/"([^\\"]+|\\.)*"/
2755 the \"quick\" brown fox
2756 0: "quick"
2757 1: quick
2758 \"the \\\"quick\\\" brown fox\"
2759 0: "the \"quick\" brown fox"
2760 1: brown fox
2761
2762/<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
2763 <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>
2764 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>
2765 1: BGCOLOR='#DBE9E9'
2766 2: align=left valign=top
2767 3: 43.
2768 4: <a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)
2769 5:
2770 6:
2771 7: <unset>
2772 8: align=left valign=top
2773 9: Lega lstaff.com
277410: align=left valign=top
277511: CA - Statewide
2776
2777/a[^a]b/
2778 acb
2779 0: acb
2780 a\nb
2781 0: a\x0ab
2782
2783/a.b/
2784 acb
2785 0: acb
2786\= Expect no match
2787 a\nb
2788No match
2789
2790/a[^a]b/s
2791 acb
2792 0: acb
2793 a\nb
2794 0: a\x0ab
2795
2796/a.b/s
2797 acb
2798 0: acb
2799 a\nb
2800 0: a\x0ab
2801
2802/^(b+?|a){1,2}?c/
2803 bac
2804 0: bac
2805 1: a
2806 bbac
2807 0: bbac
2808 1: a
2809 bbbac
2810 0: bbbac
2811 1: a
2812 bbbbac
2813 0: bbbbac
2814 1: a
2815 bbbbbac
2816 0: bbbbbac
2817 1: a
2818
2819/^(b+|a){1,2}?c/
2820 bac
2821 0: bac
2822 1: a
2823 bbac
2824 0: bbac
2825 1: a
2826 bbbac
2827 0: bbbac
2828 1: a
2829 bbbbac
2830 0: bbbbac
2831 1: a
2832 bbbbbac
2833 0: bbbbbac
2834 1: a
2835
2836/(?!\A)x/m
2837 a\bx\n
2838 0: x
2839 a\nx\n
2840 0: x
2841\= Expect no match
2842 x\nb\n
2843No match
2844
2845/(A|B)*?CD/
2846 CD
2847 0: CD
2848
2849/(A|B)*CD/
2850 CD
2851 0: CD
2852
2853/(AB)*?\1/
2854 ABABAB
2855 0: ABAB
2856 1: AB
2857
2858/(AB)*\1/
2859 ABABAB
2860 0: ABABAB
2861 1: AB
2862
2863/(?<!bar)foo/
2864 foo
2865 0: foo
2866 catfood
2867 0: foo
2868 arfootle
2869 0: foo
2870 rfoosh
2871 0: foo
2872\= Expect no match
2873 barfoo
2874No match
2875 towbarfoo
2876No match
2877
2878/\w{3}(?<!bar)foo/
2879 catfood
2880 0: catfoo
2881\= Expect no match
2882 foo
2883No match
2884 barfoo
2885No match
2886 towbarfoo
2887No match
2888
2889/(?<=(foo)a)bar/
2890 fooabar
2891 0: bar
2892 1: foo
2893\= Expect no match
2894 bar
2895No match
2896 foobbar
2897No match
2898
2899/\Aabc\z/m
2900 abc
2901 0: abc
2902\= Expect no match
2903 abc\n
2904No match
2905 qqq\nabc
2906No match
2907 abc\nzzz
2908No match
2909 qqq\nabc\nzzz
2910No match
2911
2912"(?>.*/)foo"
2913 /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
2914 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
2915\= Expect no match
2916 /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
2917No match
2918
2919/(?>(\.\d\d[1-9]?))\d+/
2920 1.230003938
2921 0: .230003938
2922 1: .23
2923 1.875000282
2924 0: .875000282
2925 1: .875
2926\= Expect no match
2927 1.235
2928No match
2929
2930/^((?>\w+)|(?>\s+))*$/
2931 now is the time for all good men to come to the aid of the party
2932 0: now is the time for all good men to come to the aid of the party
2933 1: party
2934\= Expect no match
2935 this is not a line with only words and spaces!
2936No match
2937
2938/(\d+)(\w)/
2939 12345a
2940 0: 12345a
2941 1: 12345
2942 2: a
2943 12345+
2944 0: 12345
2945 1: 1234
2946 2: 5
2947
2948/((?>\d+))(\w)/
2949 12345a
2950 0: 12345a
2951 1: 12345
2952 2: a
2953\= Expect no match
2954 12345+
2955No match
2956
2957/(?>a+)b/
2958 aaab
2959 0: aaab
2960
2961/((?>a+)b)/
2962 aaab
2963 0: aaab
2964 1: aaab
2965
2966/(?>(a+))b/
2967 aaab
2968 0: aaab
2969 1: aaa
2970
2971/(?>b)+/
2972 aaabbbccc
2973 0: bbb
2974
2975/(?>a+|b+|c+)*c/
2976 aaabbbbccccd
2977 0: aaabbbbc
2978
2979/((?>[^()]+)|\([^()]*\))+/
2980 ((abc(ade)ufh()()x
2981 0: abc(ade)ufh()()x
2982 1: x
2983
2984/\(((?>[^()]+)|\([^()]+\))+\)/
2985 (abc)
2986 0: (abc)
2987 1: abc
2988 (abc(def)xyz)
2989 0: (abc(def)xyz)
2990 1: xyz
2991\= Expect no match
2992 ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
2993No match
2994
2995/a(?-i)b/i
2996 ab
2997 0: ab
2998 Ab
2999 0: Ab
3000\= Expect no match
3001 aB
3002No match
3003 AB
3004No match
3005
3006/(a (?x)b c)d e/
3007 a bcd e
3008 0: a bcd e
3009 1: a bc
3010\= Expect no match
3011 a b cd e
3012No match
3013 abcd e
3014No match
3015 a bcde
3016No match
3017
3018/(a b(?x)c d (?-x)e f)/
3019 a bcde f
3020 0: a bcde f
3021 1: a bcde f
3022\= Expect no match
3023 abcdef
3024No match
3025
3026/(a(?i)b)c/
3027 abc
3028 0: abc
3029 1: ab
3030 aBc
3031 0: aBc
3032 1: aB
3033\= Expect no match
3034 abC
3035No match
3036 aBC
3037No match
3038 Abc
3039No match
3040 ABc
3041No match
3042 ABC
3043No match
3044 AbC
3045No match
3046
3047/a(?i:b)c/
3048 abc
3049 0: abc
3050 aBc
3051 0: aBc
3052\= Expect no match
3053 ABC
3054No match
3055 abC
3056No match
3057 aBC
3058No match
3059
3060/a(?i:b)*c/
3061 aBc
3062 0: aBc
3063 aBBc
3064 0: aBBc
3065\= Expect no match
3066 aBC
3067No match
3068 aBBC
3069No match
3070
3071/a(?=b(?i)c)\w\wd/
3072 abcd
3073 0: abcd
3074 abCd
3075 0: abCd
3076\= Expect no match
3077 aBCd
3078No match
3079 abcD
3080No match
3081
3082/(?s-i:more.*than).*million/i
3083 more than million
3084 0: more than million
3085 more than MILLION
3086 0: more than MILLION
3087 more \n than Million
3088 0: more \x0a than Million
3089\= Expect no match
3090 MORE THAN MILLION
3091No match
3092 more \n than \n million
3093No match
3094
3095/(?:(?s-i)more.*than).*million/i
3096 more than million
3097 0: more than million
3098 more than MILLION
3099 0: more than MILLION
3100 more \n than Million
3101 0: more \x0a than Million
3102\= Expect no match
3103 MORE THAN MILLION
3104No match
3105 more \n than \n million
3106No match
3107
3108/(?>a(?i)b+)+c/
3109 abc
3110 0: abc
3111 aBbc
3112 0: aBbc
3113 aBBc
3114 0: aBBc
3115\= Expect no match
3116 Abc
3117No match
3118 abAb
3119No match
3120 abbC
3121No match
3122
3123/(?=a(?i)b)\w\wc/
3124 abc
3125 0: abc
3126 aBc
3127 0: aBc
3128\= Expect no match
3129 Ab
3130No match
3131 abC
3132No match
3133 aBC
3134No match
3135
3136/(?<=a(?i)b)(\w\w)c/
3137 abxxc
3138 0: xxc
3139 1: xx
3140 aBxxc
3141 0: xxc
3142 1: xx
3143\= Expect no match
3144 Abxxc
3145No match
3146 ABxxc
3147No match
3148 abxxC
3149No match
3150
3151/(?:(a)|b)(?(1)A|B)/
3152 aA
3153 0: aA
3154 1: a
3155 bB
3156 0: bB
3157\= Expect no match
3158 aB
3159No match
3160 bA
3161No match
3162
3163/^(a)?(?(1)a|b)+$/
3164 aa
3165 0: aa
3166 1: a
3167 b
3168 0: b
3169 bb
3170 0: bb
3171\= Expect no match
3172 ab
3173No match
3174
3175# Perl gets this next one wrong if the pattern ends with $; in that case it
3176# fails to match "12".
3177
3178/^(?(?=abc)\w{3}:|\d\d)/
3179 abc:
3180 0: abc:
3181 12
3182 0: 12
3183 123
3184 0: 12
3185\= Expect no match
3186 xyz
3187No match
3188
3189/^(?(?!abc)\d\d|\w{3}:)$/
3190 abc:
3191 0: abc:
3192 12
3193 0: 12
3194\= Expect no match
3195 123
3196No match
3197 xyz
3198No match
3199
3200/(?(?<=foo)bar|cat)/
3201 foobar
3202 0: bar
3203 cat
3204 0: cat
3205 fcat
3206 0: cat
3207 focat
3208 0: cat
3209\= Expect no match
3210 foocat
3211No match
3212
3213/(?(?<!foo)cat|bar)/
3214 foobar
3215 0: bar
3216 cat
3217 0: cat
3218 fcat
3219 0: cat
3220 focat
3221 0: cat
3222\= Expect no match
3223 foocat
3224No match
3225
3226/( \( )? [^()]+ (?(1) \) |) /x
3227 abcd
3228 0: abcd
3229 (abcd)
3230 0: (abcd)
3231 1: (
3232 the quick (abcd) fox
3233 0: the quick
3234 (abcd
3235 0: abcd
3236
3237/( \( )? [^()]+ (?(1) \) ) /x
3238 abcd
3239 0: abcd
3240 (abcd)
3241 0: (abcd)
3242 1: (
3243 the quick (abcd) fox
3244 0: the quick
3245 (abcd
3246 0: abcd
3247
3248/^(?(2)a|(1)(2))+$/
3249 12
3250 0: 12
3251 1: 1
3252 2: 2
3253 12a
3254 0: 12a
3255 1: 1
3256 2: 2
3257 12aa
3258 0: 12aa
3259 1: 1
3260 2: 2
3261\= Expect no match
3262 1234
3263No match
3264
3265/((?i)blah)\s+\1/
3266 blah blah
3267 0: blah blah
3268 1: blah
3269 BLAH BLAH
3270 0: BLAH BLAH
3271 1: BLAH
3272 Blah Blah
3273 0: Blah Blah
3274 1: Blah
3275 blaH blaH
3276 0: blaH blaH
3277 1: blaH
3278\= Expect no match
3279 blah BLAH
3280No match
3281 Blah blah
3282No match
3283 blaH blah
3284No match
3285
3286/((?i)blah)\s+(?i:\1)/
3287 blah blah
3288 0: blah blah
3289 1: blah
3290 BLAH BLAH
3291 0: BLAH BLAH
3292 1: BLAH
3293 Blah Blah
3294 0: Blah Blah
3295 1: Blah
3296 blaH blaH
3297 0: blaH blaH
3298 1: blaH
3299 blah BLAH
3300 0: blah BLAH
3301 1: blah
3302 Blah blah
3303 0: Blah blah
3304 1: Blah
3305 blaH blah
3306 0: blaH blah
3307 1: blaH
3308
3309/(?>a*)*/
3310 a
3311 0: a
3312 aa
3313 0: aa
3314 aaaa
3315 0: aaaa
3316
3317/(abc|)+/
3318 abc
3319 0: abc
3320 1:
3321 abcabc
3322 0: abcabc
3323 1:
3324 abcabcabc
3325 0: abcabcabc
3326 1:
3327 xyz
3328 0:
3329 1:
3330
3331/([a]*)*/
3332 a
3333 0: a
3334 1:
3335 aaaaa
3336 0: aaaaa
3337 1:
3338
3339/([ab]*)*/
3340 a
3341 0: a
3342 1:
3343 b
3344 0: b
3345 1:
3346 ababab
3347 0: ababab
3348 1:
3349 aaaabcde
3350 0: aaaab
3351 1:
3352 bbbb
3353 0: bbbb
3354 1:
3355
3356/([^a]*)*/
3357 b
3358 0: b
3359 1:
3360 bbbb
3361 0: bbbb
3362 1:
3363 aaa
3364 0:
3365 1:
3366
3367/([^ab]*)*/
3368 cccc
3369 0: cccc
3370 1:
3371 abab
3372 0:
3373 1:
3374
3375/([a]*?)*/
3376 a
3377 0:
3378 1:
3379 aaaa
3380 0:
3381 1:
3382
3383/([ab]*?)*/
3384 a
3385 0:
3386 1:
3387 b
3388 0:
3389 1:
3390 abab
3391 0:
3392 1:
3393 baba
3394 0:
3395 1:
3396
3397/([^a]*?)*/
3398 b
3399 0:
3400 1:
3401 bbbb
3402 0:
3403 1:
3404 aaa
3405 0:
3406 1:
3407
3408/([^ab]*?)*/
3409 c
3410 0:
3411 1:
3412 cccc
3413 0:
3414 1:
3415 baba
3416 0:
3417 1:
3418
3419/(?>a*)*/
3420 a
3421 0: a
3422 aaabcde
3423 0: aaa
3424
3425/((?>a*))*/
3426 aaaaa
3427 0: aaaaa
3428 1:
3429 aabbaa
3430 0: aa
3431 1:
3432
3433/((?>a*?))*/
3434 aaaaa
3435 0:
3436 1:
3437 aabbaa
3438 0:
3439 1:
3440
3441/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x
3442 12-sep-98
3443 0: 12-sep-98
3444 12-09-98
3445 0: 12-09-98
3446\= Expect no match
3447 sep-12-98
3448No match
3449
3450/(?<=(foo))bar\1/
3451 foobarfoo
3452 0: barfoo
3453 1: foo
3454 foobarfootling
3455 0: barfoo
3456 1: foo
3457\= Expect no match
3458 foobar
3459No match
3460 barfoo
3461No match
3462
3463/(?i:saturday|sunday)/
3464 saturday
3465 0: saturday
3466 sunday
3467 0: sunday
3468 Saturday
3469 0: Saturday
3470 Sunday
3471 0: Sunday
3472 SATURDAY
3473 0: SATURDAY
3474 SUNDAY
3475 0: SUNDAY
3476 SunDay
3477 0: SunDay
3478
3479/(a(?i)bc|BB)x/
3480 abcx
3481 0: abcx
3482 1: abc
3483 aBCx
3484 0: aBCx
3485 1: aBC
3486 bbx
3487 0: bbx
3488 1: bb
3489 BBx
3490 0: BBx
3491 1: BB
3492\= Expect no match
3493 abcX
3494No match
3495 aBCX
3496No match
3497 bbX
3498No match
3499 BBX
3500No match
3501
3502/^([ab](?i)[cd]|[ef])/
3503 ac
3504 0: ac
3505 1: ac
3506 aC
3507 0: aC
3508 1: aC
3509 bD
3510 0: bD
3511 1: bD
3512 elephant
3513 0: e
3514 1: e
3515 Europe
3516 0: E
3517 1: E
3518 frog
3519 0: f
3520 1: f
3521 France
3522 0: F
3523 1: F
3524\= Expect no match
3525 Africa
3526No match
3527
3528/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
3529 ab
3530 0: ab
3531 1: ab
3532 aBd
3533 0: aBd
3534 1: aBd
3535 xy
3536 0: xy
3537 1: xy
3538 xY
3539 0: xY
3540 1: xY
3541 zebra
3542 0: z
3543 1: z
3544 Zambesi
3545 0: Z
3546 1: Z
3547\= Expect no match
3548 aCD
3549No match
3550 XY
3551No match
3552
3553/(?<=foo\n)^bar/m
3554 foo\nbar
3555 0: bar
3556\= Expect no match
3557 bar
3558No match
3559 baz\nbar
3560No match
3561
3562/(?<=(?<!foo)bar)baz/
3563 barbaz
3564 0: baz
3565 barbarbaz
3566 0: baz
3567 koobarbaz
3568 0: baz
3569\= Expect no match
3570 baz
3571No match
3572 foobarbaz
3573No match
3574
3575# The cases of aaaa and aaaaaa are missed out below because Perl does things
3576# differently. We know that odd, and maybe incorrect, things happen with
3577# recursive references in Perl, as far as 5.11.3 - see some stuff in test #2.
3578
3579/^(a\1?){4}$/
3580 aaaaa
3581 0: aaaaa
3582 1: a
3583 aaaaaaa
3584 0: aaaaaaa
3585 1: a
3586 aaaaaaaaaa
3587 0: aaaaaaaaaa
3588 1: aaaa
3589\= Expect no match
3590 a
3591No match
3592 aa
3593No match
3594 aaa
3595No match
3596 aaaaaaaa
3597No match
3598 aaaaaaaaa
3599No match
3600 aaaaaaaaaaa
3601No match
3602 aaaaaaaaaaaa
3603No match
3604 aaaaaaaaaaaaa
3605No match
3606 aaaaaaaaaaaaaa
3607No match
3608 aaaaaaaaaaaaaaa
3609No match
3610 aaaaaaaaaaaaaaaa
3611No match
3612
3613/^(a\1?)(a\1?)(a\2?)(a\3?)$/
3614 aaaa
3615 0: aaaa
3616 1: a
3617 2: a
3618 3: a
3619 4: a
3620 aaaaa
3621 0: aaaaa
3622 1: a
3623 2: aa
3624 3: a
3625 4: a
3626 aaaaaa
3627 0: aaaaaa
3628 1: a
3629 2: aa
3630 3: a
3631 4: aa
3632 aaaaaaa
3633 0: aaaaaaa
3634 1: a
3635 2: aa
3636 3: aaa
3637 4: a
3638 aaaaaaaaaa
3639 0: aaaaaaaaaa
3640 1: a
3641 2: aa
3642 3: aaa
3643 4: aaaa
3644\= Expect no match
3645 a
3646No match
3647 aa
3648No match
3649 aaa
3650No match
3651 aaaaaaaa
3652No match
3653 aaaaaaaaa
3654No match
3655 aaaaaaaaaaa
3656No match
3657 aaaaaaaaaaaa
3658No match
3659 aaaaaaaaaaaaa
3660No match
3661 aaaaaaaaaaaaaa
3662No match
3663 aaaaaaaaaaaaaaa
3664No match
3665 aaaaaaaaaaaaaaaa
3666No match
3667
3668# The following tests are taken from the Perl 5.005 test suite; some of them
3669# are compatible with 5.004, but I'd rather not have to sort them out.
3670
3671/abc/
3672 abc
3673 0: abc
3674 xabcy
3675 0: abc
3676 ababc
3677 0: abc
3678\= Expect no match
3679 xbc
3680No match
3681 axc
3682No match
3683 abx
3684No match
3685
3686/ab*c/
3687 abc
3688 0: abc
3689
3690/ab*bc/
3691 abc
3692 0: abc
3693 abbc
3694 0: abbc
3695 abbbbc
3696 0: abbbbc
3697
3698/.{1}/
3699 abbbbc
3700 0: a
3701
3702/.{3,4}/
3703 abbbbc
3704 0: abbb
3705
3706/ab{0,}bc/
3707 abbbbc
3708 0: abbbbc
3709
3710/ab+bc/
3711 abbc
3712 0: abbc
3713\= Expect no match
3714 abc
3715No match
3716 abq
3717No match
3718
3719/ab{1,}bc/
3720
3721/ab+bc/
3722 abbbbc
3723 0: abbbbc
3724
3725/ab{1,}bc/
3726 abbbbc
3727 0: abbbbc
3728
3729/ab{1,3}bc/
3730 abbbbc
3731 0: abbbbc
3732
3733/ab{3,4}bc/
3734 abbbbc
3735 0: abbbbc
3736
3737/ab{4,5}bc/
3738\= Expect no match
3739 abq
3740No match
3741 abbbbc
3742No match
3743
3744/ab?bc/
3745 abbc
3746 0: abbc
3747 abc
3748 0: abc
3749
3750/ab{0,1}bc/
3751 abc
3752 0: abc
3753
3754/ab?bc/
3755
3756/ab?c/
3757 abc
3758 0: abc
3759
3760/ab{0,1}c/
3761 abc
3762 0: abc
3763
3764/^abc$/
3765 abc
3766 0: abc
3767\= Expect no match
3768 abbbbc
3769No match
3770 abcc
3771No match
3772
3773/^abc/
3774 abcc
3775 0: abc
3776
3777/^abc$/
3778
3779/abc$/
3780 aabc
3781 0: abc
3782\= Expect no match
3783 aabcd
3784No match
3785
3786/^/
3787 abc
3788 0:
3789
3790/$/
3791 abc
3792 0:
3793
3794/a.c/
3795 abc
3796 0: abc
3797 axc
3798 0: axc
3799
3800/a.*c/
3801 axyzc
3802 0: axyzc
3803
3804/a[bc]d/
3805 abd
3806 0: abd
3807\= Expect no match
3808 axyzd
3809No match
3810 abc
3811No match
3812
3813/a[b-d]e/
3814 ace
3815 0: ace
3816
3817/a[b-d]/
3818 aac
3819 0: ac
3820
3821/a[-b]/
3822 a-
3823 0: a-
3824
3825/a[b-]/
3826 a-
3827 0: a-
3828
3829/a]/
3830 a]
3831 0: a]
3832
3833/a[]]b/
3834 a]b
3835 0: a]b
3836
3837/a[^bc]d/
3838 aed
3839 0: aed
3840\= Expect no match
3841 abd
3842No match
3843 abd
3844No match
3845
3846/a[^-b]c/
3847 adc
3848 0: adc
3849
3850/a[^]b]c/
3851 adc
3852 0: adc
3853 a-c
3854 0: a-c
3855\= Expect no match
3856 a]c
3857No match
3858
3859/\ba\b/
3860 a-
3861 0: a
3862 -a
3863 0: a
3864 -a-
3865 0: a
3866
3867/\by\b/
3868\= Expect no match
3869 xy
3870No match
3871 yz
3872No match
3873 xyz
3874No match
3875
3876/\Ba\B/
3877\= Expect no match
3878 a-
3879No match
3880 -a
3881No match
3882 -a-
3883No match
3884
3885/\By\b/
3886 xy
3887 0: y
3888
3889/\by\B/
3890 yz
3891 0: y
3892
3893/\By\B/
3894 xyz
3895 0: y
3896
3897/\w/
3898 a
3899 0: a
3900
3901/\W/
3902 -
3903 0: -
3904\= Expect no match
3905 a
3906No match
3907
3908/a\sb/
3909 a b
3910 0: a b
3911
3912/a\Sb/
3913 a-b
3914 0: a-b
3915\= Expect no match
3916 a b
3917No match
3918
3919/\d/
3920 1
3921 0: 1
3922
3923/\D/
3924 -
3925 0: -
3926\= Expect no match
3927 1
3928No match
3929
3930/[\w]/
3931 a
3932 0: a
3933
3934/[\W]/
3935 -
3936 0: -
3937\= Expect no match
3938 a
3939No match
3940
3941/a[\s]b/
3942 a b
3943 0: a b
3944
3945/a[\S]b/
3946 a-b
3947 0: a-b
3948\= Expect no match
3949 a b
3950No match
3951
3952/[\d]/
3953 1
3954 0: 1
3955
3956/[\D]/
3957 -
3958 0: -
3959\= Expect no match
3960 1
3961No match
3962
3963/ab|cd/
3964 abc
3965 0: ab
3966 abcd
3967 0: ab
3968
3969/()ef/
3970 def
3971 0: ef
3972 1:
3973
3974/$b/
3975
3976/a\(b/
3977 a(b
3978 0: a(b
3979
3980/a\(*b/
3981 ab
3982 0: ab
3983 a((b
3984 0: a((b
3985
3986/a\\b/
3987 a\\b
3988 0: a\b
3989
3990/((a))/
3991 abc
3992 0: a
3993 1: a
3994 2: a
3995
3996/(a)b(c)/
3997 abc
3998 0: abc
3999 1: a
4000 2: c
4001
4002/a+b+c/
4003 aabbabc
4004 0: abc
4005
4006/a{1,}b{1,}c/
4007 aabbabc
4008 0: abc
4009
4010/a.+?c/
4011 abcabc
4012 0: abc
4013
4014/(a+|b)*/
4015 ab
4016 0: ab
4017 1: b
4018
4019/(a+|b){0,}/
4020 ab
4021 0: ab
4022 1: b
4023
4024/(a+|b)+/
4025 ab
4026 0: ab
4027 1: b
4028
4029/(a+|b){1,}/
4030 ab
4031 0: ab
4032 1: b
4033
4034/(a+|b)?/
4035 ab
4036 0: a
4037 1: a
4038
4039/(a+|b){0,1}/
4040 ab
4041 0: a
4042 1: a
4043
4044/[^ab]*/
4045 cde
4046 0: cde
4047
4048/abc/
4049\= Expect no match
4050 b
4051No match
4052
4053/a*/
4054 \
4055 0:
4056
4057/([abc])*d/
4058 abbbcd
4059 0: abbbcd
4060 1: c
4061
4062/([abc])*bcd/
4063 abcd
4064 0: abcd
4065 1: a
4066
4067/a|b|c|d|e/
4068 e
4069 0: e
4070
4071/(a|b|c|d|e)f/
4072 ef
4073 0: ef
4074 1: e
4075
4076/abcd*efg/
4077 abcdefg
4078 0: abcdefg
4079
4080/ab*/
4081 xabyabbbz
4082 0: ab
4083 xayabbbz
4084 0: a
4085
4086/(ab|cd)e/
4087 abcde
4088 0: cde
4089 1: cd
4090
4091/[abhgefdc]ij/
4092 hij
4093 0: hij
4094
4095/^(ab|cd)e/
4096
4097/(abc|)ef/
4098 abcdef
4099 0: ef
4100 1:
4101
4102/(a|b)c*d/
4103 abcd
4104 0: bcd
4105 1: b
4106
4107/(ab|ab*)bc/
4108 abc
4109 0: abc
4110 1: a
4111
4112/a([bc]*)c*/
4113 abc
4114 0: abc
4115 1: bc
4116
4117/a([bc]*)(c*d)/
4118 abcd
4119 0: abcd
4120 1: bc
4121 2: d
4122
4123/a([bc]+)(c*d)/
4124 abcd
4125 0: abcd
4126 1: bc
4127 2: d
4128
4129/a([bc]*)(c+d)/
4130 abcd
4131 0: abcd
4132 1: b
4133 2: cd
4134
4135/a[bcd]*dcdcde/
4136 adcdcde
4137 0: adcdcde
4138
4139/a[bcd]+dcdcde/
4140\= Expect no match
4141 abcde
4142No match
4143 adcdcde
4144No match
4145
4146/(ab|a)b*c/
4147 abc
4148 0: abc
4149 1: ab
4150
4151/((a)(b)c)(d)/
4152 abcd
4153 0: abcd
4154 1: abc
4155 2: a
4156 3: b
4157 4: d
4158
4159/[a-zA-Z_][a-zA-Z0-9_]*/
4160 alpha
4161 0: alpha
4162
4163/^a(bc+|b[eh])g|.h$/
4164 abh
4165 0: bh
4166
4167/(bc+d$|ef*g.|h?i(j|k))/
4168 effgz
4169 0: effgz
4170 1: effgz
4171 ij
4172 0: ij
4173 1: ij
4174 2: j
4175 reffgz
4176 0: effgz
4177 1: effgz
4178\= Expect no match
4179 effg
4180No match
4181 bcdd
4182No match
4183
4184/((((((((((a))))))))))/
4185 a
4186 0: a
4187 1: a
4188 2: a
4189 3: a
4190 4: a
4191 5: a
4192 6: a
4193 7: a
4194 8: a
4195 9: a
419610: a
4197
4198/((((((((((a))))))))))\10/
4199 aa
4200 0: aa
4201 1: a
4202 2: a
4203 3: a
4204 4: a
4205 5: a
4206 6: a
4207 7: a
4208 8: a
4209 9: a
421010: a
4211
4212/(((((((((a)))))))))/
4213 a
4214 0: a
4215 1: a
4216 2: a
4217 3: a
4218 4: a
4219 5: a
4220 6: a
4221 7: a
4222 8: a
4223 9: a
4224
4225/multiple words of text/
4226\= Expect no match
4227 aa
4228No match
4229 uh-uh
4230No match
4231
4232/multiple words/
4233 multiple words, yeah
4234 0: multiple words
4235
4236/(.*)c(.*)/
4237 abcde
4238 0: abcde
4239 1: ab
4240 2: de
4241
4242/\((.*), (.*)\)/
4243 (a, b)
4244 0: (a, b)
4245 1: a
4246 2: b
4247
4248/[k]/
4249
4250/abcd/
4251 abcd
4252 0: abcd
4253
4254/a(bc)d/
4255 abcd
4256 0: abcd
4257 1: bc
4258
4259/a[-]?c/
4260 ac
4261 0: ac
4262
4263/(abc)\1/
4264 abcabc
4265 0: abcabc
4266 1: abc
4267
4268/([a-c]*)\1/
4269 abcabc
4270 0: abcabc
4271 1: abc
4272
4273/(a)|\1/
4274 a
4275 0: a
4276 1: a
4277 ab
4278 0: a
4279 1: a
4280\= Expect no match
4281 x
4282No match
4283
4284/(([a-c])b*?\2)*/
4285 ababbbcbc
4286 0: ababb
4287 1: bb
4288 2: b
4289
4290/(([a-c])b*?\2){3}/
4291 ababbbcbc
4292 0: ababbbcbc
4293 1: cbc
4294 2: c
4295
4296/((\3|b)\2(a)x)+/
4297 aaaxabaxbaaxbbax
4298 0: bbax
4299 1: bbax
4300 2: b
4301 3: a
4302
4303/((\3|b)\2(a)){2,}/
4304 bbaababbabaaaaabbaaaabba
4305 0: bbaaaabba
4306 1: bba
4307 2: b
4308 3: a
4309
4310/abc/i
4311 ABC
4312 0: ABC
4313 XABCY
4314 0: ABC
4315 ABABC
4316 0: ABC
4317\= Expect no match
4318 aaxabxbaxbbx
4319No match
4320 XBC
4321No match
4322 AXC
4323No match
4324 ABX
4325No match
4326
4327/ab*c/i
4328 ABC
4329 0: ABC
4330
4331/ab*bc/i
4332 ABC
4333 0: ABC
4334 ABBC
4335 0: ABBC
4336
4337/ab*?bc/i
4338 ABBBBC
4339 0: ABBBBC
4340
4341/ab{0,}?bc/i
4342 ABBBBC
4343 0: ABBBBC
4344
4345/ab+?bc/i
4346 ABBC
4347 0: ABBC
4348
4349/ab+bc/i
4350\= Expect no match
4351 ABC
4352No match
4353 ABQ
4354No match
4355
4356/ab{1,}bc/i
4357
4358/ab+bc/i
4359 ABBBBC
4360 0: ABBBBC
4361
4362/ab{1,}?bc/i
4363 ABBBBC
4364 0: ABBBBC
4365
4366/ab{1,3}?bc/i
4367 ABBBBC
4368 0: ABBBBC
4369
4370/ab{3,4}?bc/i
4371 ABBBBC
4372 0: ABBBBC
4373
4374/ab{4,5}?bc/i
4375\= Expect no match
4376 ABQ
4377No match
4378 ABBBBC
4379No match
4380
4381/ab??bc/i
4382 ABBC
4383 0: ABBC
4384 ABC
4385 0: ABC
4386
4387/ab{0,1}?bc/i
4388 ABC
4389 0: ABC
4390
4391/ab??bc/i
4392
4393/ab??c/i
4394 ABC
4395 0: ABC
4396
4397/ab{0,1}?c/i
4398 ABC
4399 0: ABC
4400
4401/^abc$/i
4402 ABC
4403 0: ABC
4404\= Expect no match
4405 ABBBBC
4406No match
4407 ABCC
4408No match
4409
4410/^abc/i
4411 ABCC
4412 0: ABC
4413
4414/^abc$/i
4415
4416/abc$/i
4417 AABC
4418 0: ABC
4419
4420/^/i
4421 ABC
4422 0:
4423
4424/$/i
4425 ABC
4426 0:
4427
4428/a.c/i
4429 ABC
4430 0: ABC
4431 AXC
4432 0: AXC
4433
4434/a.*?c/i
4435 AXYZC
4436 0: AXYZC
4437
4438/a.*c/i
4439 AABC
4440 0: AABC
4441\= Expect no match
4442 AXYZD
4443No match
4444
4445/a[bc]d/i
4446 ABD
4447 0: ABD
4448
4449/a[b-d]e/i
4450 ACE
4451 0: ACE
4452\= Expect no match
4453 ABC
4454No match
4455 ABD
4456No match
4457
4458/a[b-d]/i
4459 AAC
4460 0: AC
4461
4462/a[-b]/i
4463 A-
4464 0: A-
4465
4466/a[b-]/i
4467 A-
4468 0: A-
4469
4470/a]/i
4471 A]
4472 0: A]
4473
4474/a[]]b/i
4475 A]B
4476 0: A]B
4477
4478/a[^bc]d/i
4479 AED
4480 0: AED
4481
4482/a[^-b]c/i
4483 ADC
4484 0: ADC
4485\= Expect no match
4486 ABD
4487No match
4488 A-C
4489No match
4490
4491/a[^]b]c/i
4492 ADC
4493 0: ADC
4494
4495/ab|cd/i
4496 ABC
4497 0: AB
4498 ABCD
4499 0: AB
4500
4501/()ef/i
4502 DEF
4503 0: EF
4504 1:
4505
4506/$b/i
4507\= Expect no match
4508 A]C
4509No match
4510 B
4511No match
4512
4513/a\(b/i
4514 A(B
4515 0: A(B
4516
4517/a\(*b/i
4518 AB
4519 0: AB
4520 A((B
4521 0: A((B
4522
4523/a\\b/i
4524 A\\b
4525 0: A\b
4526 a\\B
4527 0: a\B
4528
4529/((a))/i
4530 ABC
4531 0: A
4532 1: A
4533 2: A
4534
4535/(a)b(c)/i
4536 ABC
4537 0: ABC
4538 1: A
4539 2: C
4540
4541/a+b+c/i
4542 AABBABC
4543 0: ABC
4544
4545/a{1,}b{1,}c/i
4546 AABBABC
4547 0: ABC
4548
4549/a.+?c/i
4550 ABCABC
4551 0: ABC
4552
4553/a.*?c/i
4554 ABCABC
4555 0: ABC
4556
4557/a.{0,5}?c/i
4558 ABCABC
4559 0: ABC
4560
4561/(a+|b)*/i
4562 AB
4563 0: AB
4564 1: B
4565
4566/(a+|b){0,}/i
4567 AB
4568 0: AB
4569 1: B
4570
4571/(a+|b)+/i
4572 AB
4573 0: AB
4574 1: B
4575
4576/(a+|b){1,}/i
4577 AB
4578 0: AB
4579 1: B
4580
4581/(a+|b)?/i
4582 AB
4583 0: A
4584 1: A
4585
4586/(a+|b){0,1}/i
4587 AB
4588 0: A
4589 1: A
4590
4591/(a+|b){0,1}?/i
4592 AB
4593 0:
4594
4595/[^ab]*/i
4596 CDE
4597 0: CDE
4598
4599/([abc])*d/i
4600 ABBBCD
4601 0: ABBBCD
4602 1: C
4603
4604/([abc])*bcd/i
4605 ABCD
4606 0: ABCD
4607 1: A
4608
4609/a|b|c|d|e/i
4610 E
4611 0: E
4612
4613/(a|b|c|d|e)f/i
4614 EF
4615 0: EF
4616 1: E
4617
4618/abcd*efg/i
4619 ABCDEFG
4620 0: ABCDEFG
4621
4622/ab*/i
4623 XABYABBBZ
4624 0: AB
4625 XAYABBBZ
4626 0: A
4627
4628/(ab|cd)e/i
4629 ABCDE
4630 0: CDE
4631 1: CD
4632
4633/[abhgefdc]ij/i
4634 HIJ
4635 0: HIJ
4636
4637/^(ab|cd)e/i
4638\= Expect no match
4639 ABCDE
4640No match
4641
4642/(abc|)ef/i
4643 ABCDEF
4644 0: EF
4645 1:
4646
4647/(a|b)c*d/i
4648 ABCD
4649 0: BCD
4650 1: B
4651
4652/(ab|ab*)bc/i
4653 ABC
4654 0: ABC
4655 1: A
4656
4657/a([bc]*)c*/i
4658 ABC
4659 0: ABC
4660 1: BC
4661
4662/a([bc]*)(c*d)/i
4663 ABCD
4664 0: ABCD
4665 1: BC
4666 2: D
4667
4668/a([bc]+)(c*d)/i
4669 ABCD
4670 0: ABCD
4671 1: BC
4672 2: D
4673
4674/a([bc]*)(c+d)/i
4675 ABCD
4676 0: ABCD
4677 1: B
4678 2: CD
4679
4680/a[bcd]*dcdcde/i
4681 ADCDCDE
4682 0: ADCDCDE
4683
4684/a[bcd]+dcdcde/i
4685
4686/(ab|a)b*c/i
4687 ABC
4688 0: ABC
4689 1: AB
4690
4691/((a)(b)c)(d)/i
4692 ABCD
4693 0: ABCD
4694 1: ABC
4695 2: A
4696 3: B
4697 4: D
4698
4699/[a-zA-Z_][a-zA-Z0-9_]*/i
4700 ALPHA
4701 0: ALPHA
4702
4703/^a(bc+|b[eh])g|.h$/i
4704 ABH
4705 0: BH
4706
4707/(bc+d$|ef*g.|h?i(j|k))/i
4708 EFFGZ
4709 0: EFFGZ
4710 1: EFFGZ
4711 IJ
4712 0: IJ
4713 1: IJ
4714 2: J
4715 REFFGZ
4716 0: EFFGZ
4717 1: EFFGZ
4718\= Expect no match
4719 ADCDCDE
4720No match
4721 EFFG
4722No match
4723 BCDD
4724No match
4725
4726/((((((((((a))))))))))/i
4727 A
4728 0: A
4729 1: A
4730 2: A
4731 3: A
4732 4: A
4733 5: A
4734 6: A
4735 7: A
4736 8: A
4737 9: A
473810: A
4739
4740/((((((((((a))))))))))\10/i
4741 AA
4742 0: AA
4743 1: A
4744 2: A
4745 3: A
4746 4: A
4747 5: A
4748 6: A
4749 7: A
4750 8: A
4751 9: A
475210: A
4753
4754/(((((((((a)))))))))/i
4755 A
4756 0: A
4757 1: A
4758 2: A
4759 3: A
4760 4: A
4761 5: A
4762 6: A
4763 7: A
4764 8: A
4765 9: A
4766
4767/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
4768 A
4769 0: A
4770 1: A
4771
4772/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
4773 C
4774 0: C
4775 1: C
4776
4777/multiple words of text/i
4778\= Expect no match
4779 AA
4780No match
4781 UH-UH
4782No match
4783
4784/multiple words/i
4785 MULTIPLE WORDS, YEAH
4786 0: MULTIPLE WORDS
4787
4788/(.*)c(.*)/i
4789 ABCDE
4790 0: ABCDE
4791 1: AB
4792 2: DE
4793
4794/\((.*), (.*)\)/i
4795 (A, B)
4796 0: (A, B)
4797 1: A
4798 2: B
4799
4800/[k]/i
4801
4802/abcd/i
4803 ABCD
4804 0: ABCD
4805
4806/a(bc)d/i
4807 ABCD
4808 0: ABCD
4809 1: BC
4810
4811/a[-]?c/i
4812 AC
4813 0: AC
4814
4815/(abc)\1/i
4816 ABCABC
4817 0: ABCABC
4818 1: ABC
4819
4820/([a-c]*)\1/i
4821 ABCABC
4822 0: ABCABC
4823 1: ABC
4824
4825/a(?!b)./
4826 abad
4827 0: ad
4828
4829/a(?=d)./
4830 abad
4831 0: ad
4832
4833/a(?=c|d)./
4834 abad
4835 0: ad
4836
4837/a(?:b|c|d)(.)/
4838 ace
4839 0: ace
4840 1: e
4841
4842/a(?:b|c|d)*(.)/
4843 ace
4844 0: ace
4845 1: e
4846
4847/a(?:b|c|d)+?(.)/
4848 ace
4849 0: ace
4850 1: e
4851 acdbcdbe
4852 0: acd
4853 1: d
4854
4855/a(?:b|c|d)+(.)/
4856 acdbcdbe
4857 0: acdbcdbe
4858 1: e
4859
4860/a(?:b|c|d){2}(.)/
4861 acdbcdbe
4862 0: acdb
4863 1: b
4864
4865/a(?:b|c|d){4,5}(.)/
4866 acdbcdbe
4867 0: acdbcdb
4868 1: b
4869
4870/a(?:b|c|d){4,5}?(.)/
4871 acdbcdbe
4872 0: acdbcd
4873 1: d
4874
4875/((foo)|(bar))*/
4876 foobar
4877 0: foobar
4878 1: bar
4879 2: foo
4880 3: bar
4881
4882/a(?:b|c|d){6,7}(.)/
4883 acdbcdbe
4884 0: acdbcdbe
4885 1: e
4886
4887/a(?:b|c|d){6,7}?(.)/
4888 acdbcdbe
4889 0: acdbcdbe
4890 1: e
4891
4892/a(?:b|c|d){5,6}(.)/
4893 acdbcdbe
4894 0: acdbcdbe
4895 1: e
4896
4897/a(?:b|c|d){5,6}?(.)/
4898 acdbcdbe
4899 0: acdbcdb
4900 1: b
4901
4902/a(?:b|c|d){5,7}(.)/
4903 acdbcdbe
4904 0: acdbcdbe
4905 1: e
4906
4907/a(?:b|c|d){5,7}?(.)/
4908 acdbcdbe
4909 0: acdbcdb
4910 1: b
4911
4912/a(?:b|(c|e){1,2}?|d)+?(.)/
4913 ace
4914 0: ace
4915 1: c
4916 2: e
4917
4918/^(.+)?B/
4919 AB
4920 0: AB
4921 1: A
4922
4923/^([^a-z])|(\^)$/
4924 .
4925 0: .
4926 1: .
4927
4928/^[<>]&/
4929 <&OUT
4930 0: <&
4931
4932/^(a\1?){4}$/
4933 aaaaaaaaaa
4934 0: aaaaaaaaaa
4935 1: aaaa
4936\= Expect no match
4937 AB
4938No match
4939 aaaaaaaaa
4940No match
4941 aaaaaaaaaaa
4942No match
4943
4944/^(a(?(1)\1)){4}$/
4945 aaaaaaaaaa
4946 0: aaaaaaaaaa
4947 1: aaaa
4948\= Expect no match
4949 aaaaaaaaa
4950No match
4951 aaaaaaaaaaa
4952No match
4953
4954/(?:(f)(o)(o)|(b)(a)(r))*/
4955 foobar
4956 0: foobar
4957 1: f
4958 2: o
4959 3: o
4960 4: b
4961 5: a
4962 6: r
4963
4964/(?<=a)b/
4965 ab
4966 0: b
4967\= Expect no match
4968 cb
4969No match
4970 b
4971No match
4972
4973/(?<!c)b/
4974 ab
4975 0: b
4976 b
4977 0: b
4978 b
4979 0: b
4980
4981/(?:..)*a/
4982 aba
4983 0: aba
4984
4985/(?:..)*?a/
4986 aba
4987 0: a
4988
4989/^(?:b|a(?=(.)))*\1/
4990 abc
4991 0: ab
4992 1: b
4993
4994/^(){3,5}/
4995 abc
4996 0:
4997 1:
4998
4999/^(a+)*ax/
5000 aax
5001 0: aax
5002 1: a
5003
5004/^((a|b)+)*ax/
5005 aax
5006 0: aax
5007 1: a
5008 2: a
5009
5010/^((a|bc)+)*ax/
5011 aax
5012 0: aax
5013 1: a
5014 2: a
5015
5016/(a|x)*ab/
5017 cab
5018 0: ab
5019
5020/(a)*ab/
5021 cab
5022 0: ab
5023
5024/(?:(?i)a)b/
5025 ab
5026 0: ab
5027
5028/((?i)a)b/
5029 ab
5030 0: ab
5031 1: a
5032
5033/(?:(?i)a)b/
5034 Ab
5035 0: Ab
5036
5037/((?i)a)b/
5038 Ab
5039 0: Ab
5040 1: A
5041
5042/(?:(?i)a)b/
5043\= Expect no match
5044 cb
5045No match
5046 aB
5047No match
5048
5049/((?i)a)b/
5050
5051/(?i:a)b/
5052 ab
5053 0: ab
5054
5055/((?i:a))b/
5056 ab
5057 0: ab
5058 1: a
5059
5060/(?i:a)b/
5061 Ab
5062 0: Ab
5063
5064/((?i:a))b/
5065 Ab
5066 0: Ab
5067 1: A
5068
5069/(?i:a)b/
5070\= Expect no match
5071 aB
5072No match
5073 aB
5074No match
5075
5076/((?i:a))b/
5077
5078/(?:(?-i)a)b/i
5079 ab
5080 0: ab
5081
5082/((?-i)a)b/i
5083 ab
5084 0: ab
5085 1: a
5086
5087/(?:(?-i)a)b/i
5088 aB
5089 0: aB
5090
5091/((?-i)a)b/i
5092 aB
5093 0: aB
5094 1: a
5095
5096/(?:(?-i)a)b/i
5097 aB
5098 0: aB
5099\= Expect no match
5100 Ab
5101No match
5102 AB
5103No match
5104
5105/(?-i:a)b/i
5106 ab
5107 0: ab
5108
5109/((?-i:a))b/i
5110 ab
5111 0: ab
5112 1: a
5113
5114/(?-i:a)b/i
5115 aB
5116 0: aB
5117
5118/((?-i:a))b/i
5119 aB
5120 0: aB
5121 1: a
5122
5123/(?-i:a)b/i
5124\= Expect no match
5125 AB
5126No match
5127 Ab
5128No match
5129
5130/((?-i:a))b/i
5131
5132/(?-i:a)b/i
5133 aB
5134 0: aB
5135
5136/((?-i:a))b/i
5137 aB
5138 0: aB
5139 1: a
5140
5141/(?-i:a)b/i
5142\= Expect no match
5143 Ab
5144No match
5145 AB
5146No match
5147
5148/((?-i:a))b/i
5149
5150/((?-i:a.))b/i
5151\= Expect no match
5152 AB
5153No match
5154 a\nB
5155No match
5156
5157/((?s-i:a.))b/i
5158 a\nB
5159 0: a\x0aB
5160 1: a\x0a
5161
5162/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
5163 cabbbb
5164 0: cabbbb
5165
5166/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
5167 caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
5168 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
5169
5170/(ab)\d\1/i
5171 Ab4ab
5172 0: Ab4ab
5173 1: Ab
5174 ab4Ab
5175 0: ab4Ab
5176 1: ab
5177
5178/foo\w*\d{4}baz/
5179 foobar1234baz
5180 0: foobar1234baz
5181
5182/x(~~)*(?:(?:F)?)?/
5183 x~~
5184 0: x~~
5185 1: ~~
5186
5187/^a(?#xxx){3}c/
5188 aaac
5189 0: aaac
5190
5191/^a (?#xxx) (?#yyy) {3}c/x
5192 aaac
5193 0: aaac
5194
5195/(?<![cd])b/
5196\= Expect no match
5197 B\nB
5198No match
5199 dbcb
5200No match
5201
5202/(?<![cd])[ab]/
5203 dbaacb
5204 0: a
5205
5206/(?<!(c|d))b/
5207
5208/(?<!(c|d))[ab]/
5209 dbaacb
5210 0: a
5211
5212/(?<!cd)[ab]/
5213 cdaccb
5214 0: b
5215
5216/^(?:a?b?)*$/
5217 \
5218 0:
5219 a
5220 0: a
5221 ab
5222 0: ab
5223 aaa
5224 0: aaa
5225\= Expect no match
5226 dbcb
5227No match
5228 a--
5229No match
5230 aa--
5231No match
5232
5233/((?s)^a(.))((?m)^b$)/
5234 a\nb\nc\n
5235 0: a\x0ab
5236 1: a\x0a
5237 2: \x0a
5238 3: b
5239
5240/((?m)^b$)/
5241 a\nb\nc\n
5242 0: b
5243 1: b
5244
5245/(?m)^b/
5246 a\nb\n
5247 0: b
5248
5249/(?m)^(b)/
5250 a\nb\n
5251 0: b
5252 1: b
5253
5254/((?m)^b)/
5255 a\nb\n
5256 0: b
5257 1: b
5258
5259/\n((?m)^b)/
5260 a\nb\n
5261 0: \x0ab
5262 1: b
5263
5264/((?s).)c(?!.)/
5265 a\nb\nc\n
5266 0: \x0ac
5267 1: \x0a
5268 a\nb\nc\n
5269 0: \x0ac
5270 1: \x0a
5271
5272/((?s)b.)c(?!.)/
5273 a\nb\nc\n
5274 0: b\x0ac
5275 1: b\x0a
5276 a\nb\nc\n
5277 0: b\x0ac
5278 1: b\x0a
5279
5280/^b/
5281
5282/()^b/
5283\= Expect no match
5284 a\nb\nc\n
5285No match
5286 a\nb\nc\n
5287No match
5288
5289/((?m)^b)/
5290 a\nb\nc\n
5291 0: b
5292 1: b
5293
5294/(x)?(?(1)a|b)/
5295\= Expect no match
5296 a
5297No match
5298 a
5299No match
5300
5301/(x)?(?(1)b|a)/
5302 a
5303 0: a
5304
5305/()?(?(1)b|a)/
5306 a
5307 0: a
5308
5309/()(?(1)b|a)/
5310
5311/()?(?(1)a|b)/
5312 a
5313 0: a
5314 1:
5315
5316/^(\()?blah(?(1)(\)))$/
5317 (blah)
5318 0: (blah)
5319 1: (
5320 2: )
5321 blah
5322 0: blah
5323\= Expect no match
5324 a
5325No match
5326 blah)
5327No match
5328 (blah
5329No match
5330
5331/^(\(+)?blah(?(1)(\)))$/
5332 (blah)
5333 0: (blah)
5334 1: (
5335 2: )
5336 blah
5337 0: blah
5338\= Expect no match
5339 blah)
5340No match
5341 (blah
5342No match
5343
5344/(?(?!a)a|b)/
5345
5346/(?(?!a)b|a)/
5347 a
5348 0: a
5349
5350/(?(?=a)b|a)/
5351\= Expect no match
5352 a
5353No match
5354 a
5355No match
5356
5357/(?(?=a)a|b)/
5358 a
5359 0: a
5360
5361/(?=(a+?))(\1ab)/
5362 aaab
5363 0: aab
5364 1: a
5365 2: aab
5366
5367/^(?=(a+?))\1ab/
5368
5369/(\w+:)+/
5370 one:
5371 0: one:
5372 1: one:
5373
5374/$(?<=^(a))/
5375 a
5376 0:
5377 1: a
5378
5379/(?=(a+?))(\1ab)/
5380 aaab
5381 0: aab
5382 1: a
5383 2: aab
5384
5385/^(?=(a+?))\1ab/
5386\= Expect no match
5387 aaab
5388No match
5389 aaab
5390No match
5391
5392/([\w:]+::)?(\w+)$/
5393 abcd
5394 0: abcd
5395 1: <unset>
5396 2: abcd
5397 xy:z:::abcd
5398 0: xy:z:::abcd
5399 1: xy:z:::
5400 2: abcd
5401
5402/^[^bcd]*(c+)/
5403 aexycd
5404 0: aexyc
5405 1: c
5406
5407/(a*)b+/
5408 caab
5409 0: aab
5410 1: aa
5411
5412/([\w:]+::)?(\w+)$/
5413 abcd
5414 0: abcd
5415 1: <unset>
5416 2: abcd
5417 xy:z:::abcd
5418 0: xy:z:::abcd
5419 1: xy:z:::
5420 2: abcd
5421\= Expect no match
5422 abcd:
5423No match
5424 abcd:
5425No match
5426
5427/^[^bcd]*(c+)/
5428 aexycd
5429 0: aexyc
5430 1: c
5431
5432/(>a+)ab/
5433
5434/(?>a+)b/
5435 aaab
5436 0: aaab
5437
5438/([[:]+)/
5439 a:[b]:
5440 0: :[
5441 1: :[
5442
5443/([[=]+)/
5444 a=[b]=
5445 0: =[
5446 1: =[
5447
5448/([[.]+)/
5449 a.[b].
5450 0: .[
5451 1: .[
5452
5453/((?>a+)b)/
5454 aaab
5455 0: aaab
5456 1: aaab
5457
5458/(?>(a+))b/
5459 aaab
5460 0: aaab
5461 1: aaa
5462
5463/((?>[^()]+)|\([^()]*\))+/
5464 ((abc(ade)ufh()()x
5465 0: abc(ade)ufh()()x
5466 1: x
5467
5468/a\Z/
5469\= Expect no match
5470 aaab
5471No match
5472 a\nb\n
5473No match
5474
5475/b\Z/
5476 a\nb\n
5477 0: b
5478
5479/b\z/
5480
5481/b\Z/
5482 a\nb
5483 0: b
5484
5485/b\z/
5486 a\nb
5487 0: b
5488
5489/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
5490 a
5491 0: a
5492 1:
5493 abc
5494 0: abc
5495 1:
5496 a-b
5497 0: a-b
5498 1:
5499 0-9
5500 0: 0-9
5501 1:
5502 a.b
5503 0: a.b
5504 1:
5505 5.6.7
5506 0: 5.6.7
5507 1:
5508 the.quick.brown.fox
5509 0: the.quick.brown.fox
5510 1:
5511 a100.b200.300c
5512 0: a100.b200.300c
5513 1:
5514 12-ab.1245
5515 0: 12-ab.1245
5516 1:
5517\= Expect no match
5518 \
5519No match
5520 .a
5521No match
5522 -a
5523No match
5524 a-
5525No match
5526 a.
5527No match
5528 a_b
5529No match
5530 a.-
5531No match
5532 a..
5533No match
5534 ab..bc
5535No match
5536 the.quick.brown.fox-
5537No match
5538 the.quick.brown.fox.
5539No match
5540 the.quick.brown.fox_
5541No match
5542 the.quick.brown.fox+
5543No match
5544
5545/(?>.*)(?<=(abcd|wxyz))/
5546 alphabetabcd
5547 0: alphabetabcd
5548 1: abcd
5549 endingwxyz
5550 0: endingwxyz
5551 1: wxyz
5552\= Expect no match
5553 a rather long string that doesn't end with one of them
5554No match
5555
5556/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
5557 word cat dog elephant mussel cow horse canary baboon snake shark otherword
5558 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
5559\= Expect no match
5560 word cat dog elephant mussel cow horse canary baboon snake shark
5561No match
5562
5563/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
5564\= Expect no match
5565 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
5566No match
5567
5568/(?<=\d{3}(?!999))foo/
5569 999foo
5570 0: foo
5571 123999foo
5572 0: foo
5573\= Expect no match
5574 123abcfoo
5575No match
5576
5577/(?<=(?!...999)\d{3})foo/
5578 999foo
5579 0: foo
5580 123999foo
5581 0: foo
5582\= Expect no match
5583 123abcfoo
5584No match
5585
5586/(?<=\d{3}(?!999)...)foo/
5587 123abcfoo
5588 0: foo
5589 123456foo
5590 0: foo
5591\= Expect no match
5592 123999foo
5593No match
5594
5595/(?<=\d{3}...)(?<!999)foo/
5596 123abcfoo
5597 0: foo
5598 123456foo
5599 0: foo
5600\= Expect no match
5601 123999foo
5602No match
5603
5604/<a[\s]+href[\s]*=[\s]* # find <a href=
5605 ([\"\'])? # find single or double quote
5606 (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching
5607 # quote, otherwise match up to next space
5608/isx
5609 <a href=abcd xyz
5610 0: <a href=abcd
5611 1: <unset>
5612 2: <unset>
5613 3: abcd
5614 <a href=\"abcd xyz pqr\" cats
5615 0: <a href="abcd xyz pqr"
5616 1: "
5617 2: abcd xyz pqr
5618 <a href=\'abcd xyz pqr\' cats
5619 0: <a href='abcd xyz pqr'
5620 1: '
5621 2: abcd xyz pqr
5622
5623/<a\s+href\s*=\s* # find <a href=
5624 (["'])? # find single or double quote
5625 (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
5626 # quote, otherwise match up to next space
5627/isx
5628 <a href=abcd xyz
5629 0: <a href=abcd
5630 1: <unset>
5631 2: <unset>
5632 3: abcd
5633 <a href=\"abcd xyz pqr\" cats
5634 0: <a href="abcd xyz pqr"
5635 1: "
5636 2: abcd xyz pqr
5637 <a href = \'abcd xyz pqr\' cats
5638 0: <a href = 'abcd xyz pqr'
5639 1: '
5640 2: abcd xyz pqr
5641
5642/<a\s+href(?>\s*)=(?>\s*) # find <a href=
5643 (["'])? # find single or double quote
5644 (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
5645 # quote, otherwise match up to next space
5646/isx
5647 <a href=abcd xyz
5648 0: <a href=abcd
5649 1: <unset>
5650 2: <unset>
5651 3: abcd
5652 <a href=\"abcd xyz pqr\" cats
5653 0: <a href="abcd xyz pqr"
5654 1: "
5655 2: abcd xyz pqr
5656 <a href = \'abcd xyz pqr\' cats
5657 0: <a href = 'abcd xyz pqr'
5658 1: '
5659 2: abcd xyz pqr
5660
5661/((Z)+|A)*/
5662 ZABCDEFG
5663 0: ZA
5664 1: A
5665 2: Z
5666
5667/(Z()|A)*/
5668 ZABCDEFG
5669 0: ZA
5670 1: A
5671 2:
5672
5673/(Z(())|A)*/
5674 ZABCDEFG
5675 0: ZA
5676 1: A
5677 2:
5678 3:
5679
5680/((?>Z)+|A)*/
5681 ZABCDEFG
5682 0: ZA
5683 1: A
5684
5685/((?>)+|A)*/
5686 ZABCDEFG
5687 0:
5688 1:
5689
5690/^[\d-a]/
5691 abcde
5692 0: a
5693 -things
5694 0: -
5695 0digit
5696 0: 0
5697\= Expect no match
5698 bcdef
5699No match
5700
5701/[\s]+/
5702 > \x09\x0a\x0c\x0d\x0b<
5703 0: \x09\x0a\x0c\x0d\x0b
5704
5705/\s+/
5706 > \x09\x0a\x0c\x0d\x0b<
5707 0: \x09\x0a\x0c\x0d\x0b
5708
5709/a
5710b/x
5711 ab
5712 0: ab
5713
5714/(?!\A)x/m
5715 a\nxb\n
5716 0: x
5717
5718/(?!^)x/m
5719\= Expect no match
5720 a\nxb\n
5721No match
5722
5723#/abc\Qabc\Eabc/
5724# abcabcabc
5725# 0: abcabcabc
5726
5727#/abc\Q(*+|\Eabc/
5728# abc(*+|abc
5729# 0: abc(*+|abc
5730
5731#/ abc\Q abc\Eabc/x
5732# abc abcabc
5733# 0: abc abcabc
5734#\= Expect no match
5735# abcabcabc
5736#No match
5737
5738#/abc#comment
5739# \Q#not comment
5740# literal\E/x
5741# abc#not comment\n literal
5742# 0: abc#not comment\x0a literal
5743
5744#/abc#comment
5745# \Q#not comment
5746# literal/x
5747# abc#not comment\n literal
5748# 0: abc#not comment\x0a literal
5749
5750#/abc#comment
5751# \Q#not comment
5752# literal\E #more comment
5753# /x
5754# abc#not comment\n literal
5755# 0: abc#not comment\x0a literal
5756
5757#/abc#comment
5758# \Q#not comment
5759# literal\E #more comment/x
5760# abc#not comment\n literal
5761# 0: abc#not comment\x0a literal
5762
5763#/\Qabc\$xyz\E/
5764# abc\\\$xyz
5765# 0: abc\$xyz
5766
5767#/\Qabc\E\$\Qxyz\E/
5768# abc\$xyz
5769# 0: abc$xyz
5770
5771/\Gabc/
5772 abc
5773 0: abc
5774\= Expect no match
5775 xyzabc
5776No match
5777
5778/a(?x: b c )d/
5779 XabcdY
5780 0: abcd
5781\= Expect no match
5782 Xa b c d Y
5783No match
5784
5785/((?x)x y z | a b c)/
5786 XabcY
5787 0: abc
5788 1: abc
5789 AxyzB
5790 0: xyz
5791 1: xyz
5792
5793/(?i)AB(?-i)C/
5794 XabCY
5795 0: abC
5796\= Expect no match
5797 XabcY
5798No match
5799
5800/((?i)AB(?-i)C|D)E/
5801 abCE
5802 0: abCE
5803 1: abC
5804 DE
5805 0: DE
5806 1: D
5807\= Expect no match
5808 abcE
5809No match
5810 abCe
5811No match
5812 dE
5813No match
5814 De
5815No match
5816
5817/(.*)\d+\1/
5818 abc123abc
5819 0: abc123abc
5820 1: abc
5821 abc123bc
5822 0: bc123bc
5823 1: bc
5824
5825/(.*)\d+\1/s
5826 abc123abc
5827 0: abc123abc
5828 1: abc
5829 abc123bc
5830 0: bc123bc
5831 1: bc
5832
5833/((.*))\d+\1/
5834 abc123abc
5835 0: abc123abc
5836 1: abc
5837 2: abc
5838 abc123bc
5839 0: bc123bc
5840 1: bc
5841 2: bc
5842
5843# This tests for an IPv6 address in the form where it can have up to
5844# eight components, one and only one of which is empty. This must be
5845# an internal component.
5846
5847/^(?!:) # colon disallowed at start
5848 (?: # start of item
5849 (?: [0-9a-f]{1,4} | # 1-4 hex digits or
5850 (?(1)0 | () ) ) # if null previously matched, fail; else null
5851 : # followed by colon
5852 ){1,7} # end item; 1-7 of them required
5853 [0-9a-f]{1,4} $ # final hex number at end of string
5854 (?(1)|.) # check that there was an empty component
5855 /ix
5856 a123::a123
5857 0: a123::a123
5858 1:
5859 a123:b342::abcd
5860 0: a123:b342::abcd
5861 1:
5862 a123:b342::324e:abcd
5863 0: a123:b342::324e:abcd
5864 1:
5865 a123:ddde:b342::324e:abcd
5866 0: a123:ddde:b342::324e:abcd
5867 1:
5868 a123:ddde:b342::324e:dcba:abcd
5869 0: a123:ddde:b342::324e:dcba:abcd
5870 1:
5871 a123:ddde:9999:b342::324e:dcba:abcd
5872 0: a123:ddde:9999:b342::324e:dcba:abcd
5873 1:
5874\= Expect no match
5875 1:2:3:4:5:6:7:8
5876No match
5877 a123:bce:ddde:9999:b342::324e:dcba:abcd
5878No match
5879 a123::9999:b342::324e:dcba:abcd
5880No match
5881 abcde:2:3:4:5:6:7:8
5882No match
5883 ::1
5884No match
5885 abcd:fee0:123::
5886No match
5887 :1
5888No match
5889 1:
5890No match
5891
5892#/[z\Qa-d]\E]/
5893# z
5894# 0: z
5895# a
5896# 0: a
5897# -
5898# 0: -
5899# d
5900# 0: d
5901# ]
5902# 0: ]
5903#\= Expect no match
5904# b
5905#No match
5906
5907#TODO: PCRE has an optimization to make this workable, .NET does not
5908#/(a+)*b/
5909#\= Expect no match
5910# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
5911#No match
5912
5913# All these had to be updated because we understand unicode
5914# and this looks like it's expecting single byte matches
5915
5916# .NET generates \xe4...not sure what's up, might just be different code pages
5917/(?i)reg(?:ul(?:[aä]|ae)r|ex)/
5918 REGular
5919 0: REGular
5920 regulaer
5921 0: regulaer
5922 Regex
5923 0: Regex
5924 regulär
5925 0: regul\xc3\xa4r
5926
5927#/Åæåä[à-ÿÀ-ß]+/
5928# Åæåäà
5929# 0: \xc5\xe6\xe5\xe4\xe0
5930# Åæåäÿ
5931# 0: \xc5\xe6\xe5\xe4\xff
5932# ÅæåäÀ
5933# 0: \xc5\xe6\xe5\xe4\xc0
5934# Åæåäß
5935# 0: \xc5\xe6\xe5\xe4\xdf
5936
5937/(?<=Z)X./
5938 \x84XAZXB
5939 0: XB
5940
5941/ab cd (?x) de fg/
5942 ab cd defg
5943 0: ab cd defg
5944
5945/ab cd(?x) de fg/
5946 ab cddefg
5947 0: ab cddefg
5948\= Expect no match
5949 abcddefg
5950No match
5951
5952/(?<![^f]oo)(bar)/
5953 foobarX
5954 0: bar
5955 1: bar
5956\= Expect no match
5957 boobarX
5958No match
5959
5960/(?<![^f])X/
5961 offX
5962 0: X
5963\= Expect no match
5964 onyX
5965No match
5966
5967/(?<=[^f])X/
5968 onyX
5969 0: X
5970\= Expect no match
5971 offX
5972No match
5973
5974/(?:(?(1)a|b)(X))+/
5975 bXaX
5976 0: bXaX
5977 1: X
5978
5979/(?:(?(1)\1a|b)(X|Y))+/
5980 bXXaYYaY
5981 0: bXXaYYaY
5982 1: Y
5983 bXYaXXaX
5984 0: bX
5985 1: X
5986
5987# TODO: I think this is a difference caused by the
5988# collision of group numbers, but not sure
5989#/()()()()()()()()()(?:(?(10)\10a|b)(X|Y))+/
5990# bXXaYYaY
5991# 0: bX
5992# 1:
5993# 2:
5994# 3:
5995# 4:
5996# 5:
5997# 6:
5998# 7:
5999# 8:
6000# 9:
6001#10: X
6002
6003/[[,abc,]+]/
6004 abc]
6005 0: abc]
6006 a,b]
6007 0: a,b]
6008 [a,b,c]
6009 0: [a,b,c]
6010
6011/(?-x: )/x
6012 A\x20B
6013 0:
6014
6015"(?x)(?-x: \s*#\s*)"
6016 A # B
6017 0: #
6018\= Expect no match
6019 #
6020No match
6021
6022"(?x-is)(?:(?-ixs) \s*#\s*) include"
6023 A #include
6024 0: #include
6025\= Expect no match
6026 A#include
6027No match
6028 A #Include
6029No match
6030
6031/a*b*\w/
6032 aaabbbb
6033 0: aaabbbb
6034 aaaa
6035 0: aaaa
6036 a
6037 0: a
6038
6039/a*b?\w/
6040 aaabbbb
6041 0: aaabb
6042 aaaa
6043 0: aaaa
6044 a
6045 0: a
6046
6047/a*b{0,4}\w/
6048 aaabbbb
6049 0: aaabbbb
6050 aaaa
6051 0: aaaa
6052 a
6053 0: a
6054
6055/a*b{0,}\w/
6056 aaabbbb
6057 0: aaabbbb
6058 aaaa
6059 0: aaaa
6060 a
6061 0: a
6062
6063/a*\d*\w/
6064 0a
6065 0: 0a
6066 a
6067 0: a
6068
6069/a*b *\w/x
6070 a
6071 0: a
6072
6073/a*b#comment
6074 *\w/x
6075 a
6076 0: a
6077
6078/a* b *\w/x
6079 a
6080 0: a
6081
6082/^\w+=.*(\\\n.*)*/
6083 abc=xyz\\\npqr
6084 0: abc=xyz\
6085
6086/(?=(\w+))\1:/
6087 abcd:
6088 0: abcd:
6089 1: abcd
6090
6091/^(?=(\w+))\1:/
6092 abcd:
6093 0: abcd:
6094 1: abcd
6095
6096#/^\Eabc/
6097# abc
6098# 0: abc
6099
6100#/^[\Eabc]/
6101# a
6102# 0: a
6103#\= Expect no match
6104# E
6105#No match
6106
6107#/^[a-\Ec]/
6108# b
6109# 0: b
6110#\= Expect no match
6111# -
6112#No match
6113# E
6114#No match
6115
6116#/^[a\E\E-\Ec]/
6117# b
6118# 0: b
6119#\= Expect no match
6120# -
6121#No match
6122# E
6123#No match
6124
6125#/^[\E\Qa\E-\Qz\E]+/
6126# b
6127# 0: b
6128#\= Expect no match
6129# -
6130#No match
6131
6132#/^[a\Q]bc\E]/
6133# a
6134# 0: a
6135# ]
6136# 0: ]
6137# c
6138# 0: c
6139
6140#/^[a-\Q\E]/
6141# a
6142# 0: a
6143# -
6144# 0: -
6145
6146/^(a()*)*/
6147 aaaa
6148 0: aaaa
6149 1: a
6150 2:
6151
6152/^(?:a(?:(?:))*)*/
6153 aaaa
6154 0: aaaa
6155
6156/^(a()+)+/
6157 aaaa
6158 0: aaaa
6159 1: a
6160 2:
6161
6162/^(?:a(?:(?:))+)+/
6163 aaaa
6164 0: aaaa
6165
6166/(a){0,3}(?(1)b|(c|))*D/
6167 abbD
6168 0: abbD
6169 1: a
6170 ccccD
6171 0: ccccD
6172 1: <unset>
6173 2:
6174 D
6175 0: D
6176 1: <unset>
6177 2:
6178
6179# this is really long with debug -- removing for now
6180#/(a|)*\d/
6181# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6182# 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6183# 1:
6184#\= Expect no match
6185# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6186#No match
6187
6188/(?>a|)*\d/
6189 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6190 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6191\= Expect no match
6192 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6193No match
6194
6195/(?:a|)*\d/
6196 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6197 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
6198\= Expect no match
6199 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
6200No match
6201
6202/^(?s)(?>.*)(?<!\n)/
6203 abc
6204 0: abc
6205\= Expect no match
6206 abc\n
6207No match
6208
6209/^(?![^\n]*\n\z)/
6210 abc
6211 0:
6212\= Expect no match
6213 abc\n
6214No match
6215
6216/\z(?<!\n)/
6217 abc
6218 0:
6219\= Expect no match
6220 abc\n
6221No match
6222
6223/(.*(.)?)*/
6224 abcd
6225 0: abcd
6226 1:
6227
6228/( (A | (?(1)0|) )* )/x
6229 abcd
6230 0:
6231 1:
6232 2:
6233
6234/( ( (?(1)0|) )* )/x
6235 abcd
6236 0:
6237 1:
6238 2:
6239
6240/( (?(1)0|)* )/x
6241 abcd
6242 0:
6243 1:
6244
6245/[[:abcd:xyz]]/
6246 a]
6247 0: a]
6248 :]
6249 0: :]
6250
6251/[abc[:x\]pqr]/
6252 a
6253 0: a
6254 [
6255 0: [
6256 :
6257 0: :
6258 ]
6259 0: ]
6260 p
6261 0: p
6262
6263/.*[op][xyz]/
6264\= Expect no match
6265 fooabcfoo
6266No match
6267
6268/(?(?=.*b)b|^)/
6269 adc
6270 0:
6271 abc
6272 0: b
6273
6274/(?(?=^.*b)b|^)/
6275 adc
6276 0:
6277\= Expect no match
6278 abc
6279No match
6280
6281/(?(?=.*b)b|^)*/
6282 adc
6283 0:
6284 abc
6285 0:
6286
6287/(?(?=.*b)b|^)+/
6288 adc
6289 0:
6290 abc
6291 0: b
6292
6293/(?(?=b).*b|^d)/
6294 abc
6295 0: b
6296
6297/(?(?=.*b).*b|^d)/
6298 abc
6299 0: ab
6300
6301/^%((?(?=[a])[^%])|b)*%$/
6302 %ab%
6303 0: %ab%
6304 1:
6305
6306/(?i)a(?-i)b|c/
6307 XabX
6308 0: ab
6309 XAbX
6310 0: Ab
6311 CcC
6312 0: c
6313\= Expect no match
6314 XABX
6315No match
6316
6317/[\x00-\xff\s]+/
6318 \x0a\x0b\x0c\x0d
6319 0: \x0a\x0b\x0c\x0d
6320
6321/(abc)\1/i
6322\= Expect no match
6323 abc
6324No match
6325
6326/(abc)\1/
6327\= Expect no match
6328 abc
6329No match
6330
6331/[^a]*/i
6332 12abc
6333 0: 12
6334 12ABC
6335 0: 12
6336
6337#Posses
6338/[^a]*/i
6339 12abc
6340 0: 12
6341 12ABC
6342 0: 12
6343
6344/[^a]*?X/i
6345\= Expect no match
6346 12abc
6347No match
6348 12ABC
6349No match
6350
6351/[^a]+?X/i
6352\= Expect no match
6353 12abc
6354No match
6355 12ABC
6356No match
6357
6358/[^a]?X/i
6359 12aXbcX
6360 0: X
6361 12AXBCX
6362 0: X
6363 BCX
6364 0: CX
6365
6366/[^a]??X/i
6367 12aXbcX
6368 0: X
6369 12AXBCX
6370 0: X
6371 BCX
6372 0: CX
6373
6374/[^a]{2,3}/i
6375 abcdef
6376 0: bcd
6377 ABCDEF
6378 0: BCD
6379
6380/[^a]{2,3}?/i
6381 abcdef
6382 0: bc
6383 ABCDEF
6384 0: BC
6385
6386/((a|)+)+Z/
6387 Z
6388 0: Z
6389 1:
6390 2:
6391
6392/(a)b|(a)c/
6393 ac
6394 0: ac
6395 1: <unset>
6396 2: a
6397
6398/(?>(a))b|(a)c/
6399 ac
6400 0: ac
6401 1: <unset>
6402 2: a
6403
6404/(?=(a))ab|(a)c/
6405 ac
6406 0: ac
6407 1: <unset>
6408 2: a
6409
6410/((?>(a))b|(a)c)/
6411 ac
6412 0: ac
6413 1: ac
6414 2: <unset>
6415 3: a
6416
6417/(?=(?>(a))b|(a)c)(..)/
6418 ac
6419 0: ac
6420 1: <unset>
6421 2: a
6422 3: ac
6423
6424/(?>(?>(a))b|(a)c)/
6425 ac
6426 0: ac
6427 1: <unset>
6428 2: a
6429
6430/((?>(a+)b)+(aabab))/
6431 aaaabaaabaabab
6432 0: aaaabaaabaabab
6433 1: aaaabaaabaabab
6434 2: aaa
6435 3: aabab
6436
6437/(?>a+|ab)+?c/
6438\= Expect no match
6439 aabc
6440No match
6441
6442/(?>a+|ab)+c/
6443\= Expect no match
6444 aabc
6445No match
6446
6447/(?:a+|ab)+c/
6448 aabc
6449 0: aabc
6450
6451/^(?:a|ab)+c/
6452 aaaabc
6453 0: aaaabc
6454
6455/(?=abc){0}xyz/
6456 xyz
6457 0: xyz
6458
6459/(?=abc){1}xyz/
6460\= Expect no match
6461 xyz
6462No match
6463
6464/(?=(a))?./
6465 ab
6466 0: a
6467 1: a
6468 bc
6469 0: b
6470
6471/(?=(a))??./
6472 ab
6473 0: a
6474 bc
6475 0: b
6476
6477/^(?!a){0}\w+/
6478 aaaaa
6479 0: aaaaa
6480
6481/(?<=(abc))?xyz/
6482 abcxyz
6483 0: xyz
6484 1: abc
6485 pqrxyz
6486 0: xyz
6487
6488/^[g<a>]+/
6489 ggg<<<aaa>>>
6490 0: ggg<<<aaa>>>
6491\= Expect no match
6492 \\ga
6493No match
6494
6495/^[ga]+/
6496 gggagagaxyz
6497 0: gggagaga
6498
6499/[:a]xxx[b:]/
6500 :xxx:
6501 0: :xxx:
6502
6503/(?<=a{2})b/i
6504 xaabc
6505 0: b
6506\= Expect no match
6507 xabc
6508No match
6509
6510/(?<!a{2})b/i
6511 xabc
6512 0: b
6513\= Expect no match
6514 xaabc
6515No match
6516
6517/(?<=[^a]{2})b/
6518 axxbc
6519 0: b
6520 aAAbc
6521 0: b
6522\= Expect no match
6523 xaabc
6524No match
6525
6526/(?<=[^a]{2})b/i
6527 axxbc
6528 0: b
6529\= Expect no match
6530 aAAbc
6531No match
6532 xaabc
6533No match
6534
6535#/(?|(abc)|(xyz))\1/
6536# abcabc
6537# 0: abcabc
6538# 1: abc
6539# xyzxyz
6540# 0: xyzxyz
6541# 1: xyz
6542#\= Expect no match
6543# abcxyz
6544#No match
6545# xyzabc
6546#No match
6547
6548#/(?|(abc)|(xyz))(?1)/
6549# abcabc
6550# 0: abcabc
6551# 1: abc
6552# xyzabc
6553# 0: xyzabc
6554# 1: xyz
6555#\= Expect no match
6556# xyzxyz
6557#No match
6558
6559#/^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/
6560# XYabcdY
6561# 0: XYabcdY
6562# 1: a
6563# 2: b
6564# 3: c
6565# 4: d
6566# 5: Y
6567
6568#/^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/
6569# XYabcdY
6570# 0: XYabcdY
6571# 1: a
6572# 2: b
6573# 3: <unset>
6574# 4: <unset>
6575# 5: c
6576# 6: d
6577# 7: Y
6578
6579#/^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/
6580# XYabcdY
6581# 0: XYabcdY
6582# 1: a
6583# 2: b
6584# 3: <unset>
6585# 4: <unset>
6586# 5: c
6587# 6: d
6588# 7: Y
6589
6590/(?'abc'\w+):\k<abc>{2}/
6591 a:aaxyz
6592 0: a:aa
6593 1: a
6594 ab:ababxyz
6595 0: ab:abab
6596 1: ab
6597\= Expect no match
6598 a:axyz
6599No match
6600 ab:abxyz
6601No match
6602
6603/^(?<ab>a)? (?(ab)b|c) (?(ab)d|e)/x
6604 abd
6605 0: abd
6606 1: a
6607 ce
6608 0: ce
6609
6610# .NET has more consistent grouping numbers with these dupe groups for the two options
6611/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?(quote)[a-z]+|[0-9]+)/x,dupnames
6612 a\"aaaaa
6613 0: a"aaaaa
6614 1: "
6615 2: <unset>
6616 3: "
6617 b\"aaaaa
6618 0: b"aaaaa
6619 1: "
6620 2: <unset>
6621 3: "
6622\= Expect no match
6623 b\"11111
6624No match
6625
6626#/(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/
6627# 0
6628# 0: 0
6629# 1: 0
6630# 00
6631# 0: 00
6632# 1: 00
6633# 2: 0
6634# 0000
6635# 0: 0000
6636# 1: 0000
6637# 2: 0
6638
6639#/(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/
6640# 0
6641# 0: 0
6642# 1: 0
6643# 2: 0
6644# 00
6645# 0: 0
6646# 1: 0
6647# 2: 0
6648# 0000
6649# 0: 0
6650# 1: 0
6651# 2: 0
6652
6653# Check the use of names for failure
6654
6655# Check opening parens in comment when seeking forward reference.
6656
6657#/(?P<abn>(?P=abn)xxx|)+/
6658# xxx
6659# 0:
6660# 1:
6661
6662#Posses
6663/^(a)?(\w)/
6664 aaaaX
6665 0: aa
6666 1: a
6667 2: a
6668 YZ
6669 0: Y
6670 1: <unset>
6671 2: Y
6672
6673#Posses
6674/^(?:a)?(\w)/
6675 aaaaX
6676 0: aa
6677 1: a
6678 YZ
6679 0: Y
6680 1: Y
6681
6682/\A.*?(a|bc)/
6683 ba
6684 0: ba
6685 1: a
6686
6687/\A.*?(?:a|bc|d)/
6688 ba
6689 0: ba
6690
6691# --------------------------
6692
6693/(another)?(\1?)test/
6694 hello world test
6695 0: test
6696 1: <unset>
6697 2:
6698
6699/(another)?(\1+)test/
6700\= Expect no match
6701 hello world test
6702No match
6703
6704/((?:a?)*)*c/
6705 aac
6706 0: aac
6707 1:
6708
6709/((?>a?)*)*c/
6710 aac
6711 0: aac
6712 1:
6713
6714/(?>.*?a)(?<=ba)/
6715 aba
6716 0: ba
6717
6718/(?:.*?a)(?<=ba)/
6719 aba
6720 0: aba
6721
6722/(?>.*?a)b/s
6723 aab
6724 0: ab
6725
6726/(?>.*?a)b/
6727 aab
6728 0: ab
6729
6730/(?>^a)b/s
6731\= Expect no match
6732 aab
6733No match
6734
6735/(?>.*?)(?<=(abcd)|(wxyz))/
6736 alphabetabcd
6737 0:
6738 1: abcd
6739 endingwxyz
6740 0:
6741 1: <unset>
6742 2: wxyz
6743
6744/(?>.*)(?<=(abcd)|(wxyz))/
6745 alphabetabcd
6746 0: alphabetabcd
6747 1: abcd
6748 endingwxyz
6749 0: endingwxyz
6750 1: <unset>
6751 2: wxyz
6752
6753"(?>.*)foo"
6754\= Expect no match
6755 abcdfooxyz
6756No match
6757
6758"(?>.*?)foo"
6759 abcdfooxyz
6760 0: foo
6761
6762# Tests that try to figure out how Perl works. My hypothesis is that the first
6763# verb that is backtracked onto is the one that acts. This seems to be the case
6764# almost all the time, but there is one exception that is perhaps a bug.
6765
6766/a(?=bc).|abd/
6767 abd
6768 0: abd
6769 abc
6770 0: ab
6771
6772/a(?>bc)d|abd/
6773 abceabd
6774 0: abd
6775
6776# These tests were formerly in test 2, but changes in PCRE and Perl have
6777# made them compatible.
6778
6779/^(a)?(?(1)a|b)+$/
6780\= Expect no match
6781 a
6782No match
6783
6784# ----
6785
6786/^\d*\w{4}/
6787 1234
6788 0: 1234
6789\= Expect no match
6790 123
6791No match
6792
6793/^[^b]*\w{4}/
6794 aaaa
6795 0: aaaa
6796\= Expect no match
6797 aaa
6798No match
6799
6800/^[^b]*\w{4}/i
6801 aaaa
6802 0: aaaa
6803\= Expect no match
6804 aaa
6805No match
6806
6807/^a*\w{4}/
6808 aaaa
6809 0: aaaa
6810\= Expect no match
6811 aaa
6812No match
6813
6814/^a*\w{4}/i
6815 aaaa
6816 0: aaaa
6817\= Expect no match
6818 aaa
6819No match
6820
6821/(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames
6822 foofoo
6823 0: foofoo
6824 1: foo
6825 barbar
6826 0: barbar
6827 1: bar
6828
6829# A notable difference between PCRE and .NET. According to
6830# the PCRE docs:
6831# If you make a subroutine call to a non-unique named
6832# subpattern, the one that corresponds to the first
6833# occurrence of the name is used. In the absence of
6834# duplicate numbers (see the previous section) this is
6835# the one with the lowest number.
6836# .NET takes the most recently captured number according to MSDN:
6837# A backreference refers to the most recent definition of
6838# a group (the definition most immediately to the left,
6839# when matching left to right). When a group makes multiple
6840# captures, a backreference refers to the most recent capture.
6841
6842#/(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames
6843# AfooA
6844# 0: AfooA
6845# 1: A
6846# 2: foo
6847# AbarA
6848# 0: AbarA
6849# 1: A
6850# 2: <unset>
6851# 3: bar
6852#\= Expect no match
6853# Afoofoo
6854#No match
6855# Abarbar
6856#No match
6857
6858/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
6859 1 IN SOA non-sp1 non-sp2(
6860 0: 1 IN SOA non-sp1 non-sp2(
6861 1: 1
6862 2: non-sp1
6863 3: non-sp2
6864
6865# TODO: .NET's group number ordering here in the second example is a bit odd
6866/^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?(A)x) (?(B)y)$/x,dupnames
6867 Ax
6868 0: Ax
6869 1: A
6870 BAxy
6871 0: BAxy
6872 1: A
6873 2: B
6874
6875/ ^ a + b $ /x
6876 aaaab
6877 0: aaaab
6878
6879/ ^ a + #comment
6880 b $ /x
6881 aaaab
6882 0: aaaab
6883
6884/ ^ a + #comment
6885 #comment
6886 b $ /x
6887 aaaab
6888 0: aaaab
6889
6890/ ^ (?> a + ) b $ /x
6891 aaaab
6892 0: aaaab
6893
6894/ ^ ( a + ) + \w $ /x
6895 aaaab
6896 0: aaaab
6897 1: aaaa
6898
6899/(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/
6900\= Expect no match
6901 acb
6902No match
6903
6904#Posses
6905#/\A(?:[^\"]+|\"(?:[^\"]*|\"\")*\")+/
6906# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
6907# 0: NON QUOTED "QUOT""ED" AFTER
6908
6909#Posses
6910#/\A(?:[^\"]+|\"(?:[^\"]+|\"\")*\")+/
6911# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
6912# 0: NON QUOTED "QUOT""ED" AFTER
6913
6914#Posses
6915#/\A(?:[^\"]+|\"(?:[^\"]+|\"\")+\")+/
6916# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
6917# 0: NON QUOTED "QUOT""ED" AFTER
6918
6919#Posses
6920#/\A([^\"1]+|[\"2]([^\"3]*|[\"4][\"5])*[\"6])+/
6921# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
6922# 0: NON QUOTED "QUOT""ED" AFTER
6923# 1: AFTER
6924# 2:
6925
6926/^\w+(?>\s*)(?<=\w)/
6927 test test
6928 0: tes
6929
6930#/(?P<Name>a)?(?P<Name2>b)?(?(<Name>)c|d)*l/
6931# acl
6932# 0: acl
6933# 1: a
6934# bdl
6935# 0: bdl
6936# 1: <unset>
6937# 2: b
6938# adl
6939# 0: dl
6940# bcl
6941# 0: l
6942
6943/\sabc/
6944 \x0babc
6945 0: \x0babc
6946
6947#/[\Qa]\E]+/
6948# aa]]
6949# 0: aa]]
6950
6951#/[\Q]a\E]+/
6952# aa]]
6953# 0: aa]]
6954
6955/A((((((((a))))))))\8B/
6956 AaaB
6957 0: AaaB
6958 1: a
6959 2: a
6960 3: a
6961 4: a
6962 5: a
6963 6: a
6964 7: a
6965 8: a
6966
6967/A(((((((((a)))))))))\9B/
6968 AaaB
6969 0: AaaB
6970 1: a
6971 2: a
6972 3: a
6973 4: a
6974 5: a
6975 6: a
6976 7: a
6977 8: a
6978 9: a
6979
6980/(|ab)*?d/
6981 abd
6982 0: abd
6983 1: ab
6984 xyd
6985 0: d
6986
6987/(\2|a)(\1)/
6988 aaa
6989 0: aa
6990 1: a
6991 2: a
6992
6993/(\2)(\1)/
6994
6995"Z*(|d*){216}"
6996
6997/((((((((((((x))))))))))))\12/
6998 xx
6999 0: xx
7000 1: x
7001 2: x
7002 3: x
7003 4: x
7004 5: x
7005 6: x
7006 7: x
7007 8: x
7008 9: x
700910: x
701011: x
701112: x
7012
7013#"(?|(\k'Pm')|(?'Pm'))"
7014# abcd
7015# 0:
7016# 1:
7017
7018#/(?|(aaa)|(b))\g{1}/
7019# aaaaaa
7020# 0: aaaaaa
7021# 1: aaa
7022# bb
7023# 0: bb
7024# 1: b
7025
7026#/(?|(aaa)|(b))(?1)/
7027# aaaaaa
7028# 0: aaaaaa
7029# 1: aaa
7030# baaa
7031# 0: baaa
7032# 1: b
7033#\= Expect no match
7034# bb
7035#No match
7036
7037#/(?|(aaa)|(b))/
7038# xaaa
7039# 0: aaa
7040# 1: aaa
7041# xbc
7042# 0: b
7043# 1: b
7044
7045#/(?|(?'a'aaa)|(?'a'b))\k'a'/
7046# aaaaaa
7047# 0: aaaaaa
7048# 1: aaa
7049# bb
7050# 0: bb
7051# 1: b
7052
7053#/(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/dupnames
7054# aaaccccaaa
7055# 0: aaaccccaaa
7056# 1: aaa
7057# 2: cccc
7058# bccccb
7059# 0: bccccb
7060# 1: b
7061# 2: cccc
7062
7063# End of testinput1
Note: See TracBrowser for help on using the repository browser.