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 c/x 1785 abc 1786 0: abc 1787 1788/^(a|)\1*b/ 1789 ab 1790 0: ab 1791 1: a 1792 aaaab 1793 0: aaaab 1794 1: a 1795 b 1796 0: b 1797 1: 1798\= Expect no match 1799 acb 1800No match 1801 1802/^(a|)\1+b/ 1803 aab 1804 0: aab 1805 1: a 1806 aaaab 1807 0: aaaab 1808 1: a 1809 b 1810 0: b 1811 1: 1812\= Expect no match 1813 ab 1814No match 1815 1816/^(a|)\1?b/ 1817 ab 1818 0: ab 1819 1: a 1820 aab 1821 0: aab 1822 1: a 1823 b 1824 0: b 1825 1: 1826\= Expect no match 1827 acb 1828No match 1829 1830/^(a|)\1{2}b/ 1831 aaab 1832 0: aaab 1833 1: a 1834 b 1835 0: b 1836 1: 1837\= Expect no match 1838 ab 1839No match 1840 aab 1841No match 1842 aaaab 1843No match 1844 1845/^(a|)\1{2,3}b/ 1846 aaab 1847 0: aaab 1848 1: a 1849 aaaab 1850 0: aaaab 1851 1: a 1852 b 1853 0: b 1854 1: 1855\= Expect no match 1856 ab 1857No match 1858 aab 1859No match 1860 aaaaab 1861No match 1862 1863/ab{1,3}bc/ 1864 abbbbc 1865 0: abbbbc 1866 abbbc 1867 0: abbbc 1868 abbc 1869 0: abbc 1870\= Expect no match 1871 abc 1872No match 1873 abbbbbc 1874No match 1875 1876/([^.]*)\.([^:]*):[T ]+(.*)/ 1877 track1.title:TBlah blah blah 1878 0: track1.title:TBlah blah blah 1879 1: track1 1880 2: title 1881 3: Blah blah blah 1882 1883/([^.]*)\.([^:]*):[T ]+(.*)/i 1884 track1.title:TBlah blah blah 1885 0: track1.title:TBlah blah blah 1886 1: track1 1887 2: title 1888 3: Blah blah blah 1889 1890/([^.]*)\.([^:]*):[t ]+(.*)/i 1891 track1.title:TBlah blah blah 1892 0: track1.title:TBlah blah blah 1893 1: track1 1894 2: title 1895 3: Blah blah blah 1896 1897/^[W-c]+$/ 1898 WXY_^abc 1899 0: WXY_^abc 1900\= Expect no match 1901 wxy 1902No match 1903 1904/^[W-c]+$/i 1905 WXY_^abc 1906 0: WXY_^abc 1907 wxy_^ABC 1908 0: wxy_^ABC 1909 1910/^[\x3f-\x5F]+$/i 1911 WXY_^abc 1912 0: WXY_^abc 1913 wxy_^ABC 1914 0: wxy_^ABC 1915 1916/^abc$/m 1917 abc 1918 0: abc 1919 qqq\nabc 1920 0: abc 1921 abc\nzzz 1922 0: abc 1923 qqq\nabc\nzzz 1924 0: abc 1925 1926/^abc$/ 1927 abc 1928 0: abc 1929\= Expect no match 1930 qqq\nabc 1931No match 1932 abc\nzzz 1933No match 1934 qqq\nabc\nzzz 1935No match 1936 1937/\Aabc\Z/m 1938 abc 1939 0: abc 1940 abc\n 1941 0: abc 1942\= Expect no match 1943 qqq\nabc 1944No match 1945 abc\nzzz 1946No match 1947 qqq\nabc\nzzz 1948No match 1949 1950/\A(.)*\Z/s 1951 abc\ndef 1952 0: abc\x0adef 1953 1: f 1954 1955/\A(.)*\Z/m 1956\= Expect no match 1957 abc\ndef 1958No match 1959 1960/(?:b)|(?::+)/ 1961 b::c 1962 0: b 1963 c::b 1964 0: :: 1965 1966/[-az]+/ 1967 az- 1968 0: az- 1969\= Expect no match 1970 b 1971No match 1972 1973/[az-]+/ 1974 za- 1975 0: za- 1976\= Expect no match 1977 b 1978No match 1979 1980/[a\-z]+/ 1981 a-z 1982 0: a-z 1983\= Expect no match 1984 b 1985No match 1986 1987/[a-z]+/ 1988 abcdxyz 1989 0: abcdxyz 1990 1991/[\d-]+/ 1992 12-34 1993 0: 12-34 1994\= Expect no match 1995 aaa 1996No match 1997 1998/[\d-z]+/ 1999 12-34z 2000 0: 12-34z 2001\= Expect no match 2002 aaa 2003No match 2004 2005/\x5c/ 2006 \\ 2007 0: \ 2008 2009/\x20Z/ 2010 the Zoo 2011 0: Z 2012\= Expect no match 2013 Zulu 2014No match 2015 2016/(abc)\1/i 2017 abcabc 2018 0: abcabc 2019 1: abc 2020 ABCabc 2021 0: ABCabc 2022 1: ABC 2023 abcABC 2024 0: abcABC 2025 1: abc 2026 2027/abc$/ 2028 abc 2029 0: abc 2030 abc\n 2031 0: abc 2032\= Expect no match 2033 abc\ndef 2034No match 2035 2036/(abc)\123/ 2037 abc\x53 2038 0: abcS 2039 1: abc 2040 2041/(abc)\100/ 2042 abc\x40 2043 0: abc@ 2044 1: abc 2045 abc\100 2046 0: abc@ 2047 1: abc 2048 2049/(abc)\1000/ 2050 abc\x400 2051 0: abc@0 2052 1: abc 2053 abc\x40\x30 2054 0: abc@0 2055 1: abc 2056 abc\1000 2057 0: abc@0 2058 1: abc 2059 abc\100\x30 2060 0: abc@0 2061 1: abc 2062 abc\100\060 2063 0: abc@0 2064 1: abc 2065 abc\100\60 2066 0: abc@0 2067 1: abc 2068 2069/^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/ 2070 ABCDEFGHIHI 2071 0: ABCDEFGHIHI 2072 1: A 2073 2: B 2074 3: C 2075 4: D 2076 5: E 2077 6: F 2078 7: G 2079 8: H 2080 9: I 2081 2082/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/ 2083 abcdefghijkllS 2084 0: abcdefghijkllS 2085 1: a 2086 2: b 2087 3: c 2088 4: d 2089 5: e 2090 6: f 2091 7: g 2092 8: h 2093 9: i 209410: j 209511: k 209612: l 2097 2098/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/ 2099 abcdefghijk\12S 2100 0: abcdefghijk\x0aS 2101 1: a 2102 2: b 2103 3: c 2104 4: d 2105 5: e 2106 6: f 2107 7: g 2108 8: h 2109 9: i 211010: j 211111: k 2112 2113/a{0}bc/ 2114 bc 2115 0: bc 2116 2117/(a|(bc)){0,0}?xyz/ 2118 xyz 2119 0: xyz 2120 2121/abc[\10]de/ 2122 abc\010de 2123 0: abc\x08de 2124 2125/abc[\1]de/ 2126 abc\1de 2127 0: abc\x01de 2128 2129/(abc)[\1]de/ 2130 abc\1de 2131 0: abc\x01de 2132 1: abc 2133 2134/(?s)a.b/ 2135 a\nb 2136 0: a\x0ab 2137 2138/^([^a])([^\b])([^c]*)([^d]{3,4})/ 2139 baNOTccccd 2140 0: baNOTcccc 2141 1: b 2142 2: a 2143 3: NOT 2144 4: cccc 2145 baNOTcccd 2146 0: baNOTccc 2147 1: b 2148 2: a 2149 3: NOT 2150 4: ccc 2151 baNOTccd 2152 0: baNOTcc 2153 1: b 2154 2: a 2155 3: NO 2156 4: Tcc 2157 bacccd 2158 0: baccc 2159 1: b 2160 2: a 2161 3: 2162 4: ccc 2163\= Expect no match 2164 anything 2165No match 2166 b\bc 2167No match 2168 baccd 2169No match 2170 2171/[^a]/ 2172 Abc 2173 0: A 2174 2175/[^a]/i 2176 Abc 2177 0: b 2178 2179/[^a]+/ 2180 AAAaAbc 2181 0: AAA 2182 2183/[^a]+/i 2184 AAAaAbc 2185 0: bc 2186 2187/[^a]+/ 2188 bbb\nccc 2189 0: bbb\x0accc 2190 2191/[^k]$/ 2192 abc 2193 0: c 2194\= Expect no match 2195 abk 2196No match 2197 2198/[^k]{2,3}$/ 2199 abc 2200 0: abc 2201 kbc 2202 0: bc 2203 kabc 2204 0: abc 2205\= Expect no match 2206 abk 2207No match 2208 akb 2209No match 2210 akk 2211No match 2212 2213/^\d{8,}\@.+[^k]$/ 2214 12345678\@a.b.c.d 2215 0: 12345678@a.b.c.d 2216 123456789\@x.y.z 2217 0: 123456789@x.y.z 2218\= Expect no match 2219 12345678\@x.y.uk 2220No match 2221 1234567\@a.b.c.d 2222No match 2223 2224/(a)\1{8,}/ 2225 aaaaaaaaa 2226 0: aaaaaaaaa 2227 1: a 2228 aaaaaaaaaa 2229 0: aaaaaaaaaa 2230 1: a 2231\= Expect no match 2232 aaaaaaa 2233No match 2234 2235/[^a]/ 2236 aaaabcd 2237 0: b 2238 aaAabcd 2239 0: A 2240 2241/[^a]/i 2242 aaaabcd 2243 0: b 2244 aaAabcd 2245 0: b 2246 2247/[^az]/ 2248 aaaabcd 2249 0: b 2250 aaAabcd 2251 0: A 2252 2253/[^az]/i 2254 aaaabcd 2255 0: b 2256 aaAabcd 2257 0: b 2258 2259# trimmed upper ascii since Go is UTF-8 2260/\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/ 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 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 2263 2264/P[^*]TAIRE[^*]{1,6}?LL/ 2265 xxxxxxxxxxxPSTAIREISLLxxxxxxxxx 2266 0: PSTAIREISLL 2267 2268/P[^*]TAIRE[^*]{1,}?LL/ 2269 xxxxxxxxxxxPSTAIREISLLxxxxxxxxx 2270 0: PSTAIREISLL 2271 2272/(\.\d\d[1-9]?)\d+/ 2273 1.230003938 2274 0: .230003938 2275 1: .23 2276 1.875000282 2277 0: .875000282 2278 1: .875 2279 1.235 2280 0: .235 2281 1: .23 2282 2283/(\.\d\d((?=0)|\d(?=\d)))/ 2284 1.230003938 2285 0: .23 2286 1: .23 2287 2: 2288 1.875000282 2289 0: .875 2290 1: .875 2291 2: 5 2292\= Expect no match 2293 1.235 2294No match 2295 2296/\b(foo)\s+(\w+)/i 2297 Food is on the foo table 2298 0: foo table 2299 1: foo 2300 2: table 2301 2302/foo(.*)bar/ 2303 The food is under the bar in the barn. 2304 0: food is under the bar in the bar 2305 1: d is under the bar in the 2306 2307/foo(.*?)bar/ 2308 The food is under the bar in the barn. 2309 0: food is under the bar 2310 1: d is under the 2311 2312/(.*)(\d*)/ 2313 I have 2 numbers: 53147 2314 0: I have 2 numbers: 53147 2315 1: I have 2 numbers: 53147 2316 2: 2317 2318/(.*)(\d+)/ 2319 I have 2 numbers: 53147 2320 0: I have 2 numbers: 53147 2321 1: I have 2 numbers: 5314 2322 2: 7 2323 2324/(.*?)(\d*)/ 2325 I have 2 numbers: 53147 2326 0: 2327 1: 2328 2: 2329 2330/(.*?)(\d+)/ 2331 I have 2 numbers: 53147 2332 0: I have 2 2333 1: I have 2334 2: 2 2335 2336/(.*)(\d+)$/ 2337 I have 2 numbers: 53147 2338 0: I have 2 numbers: 53147 2339 1: I have 2 numbers: 5314 2340 2: 7 2341 2342/(.*?)(\d+)$/ 2343 I have 2 numbers: 53147 2344 0: I have 2 numbers: 53147 2345 1: I have 2 numbers: 2346 2: 53147 2347 2348/(.*)\b(\d+)$/ 2349 I have 2 numbers: 53147 2350 0: I have 2 numbers: 53147 2351 1: I have 2 numbers: 2352 2: 53147 2353 2354/(.*\D)(\d+)$/ 2355 I have 2 numbers: 53147 2356 0: I have 2 numbers: 53147 2357 1: I have 2 numbers: 2358 2: 53147 2359 2360/^\D*(?!123)/ 2361 ABC123 2362 0: AB 2363 2364/^(\D*)(?=\d)(?!123)/ 2365 ABC445 2366 0: ABC 2367 1: ABC 2368\= Expect no match 2369 ABC123 2370No match 2371 2372/^[W-]46]/ 2373 W46]789 2374 0: W46] 2375 -46]789 2376 0: -46] 2377\= Expect no match 2378 Wall 2379No match 2380 Zebra 2381No match 2382 42 2383No match 2384 [abcd] 2385No match 2386 ]abcd[ 2387No match 2388 2389/^[W-\]46]/ 2390 W46]789 2391 0: W 2392 Wall 2393 0: W 2394 Zebra 2395 0: Z 2396 Xylophone 2397 0: X 2398 42 2399 0: 4 2400 [abcd] 2401 0: [ 2402 ]abcd[ 2403 0: ] 2404 \\backslash 2405 0: \ 2406\= Expect no match 2407 -46]789 2408No match 2409 well 2410No match 2411 2412/\d\d\/\d\d\/\d\d\d\d/ 2413 01/01/2000 2414 0: 01/01/2000 2415 2416/word (?:[a-zA-Z0-9]+ ){0,10}otherword/ 2417 word cat dog elephant mussel cow horse canary baboon snake shark otherword 2418 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword 2419\= Expect no match 2420 word cat dog elephant mussel cow horse canary baboon snake shark 2421No match 2422 2423/word (?:[a-zA-Z0-9]+ ){0,300}otherword/ 2424\= Expect no match 2425 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 2426No match 2427 2428/^(a){0,0}/ 2429 bcd 2430 0: 2431 abc 2432 0: 2433 aab 2434 0: 2435 2436/^(a){0,1}/ 2437 bcd 2438 0: 2439 abc 2440 0: a 2441 1: a 2442 aab 2443 0: a 2444 1: a 2445 2446/^(a){0,2}/ 2447 bcd 2448 0: 2449 abc 2450 0: a 2451 1: a 2452 aab 2453 0: aa 2454 1: a 2455 2456/^(a){0,3}/ 2457 bcd 2458 0: 2459 abc 2460 0: a 2461 1: a 2462 aab 2463 0: aa 2464 1: a 2465 aaa 2466 0: aaa 2467 1: a 2468 2469/^(a){0,}/ 2470 bcd 2471 0: 2472 abc 2473 0: a 2474 1: a 2475 aab 2476 0: aa 2477 1: a 2478 aaa 2479 0: aaa 2480 1: a 2481 aaaaaaaa 2482 0: aaaaaaaa 2483 1: a 2484 2485/^(a){1,1}/ 2486 abc 2487 0: a 2488 1: a 2489 aab 2490 0: a 2491 1: a 2492\= Expect no match 2493 bcd 2494No match 2495 2496/^(a){1,2}/ 2497 abc 2498 0: a 2499 1: a 2500 aab 2501 0: aa 2502 1: a 2503\= Expect no match 2504 bcd 2505No match 2506 2507/^(a){1,3}/ 2508 abc 2509 0: a 2510 1: a 2511 aab 2512 0: aa 2513 1: a 2514 aaa 2515 0: aaa 2516 1: a 2517\= Expect no match 2518 bcd 2519No match 2520 2521/^(a){1,}/ 2522 abc 2523 0: a 2524 1: a 2525 aab 2526 0: aa 2527 1: a 2528 aaa 2529 0: aaa 2530 1: a 2531 aaaaaaaa 2532 0: aaaaaaaa 2533 1: a 2534\= Expect no match 2535 bcd 2536No match 2537 2538/.*\.gif/ 2539 borfle\nbib.gif\nno 2540 0: bib.gif 2541 2542/.{0,}\.gif/ 2543 borfle\nbib.gif\nno 2544 0: bib.gif 2545 2546/.*\.gif/m 2547 borfle\nbib.gif\nno 2548 0: bib.gif 2549 2550/.*\.gif/s 2551 borfle\nbib.gif\nno 2552 0: borfle\x0abib.gif 2553 2554/.*\.gif/ms 2555 borfle\nbib.gif\nno 2556 0: borfle\x0abib.gif 2557 2558/.*$/ 2559 borfle\nbib.gif\nno 2560 0: no 2561 2562/.*$/m 2563 borfle\nbib.gif\nno 2564 0: borfle 2565 2566/.*$/s 2567 borfle\nbib.gif\nno 2568 0: borfle\x0abib.gif\x0ano 2569 2570/.*$/ms 2571 borfle\nbib.gif\nno 2572 0: borfle\x0abib.gif\x0ano 2573 2574/.*$/ 2575 borfle\nbib.gif\nno\n 2576 0: no 2577 2578/.*$/m 2579 borfle\nbib.gif\nno\n 2580 0: borfle 2581 2582/.*$/s 2583 borfle\nbib.gif\nno\n 2584 0: borfle\x0abib.gif\x0ano\x0a 2585 2586/.*$/ms 2587 borfle\nbib.gif\nno\n 2588 0: borfle\x0abib.gif\x0ano\x0a 2589 2590/(.*X|^B)/ 2591 abcde\n1234Xyz 2592 0: 1234X 2593 1: 1234X 2594 BarFoo 2595 0: B 2596 1: B 2597\= Expect no match 2598 abcde\nBar 2599No match 2600 2601/(.*X|^B)/m 2602 abcde\n1234Xyz 2603 0: 1234X 2604 1: 1234X 2605 BarFoo 2606 0: B 2607 1: B 2608 abcde\nBar 2609 0: B 2610 1: B 2611 2612/(.*X|^B)/s 2613 abcde\n1234Xyz 2614 0: abcde\x0a1234X 2615 1: abcde\x0a1234X 2616 BarFoo 2617 0: B 2618 1: B 2619\= Expect no match 2620 abcde\nBar 2621No match 2622 2623/(.*X|^B)/ms 2624 abcde\n1234Xyz 2625 0: abcde\x0a1234X 2626 1: abcde\x0a1234X 2627 BarFoo 2628 0: B 2629 1: B 2630 abcde\nBar 2631 0: B 2632 1: B 2633 2634/(?s)(.*X|^B)/ 2635 abcde\n1234Xyz 2636 0: abcde\x0a1234X 2637 1: abcde\x0a1234X 2638 BarFoo 2639 0: B 2640 1: B 2641\= Expect no match 2642 abcde\nBar 2643No match 2644 2645/(?s:.*X|^B)/ 2646 abcde\n1234Xyz 2647 0: abcde\x0a1234X 2648 BarFoo 2649 0: B 2650\= Expect no match 2651 abcde\nBar 2652No match 2653 2654/^.*B/ 2655\= Expect no match 2656 abc\nB 2657No match 2658 2659/(?s)^.*B/ 2660 abc\nB 2661 0: abc\x0aB 2662 2663/(?m)^.*B/ 2664 abc\nB 2665 0: B 2666 2667/(?ms)^.*B/ 2668 abc\nB 2669 0: abc\x0aB 2670 2671/(?ms)^B/ 2672 abc\nB 2673 0: B 2674 2675/(?s)B$/ 2676 B\n 2677 0: B 2678 2679/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/ 2680 123456654321 2681 0: 123456654321 2682 2683/^\d\d\d\d\d\d\d\d\d\d\d\d/ 2684 123456654321 2685 0: 123456654321 2686 2687/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/ 2688 123456654321 2689 0: 123456654321 2690 2691/^[abc]{12}/ 2692 abcabcabcabc 2693 0: abcabcabcabc 2694 2695/^[a-c]{12}/ 2696 abcabcabcabc 2697 0: abcabcabcabc 2698 2699/^(a|b|c){12}/ 2700 abcabcabcabc 2701 0: abcabcabcabc 2702 1: c 2703 2704/^[abcdefghijklmnopqrstuvwxy0123456789]/ 2705 n 2706 0: n 2707\= Expect no match 2708 z 2709No match 2710 2711/abcde{0,0}/ 2712 abcd 2713 0: abcd 2714\= Expect no match 2715 abce 2716No match 2717 2718/ab[cd]{0,0}e/ 2719 abe 2720 0: abe 2721\= Expect no match 2722 abcde 2723No match 2724 2725/ab(c){0,0}d/ 2726 abd 2727 0: abd 2728\= Expect no match 2729 abcd 2730No match 2731 2732/a(b*)/ 2733 a 2734 0: a 2735 1: 2736 ab 2737 0: ab 2738 1: b 2739 abbbb 2740 0: abbbb 2741 1: bbbb 2742\= Expect no match 2743 bbbbb 2744No match 2745 2746/ab\d{0}e/ 2747 abe 2748 0: abe 2749\= Expect no match 2750 ab1e 2751No match 2752 2753/"([^\\"]+|\\.)*"/ 2754 the \"quick\" brown fox 2755 0: "quick" 2756 1: quick 2757 \"the \\\"quick\\\" brown fox\" 2758 0: "the \"quick\" brown fox" 2759 1: brown fox 2760 2761/<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 2762 <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> 2763 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> 2764 1: BGCOLOR='#DBE9E9' 2765 2: align=left valign=top 2766 3: 43. 2767 4: <a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286) 2768 5: 2769 6: 2770 7: <unset> 2771 8: align=left valign=top 2772 9: Lega lstaff.com 277310: align=left valign=top 277411: CA - Statewide 2775 2776/a[^a]b/ 2777 acb 2778 0: acb 2779 a\nb 2780 0: a\x0ab 2781 2782/a.b/ 2783 acb 2784 0: acb 2785\= Expect no match 2786 a\nb 2787No match 2788 2789/a[^a]b/s 2790 acb 2791 0: acb 2792 a\nb 2793 0: a\x0ab 2794 2795/a.b/s 2796 acb 2797 0: acb 2798 a\nb 2799 0: a\x0ab 2800 2801/^(b+?|a){1,2}?c/ 2802 bac 2803 0: bac 2804 1: a 2805 bbac 2806 0: bbac 2807 1: a 2808 bbbac 2809 0: bbbac 2810 1: a 2811 bbbbac 2812 0: bbbbac 2813 1: a 2814 bbbbbac 2815 0: bbbbbac 2816 1: a 2817 2818/^(b+|a){1,2}?c/ 2819 bac 2820 0: bac 2821 1: a 2822 bbac 2823 0: bbac 2824 1: a 2825 bbbac 2826 0: bbbac 2827 1: a 2828 bbbbac 2829 0: bbbbac 2830 1: a 2831 bbbbbac 2832 0: bbbbbac 2833 1: a 2834 2835/(?!\A)x/m 2836 a\bx\n 2837 0: x 2838 a\nx\n 2839 0: x 2840\= Expect no match 2841 x\nb\n 2842No match 2843 2844/(A|B)*?CD/ 2845 CD 2846 0: CD 2847 2848/(A|B)*CD/ 2849 CD 2850 0: CD 2851 2852/(AB)*?\1/ 2853 ABABAB 2854 0: ABAB 2855 1: AB 2856 2857/(AB)*\1/ 2858 ABABAB 2859 0: ABABAB 2860 1: AB 2861 2862/(?<!bar)foo/ 2863 foo 2864 0: foo 2865 catfood 2866 0: foo 2867 arfootle 2868 0: foo 2869 rfoosh 2870 0: foo 2871\= Expect no match 2872 barfoo 2873No match 2874 towbarfoo 2875No match 2876 2877/\w{3}(?<!bar)foo/ 2878 catfood 2879 0: catfoo 2880\= Expect no match 2881 foo 2882No match 2883 barfoo 2884No match 2885 towbarfoo 2886No match 2887 2888/(?<=(foo)a)bar/ 2889 fooabar 2890 0: bar 2891 1: foo 2892\= Expect no match 2893 bar 2894No match 2895 foobbar 2896No match 2897 2898/\Aabc\z/m 2899 abc 2900 0: abc 2901\= Expect no match 2902 abc\n 2903No match 2904 qqq\nabc 2905No match 2906 abc\nzzz 2907No match 2908 qqq\nabc\nzzz 2909No match 2910 2911"(?>.*/)foo" 2912 /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo 2913 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo 2914\= Expect no match 2915 /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/ 2916No match 2917 2918/(?>(\.\d\d[1-9]?))\d+/ 2919 1.230003938 2920 0: .230003938 2921 1: .23 2922 1.875000282 2923 0: .875000282 2924 1: .875 2925\= Expect no match 2926 1.235 2927No match 2928 2929/^((?>\w+)|(?>\s+))*$/ 2930 now is the time for all good men to come to the aid of the party 2931 0: now is the time for all good men to come to the aid of the party 2932 1: party 2933\= Expect no match 2934 this is not a line with only words and spaces! 2935No match 2936 2937/(\d+)(\w)/ 2938 12345a 2939 0: 12345a 2940 1: 12345 2941 2: a 2942 12345+ 2943 0: 12345 2944 1: 1234 2945 2: 5 2946 2947/((?>\d+))(\w)/ 2948 12345a 2949 0: 12345a 2950 1: 12345 2951 2: a 2952\= Expect no match 2953 12345+ 2954No match 2955 2956/(?>a+)b/ 2957 aaab 2958 0: aaab 2959 2960/((?>a+)b)/ 2961 aaab 2962 0: aaab 2963 1: aaab 2964 2965/(?>(a+))b/ 2966 aaab 2967 0: aaab 2968 1: aaa 2969 2970/(?>b)+/ 2971 aaabbbccc 2972 0: bbb 2973 2974/(?>a+|b+|c+)*c/ 2975 aaabbbbccccd 2976 0: aaabbbbc 2977 2978/((?>[^()]+)|\([^()]*\))+/ 2979 ((abc(ade)ufh()()x 2980 0: abc(ade)ufh()()x 2981 1: x 2982 2983/\(((?>[^()]+)|\([^()]+\))+\)/ 2984 (abc) 2985 0: (abc) 2986 1: abc 2987 (abc(def)xyz) 2988 0: (abc(def)xyz) 2989 1: xyz 2990\= Expect no match 2991 ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 2992No match 2993 2994/a(?-i)b/i 2995 ab 2996 0: ab 2997 Ab 2998 0: Ab 2999\= Expect no match 3000 aB 3001No match 3002 AB 3003No match 3004 3005/(a (?x)b c)d e/ 3006 a bcd e 3007 0: a bcd e 3008 1: a bc 3009\= Expect no match 3010 a b cd e 3011No match 3012 abcd e 3013No match 3014 a bcde 3015No match 3016 3017/(a b(?x)c d (?-x)e f)/ 3018 a bcde f 3019 0: a bcde f 3020 1: a bcde f 3021\= Expect no match 3022 abcdef 3023No match 3024 3025/(a(?i)b)c/ 3026 abc 3027 0: abc 3028 1: ab 3029 aBc 3030 0: aBc 3031 1: aB 3032\= Expect no match 3033 abC 3034No match 3035 aBC 3036No match 3037 Abc 3038No match 3039 ABc 3040No match 3041 ABC 3042No match 3043 AbC 3044No match 3045 3046/a(?i:b)c/ 3047 abc 3048 0: abc 3049 aBc 3050 0: aBc 3051\= Expect no match 3052 ABC 3053No match 3054 abC 3055No match 3056 aBC 3057No match 3058 3059/a(?i:b)*c/ 3060 aBc 3061 0: aBc 3062 aBBc 3063 0: aBBc 3064\= Expect no match 3065 aBC 3066No match 3067 aBBC 3068No match 3069 3070/a(?=b(?i)c)\w\wd/ 3071 abcd 3072 0: abcd 3073 abCd 3074 0: abCd 3075\= Expect no match 3076 aBCd 3077No match 3078 abcD 3079No match 3080 3081/(?s-i:more.*than).*million/i 3082 more than million 3083 0: more than million 3084 more than MILLION 3085 0: more than MILLION 3086 more \n than Million 3087 0: more \x0a than Million 3088\= Expect no match 3089 MORE THAN MILLION 3090No match 3091 more \n than \n million 3092No match 3093 3094/(?:(?s-i)more.*than).*million/i 3095 more than million 3096 0: more than million 3097 more than MILLION 3098 0: more than MILLION 3099 more \n than Million 3100 0: more \x0a than Million 3101\= Expect no match 3102 MORE THAN MILLION 3103No match 3104 more \n than \n million 3105No match 3106 3107/(?>a(?i)b+)+c/ 3108 abc 3109 0: abc 3110 aBbc 3111 0: aBbc 3112 aBBc 3113 0: aBBc 3114\= Expect no match 3115 Abc 3116No match 3117 abAb 3118No match 3119 abbC 3120No match 3121 3122/(?=a(?i)b)\w\wc/ 3123 abc 3124 0: abc 3125 aBc 3126 0: aBc 3127\= Expect no match 3128 Ab 3129No match 3130 abC 3131No match 3132 aBC 3133No match 3134 3135/(?<=a(?i)b)(\w\w)c/ 3136 abxxc 3137 0: xxc 3138 1: xx 3139 aBxxc 3140 0: xxc 3141 1: xx 3142\= Expect no match 3143 Abxxc 3144No match 3145 ABxxc 3146No match 3147 abxxC 3148No match 3149 3150/(?:(a)|b)(?(1)A|B)/ 3151 aA 3152 0: aA 3153 1: a 3154 bB 3155 0: bB 3156\= Expect no match 3157 aB 3158No match 3159 bA 3160No match 3161 3162/^(a)?(?(1)a|b)+$/ 3163 aa 3164 0: aa 3165 1: a 3166 b 3167 0: b 3168 bb 3169 0: bb 3170\= Expect no match 3171 ab 3172No match 3173 3174# Perl gets this next one wrong if the pattern ends with $; in that case it 3175# fails to match "12". 3176 3177/^(?(?=abc)\w{3}:|\d\d)/ 3178 abc: 3179 0: abc: 3180 12 3181 0: 12 3182 123 3183 0: 12 3184\= Expect no match 3185 xyz 3186No match 3187 3188/^(?(?!abc)\d\d|\w{3}:)$/ 3189 abc: 3190 0: abc: 3191 12 3192 0: 12 3193\= Expect no match 3194 123 3195No match 3196 xyz 3197No match 3198 3199/(?(?<=foo)bar|cat)/ 3200 foobar 3201 0: bar 3202 cat 3203 0: cat 3204 fcat 3205 0: cat 3206 focat 3207 0: cat 3208\= Expect no match 3209 foocat 3210No match 3211 3212/(?(?<!foo)cat|bar)/ 3213 foobar 3214 0: bar 3215 cat 3216 0: cat 3217 fcat 3218 0: cat 3219 focat 3220 0: cat 3221\= Expect no match 3222 foocat 3223No match 3224 3225/( \( )? [^()]+ (?(1) \) |) /x 3226 abcd 3227 0: abcd 3228 (abcd) 3229 0: (abcd) 3230 1: ( 3231 the quick (abcd) fox 3232 0: the quick 3233 (abcd 3234 0: abcd 3235 3236/( \( )? [^()]+ (?(1) \) ) /x 3237 abcd 3238 0: abcd 3239 (abcd) 3240 0: (abcd) 3241 1: ( 3242 the quick (abcd) fox 3243 0: the quick 3244 (abcd 3245 0: abcd 3246 3247/^(?(2)a|(1)(2))+$/ 3248 12 3249 0: 12 3250 1: 1 3251 2: 2 3252 12a 3253 0: 12a 3254 1: 1 3255 2: 2 3256 12aa 3257 0: 12aa 3258 1: 1 3259 2: 2 3260\= Expect no match 3261 1234 3262No match 3263 3264/((?i)blah)\s+\1/ 3265 blah blah 3266 0: blah blah 3267 1: blah 3268 BLAH BLAH 3269 0: BLAH BLAH 3270 1: BLAH 3271 Blah Blah 3272 0: Blah Blah 3273 1: Blah 3274 blaH blaH 3275 0: blaH blaH 3276 1: blaH 3277\= Expect no match 3278 blah BLAH 3279No match 3280 Blah blah 3281No match 3282 blaH blah 3283No match 3284 3285/((?i)blah)\s+(?i:\1)/ 3286 blah blah 3287 0: blah blah 3288 1: blah 3289 BLAH BLAH 3290 0: BLAH BLAH 3291 1: BLAH 3292 Blah Blah 3293 0: Blah Blah 3294 1: Blah 3295 blaH blaH 3296 0: blaH blaH 3297 1: blaH 3298 blah BLAH 3299 0: blah BLAH 3300 1: blah 3301 Blah blah 3302 0: Blah blah 3303 1: Blah 3304 blaH blah 3305 0: blaH blah 3306 1: blaH 3307 3308/(?>a*)*/ 3309 a 3310 0: a 3311 aa 3312 0: aa 3313 aaaa 3314 0: aaaa 3315 3316/(abc|)+/ 3317 abc 3318 0: abc 3319 1: 3320 abcabc 3321 0: abcabc 3322 1: 3323 abcabcabc 3324 0: abcabcabc 3325 1: 3326 xyz 3327 0: 3328 1: 3329 3330/([a]*)*/ 3331 a 3332 0: a 3333 1: 3334 aaaaa 3335 0: aaaaa 3336 1: 3337 3338/([ab]*)*/ 3339 a 3340 0: a 3341 1: 3342 b 3343 0: b 3344 1: 3345 ababab 3346 0: ababab 3347 1: 3348 aaaabcde 3349 0: aaaab 3350 1: 3351 bbbb 3352 0: bbbb 3353 1: 3354 3355/([^a]*)*/ 3356 b 3357 0: b 3358 1: 3359 bbbb 3360 0: bbbb 3361 1: 3362 aaa 3363 0: 3364 1: 3365 3366/([^ab]*)*/ 3367 cccc 3368 0: cccc 3369 1: 3370 abab 3371 0: 3372 1: 3373 3374/([a]*?)*/ 3375 a 3376 0: 3377 1: 3378 aaaa 3379 0: 3380 1: 3381 3382/([ab]*?)*/ 3383 a 3384 0: 3385 1: 3386 b 3387 0: 3388 1: 3389 abab 3390 0: 3391 1: 3392 baba 3393 0: 3394 1: 3395 3396/([^a]*?)*/ 3397 b 3398 0: 3399 1: 3400 bbbb 3401 0: 3402 1: 3403 aaa 3404 0: 3405 1: 3406 3407/([^ab]*?)*/ 3408 c 3409 0: 3410 1: 3411 cccc 3412 0: 3413 1: 3414 baba 3415 0: 3416 1: 3417 3418/(?>a*)*/ 3419 a 3420 0: a 3421 aaabcde 3422 0: aaa 3423 3424/((?>a*))*/ 3425 aaaaa 3426 0: aaaaa 3427 1: 3428 aabbaa 3429 0: aa 3430 1: 3431 3432/((?>a*?))*/ 3433 aaaaa 3434 0: 3435 1: 3436 aabbaa 3437 0: 3438 1: 3439 3440/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x 3441 12-sep-98 3442 0: 12-sep-98 3443 12-09-98 3444 0: 12-09-98 3445\= Expect no match 3446 sep-12-98 3447No match 3448 3449/(?<=(foo))bar\1/ 3450 foobarfoo 3451 0: barfoo 3452 1: foo 3453 foobarfootling 3454 0: barfoo 3455 1: foo 3456\= Expect no match 3457 foobar 3458No match 3459 barfoo 3460No match 3461 3462/(?i:saturday|sunday)/ 3463 saturday 3464 0: saturday 3465 sunday 3466 0: sunday 3467 Saturday 3468 0: Saturday 3469 Sunday 3470 0: Sunday 3471 SATURDAY 3472 0: SATURDAY 3473 SUNDAY 3474 0: SUNDAY 3475 SunDay 3476 0: SunDay 3477 3478/(a(?i)bc|BB)x/ 3479 abcx 3480 0: abcx 3481 1: abc 3482 aBCx 3483 0: aBCx 3484 1: aBC 3485 bbx 3486 0: bbx 3487 1: bb 3488 BBx 3489 0: BBx 3490 1: BB 3491\= Expect no match 3492 abcX 3493No match 3494 aBCX 3495No match 3496 bbX 3497No match 3498 BBX 3499No match 3500 3501/^([ab](?i)[cd]|[ef])/ 3502 ac 3503 0: ac 3504 1: ac 3505 aC 3506 0: aC 3507 1: aC 3508 bD 3509 0: bD 3510 1: bD 3511 elephant 3512 0: e 3513 1: e 3514 Europe 3515 0: E 3516 1: E 3517 frog 3518 0: f 3519 1: f 3520 France 3521 0: F 3522 1: F 3523\= Expect no match 3524 Africa 3525No match 3526 3527/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/ 3528 ab 3529 0: ab 3530 1: ab 3531 aBd 3532 0: aBd 3533 1: aBd 3534 xy 3535 0: xy 3536 1: xy 3537 xY 3538 0: xY 3539 1: xY 3540 zebra 3541 0: z 3542 1: z 3543 Zambesi 3544 0: Z 3545 1: Z 3546\= Expect no match 3547 aCD 3548No match 3549 XY 3550No match 3551 3552/(?<=foo\n)^bar/m 3553 foo\nbar 3554 0: bar 3555\= Expect no match 3556 bar 3557No match 3558 baz\nbar 3559No match 3560 3561/(?<=(?<!foo)bar)baz/ 3562 barbaz 3563 0: baz 3564 barbarbaz 3565 0: baz 3566 koobarbaz 3567 0: baz 3568\= Expect no match 3569 baz 3570No match 3571 foobarbaz 3572No match 3573 3574# The cases of aaaa and aaaaaa are missed out below because Perl does things 3575# differently. We know that odd, and maybe incorrect, things happen with 3576# recursive references in Perl, as far as 5.11.3 - see some stuff in test #2. 3577 3578/^(a\1?){4}$/ 3579 aaaaa 3580 0: aaaaa 3581 1: a 3582 aaaaaaa 3583 0: aaaaaaa 3584 1: a 3585 aaaaaaaaaa 3586 0: aaaaaaaaaa 3587 1: aaaa 3588\= Expect no match 3589 a 3590No match 3591 aa 3592No match 3593 aaa 3594No match 3595 aaaaaaaa 3596No match 3597 aaaaaaaaa 3598No match 3599 aaaaaaaaaaa 3600No match 3601 aaaaaaaaaaaa 3602No match 3603 aaaaaaaaaaaaa 3604No match 3605 aaaaaaaaaaaaaa 3606No match 3607 aaaaaaaaaaaaaaa 3608No match 3609 aaaaaaaaaaaaaaaa 3610No match 3611 3612/^(a\1?)(a\1?)(a\2?)(a\3?)$/ 3613 aaaa 3614 0: aaaa 3615 1: a 3616 2: a 3617 3: a 3618 4: a 3619 aaaaa 3620 0: aaaaa 3621 1: a 3622 2: aa 3623 3: a 3624 4: a 3625 aaaaaa 3626 0: aaaaaa 3627 1: a 3628 2: aa 3629 3: a 3630 4: aa 3631 aaaaaaa 3632 0: aaaaaaa 3633 1: a 3634 2: aa 3635 3: aaa 3636 4: a 3637 aaaaaaaaaa 3638 0: aaaaaaaaaa 3639 1: a 3640 2: aa 3641 3: aaa 3642 4: aaaa 3643\= Expect no match 3644 a 3645No match 3646 aa 3647No match 3648 aaa 3649No match 3650 aaaaaaaa 3651No match 3652 aaaaaaaaa 3653No match 3654 aaaaaaaaaaa 3655No match 3656 aaaaaaaaaaaa 3657No match 3658 aaaaaaaaaaaaa 3659No match 3660 aaaaaaaaaaaaaa 3661No match 3662 aaaaaaaaaaaaaaa 3663No match 3664 aaaaaaaaaaaaaaaa 3665No match 3666 3667# The following tests are taken from the Perl 5.005 test suite; some of them 3668# are compatible with 5.004, but I'd rather not have to sort them out. 3669 3670/abc/ 3671 abc 3672 0: abc 3673 xabcy 3674 0: abc 3675 ababc 3676 0: abc 3677\= Expect no match 3678 xbc 3679No match 3680 axc 3681No match 3682 abx 3683No match 3684 3685/ab*c/ 3686 abc 3687 0: abc 3688 3689/ab*bc/ 3690 abc 3691 0: abc 3692 abbc 3693 0: abbc 3694 abbbbc 3695 0: abbbbc 3696 3697/.{1}/ 3698 abbbbc 3699 0: a 3700 3701/.{3,4}/ 3702 abbbbc 3703 0: abbb 3704 3705/ab{0,}bc/ 3706 abbbbc 3707 0: abbbbc 3708 3709/ab+bc/ 3710 abbc 3711 0: abbc 3712\= Expect no match 3713 abc 3714No match 3715 abq 3716No match 3717 3718/ab{1,}bc/ 3719 3720/ab+bc/ 3721 abbbbc 3722 0: abbbbc 3723 3724/ab{1,}bc/ 3725 abbbbc 3726 0: abbbbc 3727 3728/ab{1,3}bc/ 3729 abbbbc 3730 0: abbbbc 3731 3732/ab{3,4}bc/ 3733 abbbbc 3734 0: abbbbc 3735 3736/ab{4,5}bc/ 3737\= Expect no match 3738 abq 3739No match 3740 abbbbc 3741No match 3742 3743/ab?bc/ 3744 abbc 3745 0: abbc 3746 abc 3747 0: abc 3748 3749/ab{0,1}bc/ 3750 abc 3751 0: abc 3752 3753/ab?bc/ 3754 3755/ab?c/ 3756 abc 3757 0: abc 3758 3759/ab{0,1}c/ 3760 abc 3761 0: abc 3762 3763/^abc$/ 3764 abc 3765 0: abc 3766\= Expect no match 3767 abbbbc 3768No match 3769 abcc 3770No match 3771 3772/^abc/ 3773 abcc 3774 0: abc 3775 3776/^abc$/ 3777 3778/abc$/ 3779 aabc 3780 0: abc 3781\= Expect no match 3782 aabcd 3783No match 3784 3785/^/ 3786 abc 3787 0: 3788 3789/$/ 3790 abc 3791 0: 3792 3793/a.c/ 3794 abc 3795 0: abc 3796 axc 3797 0: axc 3798 3799/a.*c/ 3800 axyzc 3801 0: axyzc 3802 3803/a[bc]d/ 3804 abd 3805 0: abd 3806\= Expect no match 3807 axyzd 3808No match 3809 abc 3810No match 3811 3812/a[b-d]e/ 3813 ace 3814 0: ace 3815 3816/a[b-d]/ 3817 aac 3818 0: ac 3819 3820/a[-b]/ 3821 a- 3822 0: a- 3823 3824/a[b-]/ 3825 a- 3826 0: a- 3827 3828/a]/ 3829 a] 3830 0: a] 3831 3832/a[]]b/ 3833 a]b 3834 0: a]b 3835 3836/a[^bc]d/ 3837 aed 3838 0: aed 3839\= Expect no match 3840 abd 3841No match 3842 abd 3843No match 3844 3845/a[^-b]c/ 3846 adc 3847 0: adc 3848 3849/a[^]b]c/ 3850 adc 3851 0: adc 3852 a-c 3853 0: a-c 3854\= Expect no match 3855 a]c 3856No match 3857 3858/\ba\b/ 3859 a- 3860 0: a 3861 -a 3862 0: a 3863 -a- 3864 0: a 3865 3866/\by\b/ 3867\= Expect no match 3868 xy 3869No match 3870 yz 3871No match 3872 xyz 3873No match 3874 3875/\Ba\B/ 3876\= Expect no match 3877 a- 3878No match 3879 -a 3880No match 3881 -a- 3882No match 3883 3884/\By\b/ 3885 xy 3886 0: y 3887 3888/\by\B/ 3889 yz 3890 0: y 3891 3892/\By\B/ 3893 xyz 3894 0: y 3895 3896/\w/ 3897 a 3898 0: a 3899 3900/\W/ 3901 - 3902 0: - 3903\= Expect no match 3904 a 3905No match 3906 3907/a\sb/ 3908 a b 3909 0: a b 3910 3911/a\Sb/ 3912 a-b 3913 0: a-b 3914\= Expect no match 3915 a b 3916No match 3917 3918/\d/ 3919 1 3920 0: 1 3921 3922/\D/ 3923 - 3924 0: - 3925\= Expect no match 3926 1 3927No match 3928 3929/[\w]/ 3930 a 3931 0: a 3932 3933/[\W]/ 3934 - 3935 0: - 3936\= Expect no match 3937 a 3938No match 3939 3940/a[\s]b/ 3941 a b 3942 0: a b 3943 3944/a[\S]b/ 3945 a-b 3946 0: a-b 3947\= Expect no match 3948 a b 3949No match 3950 3951/[\d]/ 3952 1 3953 0: 1 3954 3955/[\D]/ 3956 - 3957 0: - 3958\= Expect no match 3959 1 3960No match 3961 3962/ab|cd/ 3963 abc 3964 0: ab 3965 abcd 3966 0: ab 3967 3968/()ef/ 3969 def 3970 0: ef 3971 1: 3972 3973/$b/ 3974 3975/a\(b/ 3976 a(b 3977 0: a(b 3978 3979/a\(*b/ 3980 ab 3981 0: ab 3982 a((b 3983 0: a((b 3984 3985/a\\b/ 3986 a\\b 3987 0: a\b 3988 3989/((a))/ 3990 abc 3991 0: a 3992 1: a 3993 2: a 3994 3995/(a)b(c)/ 3996 abc 3997 0: abc 3998 1: a 3999 2: c 4000 4001/a+b+c/ 4002 aabbabc 4003 0: abc 4004 4005/a{1,}b{1,}c/ 4006 aabbabc 4007 0: abc 4008 4009/a.+?c/ 4010 abcabc 4011 0: abc 4012 4013/(a+|b)*/ 4014 ab 4015 0: ab 4016 1: b 4017 4018/(a+|b){0,}/ 4019 ab 4020 0: ab 4021 1: b 4022 4023/(a+|b)+/ 4024 ab 4025 0: ab 4026 1: b 4027 4028/(a+|b){1,}/ 4029 ab 4030 0: ab 4031 1: b 4032 4033/(a+|b)?/ 4034 ab 4035 0: a 4036 1: a 4037 4038/(a+|b){0,1}/ 4039 ab 4040 0: a 4041 1: a 4042 4043/[^ab]*/ 4044 cde 4045 0: cde 4046 4047/abc/ 4048\= Expect no match 4049 b 4050No match 4051 4052/a*/ 4053 \ 4054 0: 4055 4056/([abc])*d/ 4057 abbbcd 4058 0: abbbcd 4059 1: c 4060 4061/([abc])*bcd/ 4062 abcd 4063 0: abcd 4064 1: a 4065 4066/a|b|c|d|e/ 4067 e 4068 0: e 4069 4070/(a|b|c|d|e)f/ 4071 ef 4072 0: ef 4073 1: e 4074 4075/abcd*efg/ 4076 abcdefg 4077 0: abcdefg 4078 4079/ab*/ 4080 xabyabbbz 4081 0: ab 4082 xayabbbz 4083 0: a 4084 4085/(ab|cd)e/ 4086 abcde 4087 0: cde 4088 1: cd 4089 4090/[abhgefdc]ij/ 4091 hij 4092 0: hij 4093 4094/^(ab|cd)e/ 4095 4096/(abc|)ef/ 4097 abcdef 4098 0: ef 4099 1: 4100 4101/(a|b)c*d/ 4102 abcd 4103 0: bcd 4104 1: b 4105 4106/(ab|ab*)bc/ 4107 abc 4108 0: abc 4109 1: a 4110 4111/a([bc]*)c*/ 4112 abc 4113 0: abc 4114 1: bc 4115 4116/a([bc]*)(c*d)/ 4117 abcd 4118 0: abcd 4119 1: bc 4120 2: d 4121 4122/a([bc]+)(c*d)/ 4123 abcd 4124 0: abcd 4125 1: bc 4126 2: d 4127 4128/a([bc]*)(c+d)/ 4129 abcd 4130 0: abcd 4131 1: b 4132 2: cd 4133 4134/a[bcd]*dcdcde/ 4135 adcdcde 4136 0: adcdcde 4137 4138/a[bcd]+dcdcde/ 4139\= Expect no match 4140 abcde 4141No match 4142 adcdcde 4143No match 4144 4145/(ab|a)b*c/ 4146 abc 4147 0: abc 4148 1: ab 4149 4150/((a)(b)c)(d)/ 4151 abcd 4152 0: abcd 4153 1: abc 4154 2: a 4155 3: b 4156 4: d 4157 4158/[a-zA-Z_][a-zA-Z0-9_]*/ 4159 alpha 4160 0: alpha 4161 4162/^a(bc+|b[eh])g|.h$/ 4163 abh 4164 0: bh 4165 4166/(bc+d$|ef*g.|h?i(j|k))/ 4167 effgz 4168 0: effgz 4169 1: effgz 4170 ij 4171 0: ij 4172 1: ij 4173 2: j 4174 reffgz 4175 0: effgz 4176 1: effgz 4177\= Expect no match 4178 effg 4179No match 4180 bcdd 4181No match 4182 4183/((((((((((a))))))))))/ 4184 a 4185 0: a 4186 1: a 4187 2: a 4188 3: a 4189 4: a 4190 5: a 4191 6: a 4192 7: a 4193 8: a 4194 9: a 419510: a 4196 4197/((((((((((a))))))))))\10/ 4198 aa 4199 0: aa 4200 1: a 4201 2: a 4202 3: a 4203 4: a 4204 5: a 4205 6: a 4206 7: a 4207 8: a 4208 9: a 420910: a 4210 4211/(((((((((a)))))))))/ 4212 a 4213 0: a 4214 1: a 4215 2: a 4216 3: a 4217 4: a 4218 5: a 4219 6: a 4220 7: a 4221 8: a 4222 9: a 4223 4224/multiple words of text/ 4225\= Expect no match 4226 aa 4227No match 4228 uh-uh 4229No match 4230 4231/multiple words/ 4232 multiple words, yeah 4233 0: multiple words 4234 4235/(.*)c(.*)/ 4236 abcde 4237 0: abcde 4238 1: ab 4239 2: de 4240 4241/\((.*), (.*)\)/ 4242 (a, b) 4243 0: (a, b) 4244 1: a 4245 2: b 4246 4247/[k]/ 4248 4249/abcd/ 4250 abcd 4251 0: abcd 4252 4253/a(bc)d/ 4254 abcd 4255 0: abcd 4256 1: bc 4257 4258/a[-]?c/ 4259 ac 4260 0: ac 4261 4262/(abc)\1/ 4263 abcabc 4264 0: abcabc 4265 1: abc 4266 4267/([a-c]*)\1/ 4268 abcabc 4269 0: abcabc 4270 1: abc 4271 4272/(a)|\1/ 4273 a 4274 0: a 4275 1: a 4276 ab 4277 0: a 4278 1: a 4279\= Expect no match 4280 x 4281No match 4282 4283/(([a-c])b*?\2)*/ 4284 ababbbcbc 4285 0: ababb 4286 1: bb 4287 2: b 4288 4289/(([a-c])b*?\2){3}/ 4290 ababbbcbc 4291 0: ababbbcbc 4292 1: cbc 4293 2: c 4294 4295/((\3|b)\2(a)x)+/ 4296 aaaxabaxbaaxbbax 4297 0: bbax 4298 1: bbax 4299 2: b 4300 3: a 4301 4302/((\3|b)\2(a)){2,}/ 4303 bbaababbabaaaaabbaaaabba 4304 0: bbaaaabba 4305 1: bba 4306 2: b 4307 3: a 4308 4309/abc/i 4310 ABC 4311 0: ABC 4312 XABCY 4313 0: ABC 4314 ABABC 4315 0: ABC 4316\= Expect no match 4317 aaxabxbaxbbx 4318No match 4319 XBC 4320No match 4321 AXC 4322No match 4323 ABX 4324No match 4325 4326/ab*c/i 4327 ABC 4328 0: ABC 4329 4330/ab*bc/i 4331 ABC 4332 0: ABC 4333 ABBC 4334 0: ABBC 4335 4336/ab*?bc/i 4337 ABBBBC 4338 0: ABBBBC 4339 4340/ab{0,}?bc/i 4341 ABBBBC 4342 0: ABBBBC 4343 4344/ab+?bc/i 4345 ABBC 4346 0: ABBC 4347 4348/ab+bc/i 4349\= Expect no match 4350 ABC 4351No match 4352 ABQ 4353No match 4354 4355/ab{1,}bc/i 4356 4357/ab+bc/i 4358 ABBBBC 4359 0: ABBBBC 4360 4361/ab{1,}?bc/i 4362 ABBBBC 4363 0: ABBBBC 4364 4365/ab{1,3}?bc/i 4366 ABBBBC 4367 0: ABBBBC 4368 4369/ab{3,4}?bc/i 4370 ABBBBC 4371 0: ABBBBC 4372 4373/ab{4,5}?bc/i 4374\= Expect no match 4375 ABQ 4376No match 4377 ABBBBC 4378No match 4379 4380/ab??bc/i 4381 ABBC 4382 0: ABBC 4383 ABC 4384 0: ABC 4385 4386/ab{0,1}?bc/i 4387 ABC 4388 0: ABC 4389 4390/ab??bc/i 4391 4392/ab??c/i 4393 ABC 4394 0: ABC 4395 4396/ab{0,1}?c/i 4397 ABC 4398 0: ABC 4399 4400/^abc$/i 4401 ABC 4402 0: ABC 4403\= Expect no match 4404 ABBBBC 4405No match 4406 ABCC 4407No match 4408 4409/^abc/i 4410 ABCC 4411 0: ABC 4412 4413/^abc$/i 4414 4415/abc$/i 4416 AABC 4417 0: ABC 4418 4419/^/i 4420 ABC 4421 0: 4422 4423/$/i 4424 ABC 4425 0: 4426 4427/a.c/i 4428 ABC 4429 0: ABC 4430 AXC 4431 0: AXC 4432 4433/a.*?c/i 4434 AXYZC 4435 0: AXYZC 4436 4437/a.*c/i 4438 AABC 4439 0: AABC 4440\= Expect no match 4441 AXYZD 4442No match 4443 4444/a[bc]d/i 4445 ABD 4446 0: ABD 4447 4448/a[b-d]e/i 4449 ACE 4450 0: ACE 4451\= Expect no match 4452 ABC 4453No match 4454 ABD 4455No match 4456 4457/a[b-d]/i 4458 AAC 4459 0: AC 4460 4461/a[-b]/i 4462 A- 4463 0: A- 4464 4465/a[b-]/i 4466 A- 4467 0: A- 4468 4469/a]/i 4470 A] 4471 0: A] 4472 4473/a[]]b/i 4474 A]B 4475 0: A]B 4476 4477/a[^bc]d/i 4478 AED 4479 0: AED 4480 4481/a[^-b]c/i 4482 ADC 4483 0: ADC 4484\= Expect no match 4485 ABD 4486No match 4487 A-C 4488No match 4489 4490/a[^]b]c/i 4491 ADC 4492 0: ADC 4493 4494/ab|cd/i 4495 ABC 4496 0: AB 4497 ABCD 4498 0: AB 4499 4500/()ef/i 4501 DEF 4502 0: EF 4503 1: 4504 4505/$b/i 4506\= Expect no match 4507 A]C 4508No match 4509 B 4510No match 4511 4512/a\(b/i 4513 A(B 4514 0: A(B 4515 4516/a\(*b/i 4517 AB 4518 0: AB 4519 A((B 4520 0: A((B 4521 4522/a\\b/i 4523 A\\b 4524 0: A\b 4525 a\\B 4526 0: a\B 4527 4528/((a))/i 4529 ABC 4530 0: A 4531 1: A 4532 2: A 4533 4534/(a)b(c)/i 4535 ABC 4536 0: ABC 4537 1: A 4538 2: C 4539 4540/a+b+c/i 4541 AABBABC 4542 0: ABC 4543 4544/a{1,}b{1,}c/i 4545 AABBABC 4546 0: ABC 4547 4548/a.+?c/i 4549 ABCABC 4550 0: ABC 4551 4552/a.*?c/i 4553 ABCABC 4554 0: ABC 4555 4556/a.{0,5}?c/i 4557 ABCABC 4558 0: ABC 4559 4560/(a+|b)*/i 4561 AB 4562 0: AB 4563 1: B 4564 4565/(a+|b){0,}/i 4566 AB 4567 0: AB 4568 1: B 4569 4570/(a+|b)+/i 4571 AB 4572 0: AB 4573 1: B 4574 4575/(a+|b){1,}/i 4576 AB 4577 0: AB 4578 1: B 4579 4580/(a+|b)?/i 4581 AB 4582 0: A 4583 1: A 4584 4585/(a+|b){0,1}/i 4586 AB 4587 0: A 4588 1: A 4589 4590/(a+|b){0,1}?/i 4591 AB 4592 0: 4593 4594/[^ab]*/i 4595 CDE 4596 0: CDE 4597 4598/([abc])*d/i 4599 ABBBCD 4600 0: ABBBCD 4601 1: C 4602 4603/([abc])*bcd/i 4604 ABCD 4605 0: ABCD 4606 1: A 4607 4608/a|b|c|d|e/i 4609 E 4610 0: E 4611 4612/(a|b|c|d|e)f/i 4613 EF 4614 0: EF 4615 1: E 4616 4617/abcd*efg/i 4618 ABCDEFG 4619 0: ABCDEFG 4620 4621/ab*/i 4622 XABYABBBZ 4623 0: AB 4624 XAYABBBZ 4625 0: A 4626 4627/(ab|cd)e/i 4628 ABCDE 4629 0: CDE 4630 1: CD 4631 4632/[abhgefdc]ij/i 4633 HIJ 4634 0: HIJ 4635 4636/^(ab|cd)e/i 4637\= Expect no match 4638 ABCDE 4639No match 4640 4641/(abc|)ef/i 4642 ABCDEF 4643 0: EF 4644 1: 4645 4646/(a|b)c*d/i 4647 ABCD 4648 0: BCD 4649 1: B 4650 4651/(ab|ab*)bc/i 4652 ABC 4653 0: ABC 4654 1: A 4655 4656/a([bc]*)c*/i 4657 ABC 4658 0: ABC 4659 1: BC 4660 4661/a([bc]*)(c*d)/i 4662 ABCD 4663 0: ABCD 4664 1: BC 4665 2: D 4666 4667/a([bc]+)(c*d)/i 4668 ABCD 4669 0: ABCD 4670 1: BC 4671 2: D 4672 4673/a([bc]*)(c+d)/i 4674 ABCD 4675 0: ABCD 4676 1: B 4677 2: CD 4678 4679/a[bcd]*dcdcde/i 4680 ADCDCDE 4681 0: ADCDCDE 4682 4683/a[bcd]+dcdcde/i 4684 4685/(ab|a)b*c/i 4686 ABC 4687 0: ABC 4688 1: AB 4689 4690/((a)(b)c)(d)/i 4691 ABCD 4692 0: ABCD 4693 1: ABC 4694 2: A 4695 3: B 4696 4: D 4697 4698/[a-zA-Z_][a-zA-Z0-9_]*/i 4699 ALPHA 4700 0: ALPHA 4701 4702/^a(bc+|b[eh])g|.h$/i 4703 ABH 4704 0: BH 4705 4706/(bc+d$|ef*g.|h?i(j|k))/i 4707 EFFGZ 4708 0: EFFGZ 4709 1: EFFGZ 4710 IJ 4711 0: IJ 4712 1: IJ 4713 2: J 4714 REFFGZ 4715 0: EFFGZ 4716 1: EFFGZ 4717\= Expect no match 4718 ADCDCDE 4719No match 4720 EFFG 4721No match 4722 BCDD 4723No match 4724 4725/((((((((((a))))))))))/i 4726 A 4727 0: A 4728 1: A 4729 2: A 4730 3: A 4731 4: A 4732 5: A 4733 6: A 4734 7: A 4735 8: A 4736 9: A 473710: A 4738 4739/((((((((((a))))))))))\10/i 4740 AA 4741 0: AA 4742 1: A 4743 2: A 4744 3: A 4745 4: A 4746 5: A 4747 6: A 4748 7: A 4749 8: A 4750 9: A 475110: A 4752 4753/(((((((((a)))))))))/i 4754 A 4755 0: A 4756 1: A 4757 2: A 4758 3: A 4759 4: A 4760 5: A 4761 6: A 4762 7: A 4763 8: A 4764 9: A 4765 4766/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i 4767 A 4768 0: A 4769 1: A 4770 4771/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i 4772 C 4773 0: C 4774 1: C 4775 4776/multiple words of text/i 4777\= Expect no match 4778 AA 4779No match 4780 UH-UH 4781No match 4782 4783/multiple words/i 4784 MULTIPLE WORDS, YEAH 4785 0: MULTIPLE WORDS 4786 4787/(.*)c(.*)/i 4788 ABCDE 4789 0: ABCDE 4790 1: AB 4791 2: DE 4792 4793/\((.*), (.*)\)/i 4794 (A, B) 4795 0: (A, B) 4796 1: A 4797 2: B 4798 4799/[k]/i 4800 4801/abcd/i 4802 ABCD 4803 0: ABCD 4804 4805/a(bc)d/i 4806 ABCD 4807 0: ABCD 4808 1: BC 4809 4810/a[-]?c/i 4811 AC 4812 0: AC 4813 4814/(abc)\1/i 4815 ABCABC 4816 0: ABCABC 4817 1: ABC 4818 4819/([a-c]*)\1/i 4820 ABCABC 4821 0: ABCABC 4822 1: ABC 4823 4824/a(?!b)./ 4825 abad 4826 0: ad 4827 4828/a(?=d)./ 4829 abad 4830 0: ad 4831 4832/a(?=c|d)./ 4833 abad 4834 0: ad 4835 4836/a(?:b|c|d)(.)/ 4837 ace 4838 0: ace 4839 1: e 4840 4841/a(?:b|c|d)*(.)/ 4842 ace 4843 0: ace 4844 1: e 4845 4846/a(?:b|c|d)+?(.)/ 4847 ace 4848 0: ace 4849 1: e 4850 acdbcdbe 4851 0: acd 4852 1: d 4853 4854/a(?:b|c|d)+(.)/ 4855 acdbcdbe 4856 0: acdbcdbe 4857 1: e 4858 4859/a(?:b|c|d){2}(.)/ 4860 acdbcdbe 4861 0: acdb 4862 1: b 4863 4864/a(?:b|c|d){4,5}(.)/ 4865 acdbcdbe 4866 0: acdbcdb 4867 1: b 4868 4869/a(?:b|c|d){4,5}?(.)/ 4870 acdbcdbe 4871 0: acdbcd 4872 1: d 4873 4874/((foo)|(bar))*/ 4875 foobar 4876 0: foobar 4877 1: bar 4878 2: foo 4879 3: bar 4880 4881/a(?:b|c|d){6,7}(.)/ 4882 acdbcdbe 4883 0: acdbcdbe 4884 1: e 4885 4886/a(?:b|c|d){6,7}?(.)/ 4887 acdbcdbe 4888 0: acdbcdbe 4889 1: e 4890 4891/a(?:b|c|d){5,6}(.)/ 4892 acdbcdbe 4893 0: acdbcdbe 4894 1: e 4895 4896/a(?:b|c|d){5,6}?(.)/ 4897 acdbcdbe 4898 0: acdbcdb 4899 1: b 4900 4901/a(?:b|c|d){5,7}(.)/ 4902 acdbcdbe 4903 0: acdbcdbe 4904 1: e 4905 4906/a(?:b|c|d){5,7}?(.)/ 4907 acdbcdbe 4908 0: acdbcdb 4909 1: b 4910 4911/a(?:b|(c|e){1,2}?|d)+?(.)/ 4912 ace 4913 0: ace 4914 1: c 4915 2: e 4916 4917/^(.+)?B/ 4918 AB 4919 0: AB 4920 1: A 4921 4922/^([^a-z])|(\^)$/ 4923 . 4924 0: . 4925 1: . 4926 4927/^[<>]&/ 4928 <&OUT 4929 0: <& 4930 4931/^(a\1?){4}$/ 4932 aaaaaaaaaa 4933 0: aaaaaaaaaa 4934 1: aaaa 4935\= Expect no match 4936 AB 4937No match 4938 aaaaaaaaa 4939No match 4940 aaaaaaaaaaa 4941No match 4942 4943/^(a(?(1)\1)){4}$/ 4944 aaaaaaaaaa 4945 0: aaaaaaaaaa 4946 1: aaaa 4947\= Expect no match 4948 aaaaaaaaa 4949No match 4950 aaaaaaaaaaa 4951No match 4952 4953/(?:(f)(o)(o)|(b)(a)(r))*/ 4954 foobar 4955 0: foobar 4956 1: f 4957 2: o 4958 3: o 4959 4: b 4960 5: a 4961 6: r 4962 4963/(?<=a)b/ 4964 ab 4965 0: b 4966\= Expect no match 4967 cb 4968No match 4969 b 4970No match 4971 4972/(?<!c)b/ 4973 ab 4974 0: b 4975 b 4976 0: b 4977 b 4978 0: b 4979 4980/(?:..)*a/ 4981 aba 4982 0: aba 4983 4984/(?:..)*?a/ 4985 aba 4986 0: a 4987 4988/^(?:b|a(?=(.)))*\1/ 4989 abc 4990 0: ab 4991 1: b 4992 4993/^(){3,5}/ 4994 abc 4995 0: 4996 1: 4997 4998/^(a+)*ax/ 4999 aax 5000 0: aax 5001 1: a 5002 5003/^((a|b)+)*ax/ 5004 aax 5005 0: aax 5006 1: a 5007 2: a 5008 5009/^((a|bc)+)*ax/ 5010 aax 5011 0: aax 5012 1: a 5013 2: a 5014 5015/(a|x)*ab/ 5016 cab 5017 0: ab 5018 5019/(a)*ab/ 5020 cab 5021 0: ab 5022 5023/(?:(?i)a)b/ 5024 ab 5025 0: ab 5026 5027/((?i)a)b/ 5028 ab 5029 0: ab 5030 1: a 5031 5032/(?:(?i)a)b/ 5033 Ab 5034 0: Ab 5035 5036/((?i)a)b/ 5037 Ab 5038 0: Ab 5039 1: A 5040 5041/(?:(?i)a)b/ 5042\= Expect no match 5043 cb 5044No match 5045 aB 5046No match 5047 5048/((?i)a)b/ 5049 5050/(?i:a)b/ 5051 ab 5052 0: ab 5053 5054/((?i:a))b/ 5055 ab 5056 0: ab 5057 1: a 5058 5059/(?i:a)b/ 5060 Ab 5061 0: Ab 5062 5063/((?i:a))b/ 5064 Ab 5065 0: Ab 5066 1: A 5067 5068/(?i:a)b/ 5069\= Expect no match 5070 aB 5071No match 5072 aB 5073No match 5074 5075/((?i:a))b/ 5076 5077/(?:(?-i)a)b/i 5078 ab 5079 0: ab 5080 5081/((?-i)a)b/i 5082 ab 5083 0: ab 5084 1: a 5085 5086/(?:(?-i)a)b/i 5087 aB 5088 0: aB 5089 5090/((?-i)a)b/i 5091 aB 5092 0: aB 5093 1: a 5094 5095/(?:(?-i)a)b/i 5096 aB 5097 0: aB 5098\= Expect no match 5099 Ab 5100No match 5101 AB 5102No match 5103 5104/(?-i:a)b/i 5105 ab 5106 0: ab 5107 5108/((?-i:a))b/i 5109 ab 5110 0: ab 5111 1: a 5112 5113/(?-i:a)b/i 5114 aB 5115 0: aB 5116 5117/((?-i:a))b/i 5118 aB 5119 0: aB 5120 1: a 5121 5122/(?-i:a)b/i 5123\= Expect no match 5124 AB 5125No match 5126 Ab 5127No match 5128 5129/((?-i:a))b/i 5130 5131/(?-i:a)b/i 5132 aB 5133 0: aB 5134 5135/((?-i:a))b/i 5136 aB 5137 0: aB 5138 1: a 5139 5140/(?-i:a)b/i 5141\= Expect no match 5142 Ab 5143No match 5144 AB 5145No match 5146 5147/((?-i:a))b/i 5148 5149/((?-i:a.))b/i 5150\= Expect no match 5151 AB 5152No match 5153 a\nB 5154No match 5155 5156/((?s-i:a.))b/i 5157 a\nB 5158 0: a\x0aB 5159 1: a\x0a 5160 5161/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/ 5162 cabbbb 5163 0: cabbbb 5164 5165/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/ 5166 caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 5167 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 5168 5169/(ab)\d\1/i 5170 Ab4ab 5171 0: Ab4ab 5172 1: Ab 5173 ab4Ab 5174 0: ab4Ab 5175 1: ab 5176 5177/foo\w*\d{4}baz/ 5178 foobar1234baz 5179 0: foobar1234baz 5180 5181/x(~~)*(?:(?:F)?)?/ 5182 x~~ 5183 0: x~~ 5184 1: ~~ 5185 5186/^a(?#xxx){3}c/ 5187 aaac 5188 0: aaac 5189 5190/^a (?#xxx) (?#yyy) {3}c/x 5191 aaac 5192 0: aaac 5193 5194/(?<![cd])b/ 5195\= Expect no match 5196 B\nB 5197No match 5198 dbcb 5199No match 5200 5201/(?<![cd])[ab]/ 5202 dbaacb 5203 0: a 5204 5205/(?<!(c|d))b/ 5206 5207/(?<!(c|d))[ab]/ 5208 dbaacb 5209 0: a 5210 5211/(?<!cd)[ab]/ 5212 cdaccb 5213 0: b 5214 5215/^(?:a?b?)*$/ 5216 \ 5217 0: 5218 a 5219 0: a 5220 ab 5221 0: ab 5222 aaa 5223 0: aaa 5224\= Expect no match 5225 dbcb 5226No match 5227 a-- 5228No match 5229 aa-- 5230No match 5231 5232/((?s)^a(.))((?m)^b$)/ 5233 a\nb\nc\n 5234 0: a\x0ab 5235 1: a\x0a 5236 2: \x0a 5237 3: b 5238 5239/((?m)^b$)/ 5240 a\nb\nc\n 5241 0: b 5242 1: b 5243 5244/(?m)^b/ 5245 a\nb\n 5246 0: b 5247 5248/(?m)^(b)/ 5249 a\nb\n 5250 0: b 5251 1: b 5252 5253/((?m)^b)/ 5254 a\nb\n 5255 0: b 5256 1: b 5257 5258/\n((?m)^b)/ 5259 a\nb\n 5260 0: \x0ab 5261 1: b 5262 5263/((?s).)c(?!.)/ 5264 a\nb\nc\n 5265 0: \x0ac 5266 1: \x0a 5267 a\nb\nc\n 5268 0: \x0ac 5269 1: \x0a 5270 5271/((?s)b.)c(?!.)/ 5272 a\nb\nc\n 5273 0: b\x0ac 5274 1: b\x0a 5275 a\nb\nc\n 5276 0: b\x0ac 5277 1: b\x0a 5278 5279/^b/ 5280 5281/()^b/ 5282\= Expect no match 5283 a\nb\nc\n 5284No match 5285 a\nb\nc\n 5286No match 5287 5288/((?m)^b)/ 5289 a\nb\nc\n 5290 0: b 5291 1: b 5292 5293/(x)?(?(1)a|b)/ 5294\= Expect no match 5295 a 5296No match 5297 a 5298No match 5299 5300/(x)?(?(1)b|a)/ 5301 a 5302 0: a 5303 5304/()?(?(1)b|a)/ 5305 a 5306 0: a 5307 5308/()(?(1)b|a)/ 5309 5310/()?(?(1)a|b)/ 5311 a 5312 0: a 5313 1: 5314 5315/^(\()?blah(?(1)(\)))$/ 5316 (blah) 5317 0: (blah) 5318 1: ( 5319 2: ) 5320 blah 5321 0: blah 5322\= Expect no match 5323 a 5324No match 5325 blah) 5326No match 5327 (blah 5328No match 5329 5330/^(\(+)?blah(?(1)(\)))$/ 5331 (blah) 5332 0: (blah) 5333 1: ( 5334 2: ) 5335 blah 5336 0: blah 5337\= Expect no match 5338 blah) 5339No match 5340 (blah 5341No match 5342 5343/(?(?!a)a|b)/ 5344 5345/(?(?!a)b|a)/ 5346 a 5347 0: a 5348 5349/(?(?=a)b|a)/ 5350\= Expect no match 5351 a 5352No match 5353 a 5354No match 5355 5356/(?(?=a)a|b)/ 5357 a 5358 0: a 5359 5360/(?=(a+?))(\1ab)/ 5361 aaab 5362 0: aab 5363 1: a 5364 2: aab 5365 5366/^(?=(a+?))\1ab/ 5367 5368/(\w+:)+/ 5369 one: 5370 0: one: 5371 1: one: 5372 5373/$(?<=^(a))/ 5374 a 5375 0: 5376 1: a 5377 5378/(?=(a+?))(\1ab)/ 5379 aaab 5380 0: aab 5381 1: a 5382 2: aab 5383 5384/^(?=(a+?))\1ab/ 5385\= Expect no match 5386 aaab 5387No match 5388 aaab 5389No match 5390 5391/([\w:]+::)?(\w+)$/ 5392 abcd 5393 0: abcd 5394 1: <unset> 5395 2: abcd 5396 xy:z:::abcd 5397 0: xy:z:::abcd 5398 1: xy:z::: 5399 2: abcd 5400 5401/^[^bcd]*(c+)/ 5402 aexycd 5403 0: aexyc 5404 1: c 5405 5406/(a*)b+/ 5407 caab 5408 0: aab 5409 1: aa 5410 5411/([\w:]+::)?(\w+)$/ 5412 abcd 5413 0: abcd 5414 1: <unset> 5415 2: abcd 5416 xy:z:::abcd 5417 0: xy:z:::abcd 5418 1: xy:z::: 5419 2: abcd 5420\= Expect no match 5421 abcd: 5422No match 5423 abcd: 5424No match 5425 5426/^[^bcd]*(c+)/ 5427 aexycd 5428 0: aexyc 5429 1: c 5430 5431/(>a+)ab/ 5432 5433/(?>a+)b/ 5434 aaab 5435 0: aaab 5436 5437/([[:]+)/ 5438 a:[b]: 5439 0: :[ 5440 1: :[ 5441 5442/([[=]+)/ 5443 a=[b]= 5444 0: =[ 5445 1: =[ 5446 5447/([[.]+)/ 5448 a.[b]. 5449 0: .[ 5450 1: .[ 5451 5452/((?>a+)b)/ 5453 aaab 5454 0: aaab 5455 1: aaab 5456 5457/(?>(a+))b/ 5458 aaab 5459 0: aaab 5460 1: aaa 5461 5462/((?>[^()]+)|\([^()]*\))+/ 5463 ((abc(ade)ufh()()x 5464 0: abc(ade)ufh()()x 5465 1: x 5466 5467/a\Z/ 5468\= Expect no match 5469 aaab 5470No match 5471 a\nb\n 5472No match 5473 5474/b\Z/ 5475 a\nb\n 5476 0: b 5477 5478/b\z/ 5479 5480/b\Z/ 5481 a\nb 5482 0: b 5483 5484/b\z/ 5485 a\nb 5486 0: b 5487 5488/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/ 5489 a 5490 0: a 5491 1: 5492 abc 5493 0: abc 5494 1: 5495 a-b 5496 0: a-b 5497 1: 5498 0-9 5499 0: 0-9 5500 1: 5501 a.b 5502 0: a.b 5503 1: 5504 5.6.7 5505 0: 5.6.7 5506 1: 5507 the.quick.brown.fox 5508 0: the.quick.brown.fox 5509 1: 5510 a100.b200.300c 5511 0: a100.b200.300c 5512 1: 5513 12-ab.1245 5514 0: 12-ab.1245 5515 1: 5516\= Expect no match 5517 \ 5518No match 5519 .a 5520No match 5521 -a 5522No match 5523 a- 5524No match 5525 a. 5526No match 5527 a_b 5528No match 5529 a.- 5530No match 5531 a.. 5532No match 5533 ab..bc 5534No match 5535 the.quick.brown.fox- 5536No match 5537 the.quick.brown.fox. 5538No match 5539 the.quick.brown.fox_ 5540No match 5541 the.quick.brown.fox+ 5542No match 5543 5544/(?>.*)(?<=(abcd|wxyz))/ 5545 alphabetabcd 5546 0: alphabetabcd 5547 1: abcd 5548 endingwxyz 5549 0: endingwxyz 5550 1: wxyz 5551\= Expect no match 5552 a rather long string that doesn't end with one of them 5553No match 5554 5555/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/ 5556 word cat dog elephant mussel cow horse canary baboon snake shark otherword 5557 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword 5558\= Expect no match 5559 word cat dog elephant mussel cow horse canary baboon snake shark 5560No match 5561 5562/word (?>[a-zA-Z0-9]+ ){0,30}otherword/ 5563\= Expect no match 5564 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 5565No match 5566 5567/(?<=\d{3}(?!999))foo/ 5568 999foo 5569 0: foo 5570 123999foo 5571 0: foo 5572\= Expect no match 5573 123abcfoo 5574No match 5575 5576/(?<=(?!...999)\d{3})foo/ 5577 999foo 5578 0: foo 5579 123999foo 5580 0: foo 5581\= Expect no match 5582 123abcfoo 5583No match 5584 5585/(?<=\d{3}(?!999)...)foo/ 5586 123abcfoo 5587 0: foo 5588 123456foo 5589 0: foo 5590\= Expect no match 5591 123999foo 5592No match 5593 5594/(?<=\d{3}...)(?<!999)foo/ 5595 123abcfoo 5596 0: foo 5597 123456foo 5598 0: foo 5599\= Expect no match 5600 123999foo 5601No match 5602 5603/<a[\s]+href[\s]*=[\s]* # find <a href= 5604 ([\"\'])? # find single or double quote 5605 (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching 5606 # quote, otherwise match up to next space 5607/isx 5608 <a href=abcd xyz 5609 0: <a href=abcd 5610 1: <unset> 5611 2: <unset> 5612 3: abcd 5613 <a href=\"abcd xyz pqr\" cats 5614 0: <a href="abcd xyz pqr" 5615 1: " 5616 2: abcd xyz pqr 5617 <a href=\'abcd xyz pqr\' cats 5618 0: <a href='abcd xyz pqr' 5619 1: ' 5620 2: abcd xyz pqr 5621 5622/<a\s+href\s*=\s* # find <a href= 5623 (["'])? # find single or double quote 5624 (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching 5625 # quote, otherwise match up to next space 5626/isx 5627 <a href=abcd xyz 5628 0: <a href=abcd 5629 1: <unset> 5630 2: <unset> 5631 3: abcd 5632 <a href=\"abcd xyz pqr\" cats 5633 0: <a href="abcd xyz pqr" 5634 1: " 5635 2: abcd xyz pqr 5636 <a href = \'abcd xyz pqr\' cats 5637 0: <a href = 'abcd xyz pqr' 5638 1: ' 5639 2: abcd xyz pqr 5640 5641/<a\s+href(?>\s*)=(?>\s*) # find <a href= 5642 (["'])? # find single or double quote 5643 (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching 5644 # quote, otherwise match up to next space 5645/isx 5646 <a href=abcd xyz 5647 0: <a href=abcd 5648 1: <unset> 5649 2: <unset> 5650 3: abcd 5651 <a href=\"abcd xyz pqr\" cats 5652 0: <a href="abcd xyz pqr" 5653 1: " 5654 2: abcd xyz pqr 5655 <a href = \'abcd xyz pqr\' cats 5656 0: <a href = 'abcd xyz pqr' 5657 1: ' 5658 2: abcd xyz pqr 5659 5660/((Z)+|A)*/ 5661 ZABCDEFG 5662 0: ZA 5663 1: A 5664 2: Z 5665 5666/(Z()|A)*/ 5667 ZABCDEFG 5668 0: ZA 5669 1: A 5670 2: 5671 5672/(Z(())|A)*/ 5673 ZABCDEFG 5674 0: ZA 5675 1: A 5676 2: 5677 3: 5678 5679/((?>Z)+|A)*/ 5680 ZABCDEFG 5681 0: ZA 5682 1: A 5683 5684/((?>)+|A)*/ 5685 ZABCDEFG 5686 0: 5687 1: 5688 5689/^[\d-a]/ 5690 abcde 5691 0: a 5692 -things 5693 0: - 5694 0digit 5695 0: 0 5696\= Expect no match 5697 bcdef 5698No match 5699 5700/[\s]+/ 5701 > \x09\x0a\x0c\x0d\x0b< 5702 0: \x09\x0a\x0c\x0d\x0b 5703 5704/\s+/ 5705 > \x09\x0a\x0c\x0d\x0b< 5706 0: \x09\x0a\x0c\x0d\x0b 5707 5708/ab/x 5709 ab 5710 0: ab 5711 5712/(?!\A)x/m 5713 a\nxb\n 5714 0: x 5715 5716/(?!^)x/m 5717\= Expect no match 5718 a\nxb\n 5719No match 5720 5721#/abc\Qabc\Eabc/ 5722# abcabcabc 5723# 0: abcabcabc 5724 5725#/abc\Q(*+|\Eabc/ 5726# abc(*+|abc 5727# 0: abc(*+|abc 5728 5729#/ abc\Q abc\Eabc/x 5730# abc abcabc 5731# 0: abc abcabc 5732#\= Expect no match 5733# abcabcabc 5734#No match 5735 5736#/abc#comment 5737# \Q#not comment 5738# literal\E/x 5739# abc#not comment\n literal 5740# 0: abc#not comment\x0a literal 5741 5742#/abc#comment 5743# \Q#not comment 5744# literal/x 5745# abc#not comment\n literal 5746# 0: abc#not comment\x0a literal 5747 5748#/abc#comment 5749# \Q#not comment 5750# literal\E #more comment 5751# /x 5752# abc#not comment\n literal 5753# 0: abc#not comment\x0a literal 5754 5755#/abc#comment 5756# \Q#not comment 5757# literal\E #more comment/x 5758# abc#not comment\n literal 5759# 0: abc#not comment\x0a literal 5760 5761#/\Qabc\$xyz\E/ 5762# abc\\\$xyz 5763# 0: abc\$xyz 5764 5765#/\Qabc\E\$\Qxyz\E/ 5766# abc\$xyz 5767# 0: abc$xyz 5768 5769/\Gabc/ 5770 abc 5771 0: abc 5772\= Expect no match 5773 xyzabc 5774No match 5775 5776/a(?x: b c )d/ 5777 XabcdY 5778 0: abcd 5779\= Expect no match 5780 Xa b c d Y 5781No match 5782 5783/((?x)x y z | a b c)/ 5784 XabcY 5785 0: abc 5786 1: abc 5787 AxyzB 5788 0: xyz 5789 1: xyz 5790 5791/(?i)AB(?-i)C/ 5792 XabCY 5793 0: abC 5794\= Expect no match 5795 XabcY 5796No match 5797 5798/((?i)AB(?-i)C|D)E/ 5799 abCE 5800 0: abCE 5801 1: abC 5802 DE 5803 0: DE 5804 1: D 5805\= Expect no match 5806 abcE 5807No match 5808 abCe 5809No match 5810 dE 5811No match 5812 De 5813No match 5814 5815/(.*)\d+\1/ 5816 abc123abc 5817 0: abc123abc 5818 1: abc 5819 abc123bc 5820 0: bc123bc 5821 1: bc 5822 5823/(.*)\d+\1/s 5824 abc123abc 5825 0: abc123abc 5826 1: abc 5827 abc123bc 5828 0: bc123bc 5829 1: bc 5830 5831/((.*))\d+\1/ 5832 abc123abc 5833 0: abc123abc 5834 1: abc 5835 2: abc 5836 abc123bc 5837 0: bc123bc 5838 1: bc 5839 2: bc 5840 5841# This tests for an IPv6 address in the form where it can have up to 5842# eight components, one and only one of which is empty. This must be 5843# an internal component. 5844 5845/^(?!:) # colon disallowed at start 5846 (?: # start of item 5847 (?: [0-9a-f]{1,4} | # 1-4 hex digits or 5848 (?(1)0 | () ) ) # if null previously matched, fail; else null 5849 : # followed by colon 5850 ){1,7} # end item; 1-7 of them required 5851 [0-9a-f]{1,4} $ # final hex number at end of string 5852 (?(1)|.) # check that there was an empty component 5853 /ix 5854 a123::a123 5855 0: a123::a123 5856 1: 5857 a123:b342::abcd 5858 0: a123:b342::abcd 5859 1: 5860 a123:b342::324e:abcd 5861 0: a123:b342::324e:abcd 5862 1: 5863 a123:ddde:b342::324e:abcd 5864 0: a123:ddde:b342::324e:abcd 5865 1: 5866 a123:ddde:b342::324e:dcba:abcd 5867 0: a123:ddde:b342::324e:dcba:abcd 5868 1: 5869 a123:ddde:9999:b342::324e:dcba:abcd 5870 0: a123:ddde:9999:b342::324e:dcba:abcd 5871 1: 5872\= Expect no match 5873 1:2:3:4:5:6:7:8 5874No match 5875 a123:bce:ddde:9999:b342::324e:dcba:abcd 5876No match 5877 a123::9999:b342::324e:dcba:abcd 5878No match 5879 abcde:2:3:4:5:6:7:8 5880No match 5881 ::1 5882No match 5883 abcd:fee0:123:: 5884No match 5885 :1 5886No match 5887 1: 5888No match 5889 5890#/[z\Qa-d]\E]/ 5891# z 5892# 0: z 5893# a 5894# 0: a 5895# - 5896# 0: - 5897# d 5898# 0: d 5899# ] 5900# 0: ] 5901#\= Expect no match 5902# b 5903#No match 5904 5905#TODO: PCRE has an optimization to make this workable, .NET does not 5906#/(a+)*b/ 5907#\= Expect no match 5908# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 5909#No match 5910 5911# All these had to be updated because we understand unicode 5912# and this looks like it's expecting single byte matches 5913 5914# .NET generates \xe4...not sure what's up, might just be different code pages 5915/(?i)reg(?:ul(?:[aä]|ae)r|ex)/ 5916 REGular 5917 0: REGular 5918 regulaer 5919 0: regulaer 5920 Regex 5921 0: Regex 5922 regulär 5923 0: regul\xc3\xa4r 5924 5925#/Åæåä[à-ÿÀ-ß]+/ 5926# Åæåäà 5927# 0: \xc5\xe6\xe5\xe4\xe0 5928# Åæåäÿ 5929# 0: \xc5\xe6\xe5\xe4\xff 5930# ÅæåäÀ 5931# 0: \xc5\xe6\xe5\xe4\xc0 5932# Åæåäß 5933# 0: \xc5\xe6\xe5\xe4\xdf 5934 5935/(?<=Z)X./ 5936 \x84XAZXB 5937 0: XB 5938 5939/ab cd (?x) de fg/ 5940 ab cd defg 5941 0: ab cd defg 5942 5943/ab cd(?x) de fg/ 5944 ab cddefg 5945 0: ab cddefg 5946\= Expect no match 5947 abcddefg 5948No match 5949 5950/(?<![^f]oo)(bar)/ 5951 foobarX 5952 0: bar 5953 1: bar 5954\= Expect no match 5955 boobarX 5956No match 5957 5958/(?<![^f])X/ 5959 offX 5960 0: X 5961\= Expect no match 5962 onyX 5963No match 5964 5965/(?<=[^f])X/ 5966 onyX 5967 0: X 5968\= Expect no match 5969 offX 5970No match 5971 5972/(?:(?(1)a|b)(X))+/ 5973 bXaX 5974 0: bXaX 5975 1: X 5976 5977/(?:(?(1)\1a|b)(X|Y))+/ 5978 bXXaYYaY 5979 0: bXXaYYaY 5980 1: Y 5981 bXYaXXaX 5982 0: bX 5983 1: X 5984 5985# TODO: I think this is a difference caused by the 5986# collision of group numbers, but not sure 5987#/()()()()()()()()()(?:(?(10)\10a|b)(X|Y))+/ 5988# bXXaYYaY 5989# 0: bX 5990# 1: 5991# 2: 5992# 3: 5993# 4: 5994# 5: 5995# 6: 5996# 7: 5997# 8: 5998# 9: 5999#10: X 6000 6001/[[,abc,]+]/ 6002 abc] 6003 0: abc] 6004 a,b] 6005 0: a,b] 6006 [a,b,c] 6007 0: [a,b,c] 6008 6009/(?-x: )/x 6010 A\x20B 6011 0: 6012 6013"(?x)(?-x: \s*#\s*)" 6014 A # B 6015 0: # 6016\= Expect no match 6017 # 6018No match 6019 6020"(?x-is)(?:(?-ixs) \s*#\s*) include" 6021 A #include 6022 0: #include 6023\= Expect no match 6024 A#include 6025No match 6026 A #Include 6027No match 6028 6029/a*b*\w/ 6030 aaabbbb 6031 0: aaabbbb 6032 aaaa 6033 0: aaaa 6034 a 6035 0: a 6036 6037/a*b?\w/ 6038 aaabbbb 6039 0: aaabb 6040 aaaa 6041 0: aaaa 6042 a 6043 0: a 6044 6045/a*b{0,4}\w/ 6046 aaabbbb 6047 0: aaabbbb 6048 aaaa 6049 0: aaaa 6050 a 6051 0: a 6052 6053/a*b{0,}\w/ 6054 aaabbbb 6055 0: aaabbbb 6056 aaaa 6057 0: aaaa 6058 a 6059 0: a 6060 6061/a*\d*\w/ 6062 0a 6063 0: 0a 6064 a 6065 0: a 6066 6067/a*b *\w/x 6068 a 6069 0: a 6070 6071/a*b#comment 6072 *\w/x 6073 a 6074 0: a 6075 6076/a* b *\w/x 6077 a 6078 0: a 6079 6080/^\w+=.*(\\\n.*)*/ 6081 abc=xyz\\\npqr 6082 0: abc=xyz\ 6083 6084/(?=(\w+))\1:/ 6085 abcd: 6086 0: abcd: 6087 1: abcd 6088 6089/^(?=(\w+))\1:/ 6090 abcd: 6091 0: abcd: 6092 1: abcd 6093 6094#/^\Eabc/ 6095# abc 6096# 0: abc 6097 6098#/^[\Eabc]/ 6099# a 6100# 0: a 6101#\= Expect no match 6102# E 6103#No match 6104 6105#/^[a-\Ec]/ 6106# b 6107# 0: b 6108#\= Expect no match 6109# - 6110#No match 6111# E 6112#No match 6113 6114#/^[a\E\E-\Ec]/ 6115# b 6116# 0: b 6117#\= Expect no match 6118# - 6119#No match 6120# E 6121#No match 6122 6123#/^[\E\Qa\E-\Qz\E]+/ 6124# b 6125# 0: b 6126#\= Expect no match 6127# - 6128#No match 6129 6130#/^[a\Q]bc\E]/ 6131# a 6132# 0: a 6133# ] 6134# 0: ] 6135# c 6136# 0: c 6137 6138#/^[a-\Q\E]/ 6139# a 6140# 0: a 6141# - 6142# 0: - 6143 6144/^(a()*)*/ 6145 aaaa 6146 0: aaaa 6147 1: a 6148 2: 6149 6150/^(?:a(?:(?:))*)*/ 6151 aaaa 6152 0: aaaa 6153 6154/^(a()+)+/ 6155 aaaa 6156 0: aaaa 6157 1: a 6158 2: 6159 6160/^(?:a(?:(?:))+)+/ 6161 aaaa 6162 0: aaaa 6163 6164/(a){0,3}(?(1)b|(c|))*D/ 6165 abbD 6166 0: abbD 6167 1: a 6168 ccccD 6169 0: ccccD 6170 1: <unset> 6171 2: 6172 D 6173 0: D 6174 1: <unset> 6175 2: 6176 6177# this is really long with debug -- removing for now 6178#/(a|)*\d/ 6179# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6180# 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6181# 1: 6182#\= Expect no match 6183# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 6184#No match 6185 6186/(?>a|)*\d/ 6187 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6188 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6189\= Expect no match 6190 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 6191No match 6192 6193/(?:a|)*\d/ 6194 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6195 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6196\= Expect no match 6197 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 6198No match 6199 6200/^(?s)(?>.*)(?<!\n)/ 6201 abc 6202 0: abc 6203\= Expect no match 6204 abc\n 6205No match 6206 6207/^(?![^\n]*\n\z)/ 6208 abc 6209 0: 6210\= Expect no match 6211 abc\n 6212No match 6213 6214/\z(?<!\n)/ 6215 abc 6216 0: 6217\= Expect no match 6218 abc\n 6219No match 6220 6221/(.*(.)?)*/ 6222 abcd 6223 0: abcd 6224 1: 6225 6226/( (A | (?(1)0|) )* )/x 6227 abcd 6228 0: 6229 1: 6230 2: 6231 6232/( ( (?(1)0|) )* )/x 6233 abcd 6234 0: 6235 1: 6236 2: 6237 6238/( (?(1)0|)* )/x 6239 abcd 6240 0: 6241 1: 6242 6243/[[:abcd:xyz]]/ 6244 a] 6245 0: a] 6246 :] 6247 0: :] 6248 6249/[abc[:x\]pqr]/ 6250 a 6251 0: a 6252 [ 6253 0: [ 6254 : 6255 0: : 6256 ] 6257 0: ] 6258 p 6259 0: p 6260 6261/.*[op][xyz]/ 6262\= Expect no match 6263 fooabcfoo 6264No match 6265 6266/(?(?=.*b)b|^)/ 6267 adc 6268 0: 6269 abc 6270 0: b 6271 6272/(?(?=^.*b)b|^)/ 6273 adc 6274 0: 6275\= Expect no match 6276 abc 6277No match 6278 6279/(?(?=.*b)b|^)*/ 6280 adc 6281 0: 6282 abc 6283 0: 6284 6285/(?(?=.*b)b|^)+/ 6286 adc 6287 0: 6288 abc 6289 0: b 6290 6291/(?(?=b).*b|^d)/ 6292 abc 6293 0: b 6294 6295/(?(?=.*b).*b|^d)/ 6296 abc 6297 0: ab 6298 6299/^%((?(?=[a])[^%])|b)*%$/ 6300 %ab% 6301 0: %ab% 6302 1: 6303 6304/(?i)a(?-i)b|c/ 6305 XabX 6306 0: ab 6307 XAbX 6308 0: Ab 6309 CcC 6310 0: c 6311\= Expect no match 6312 XABX 6313No match 6314 6315/[\x00-\xff\s]+/ 6316 \x0a\x0b\x0c\x0d 6317 0: \x0a\x0b\x0c\x0d 6318 6319/(abc)\1/i 6320\= Expect no match 6321 abc 6322No match 6323 6324/(abc)\1/ 6325\= Expect no match 6326 abc 6327No match 6328 6329/[^a]*/i 6330 12abc 6331 0: 12 6332 12ABC 6333 0: 12 6334 6335#Posses 6336/[^a]*/i 6337 12abc 6338 0: 12 6339 12ABC 6340 0: 12 6341 6342/[^a]*?X/i 6343\= Expect no match 6344 12abc 6345No match 6346 12ABC 6347No match 6348 6349/[^a]+?X/i 6350\= Expect no match 6351 12abc 6352No match 6353 12ABC 6354No match 6355 6356/[^a]?X/i 6357 12aXbcX 6358 0: X 6359 12AXBCX 6360 0: X 6361 BCX 6362 0: CX 6363 6364/[^a]??X/i 6365 12aXbcX 6366 0: X 6367 12AXBCX 6368 0: X 6369 BCX 6370 0: CX 6371 6372/[^a]{2,3}/i 6373 abcdef 6374 0: bcd 6375 ABCDEF 6376 0: BCD 6377 6378/[^a]{2,3}?/i 6379 abcdef 6380 0: bc 6381 ABCDEF 6382 0: BC 6383 6384/((a|)+)+Z/ 6385 Z 6386 0: Z 6387 1: 6388 2: 6389 6390/(a)b|(a)c/ 6391 ac 6392 0: ac 6393 1: <unset> 6394 2: a 6395 6396/(?>(a))b|(a)c/ 6397 ac 6398 0: ac 6399 1: <unset> 6400 2: a 6401 6402/(?=(a))ab|(a)c/ 6403 ac 6404 0: ac 6405 1: <unset> 6406 2: a 6407 6408/((?>(a))b|(a)c)/ 6409 ac 6410 0: ac 6411 1: ac 6412 2: <unset> 6413 3: a 6414 6415/(?=(?>(a))b|(a)c)(..)/ 6416 ac 6417 0: ac 6418 1: <unset> 6419 2: a 6420 3: ac 6421 6422/(?>(?>(a))b|(a)c)/ 6423 ac 6424 0: ac 6425 1: <unset> 6426 2: a 6427 6428/((?>(a+)b)+(aabab))/ 6429 aaaabaaabaabab 6430 0: aaaabaaabaabab 6431 1: aaaabaaabaabab 6432 2: aaa 6433 3: aabab 6434 6435/(?>a+|ab)+?c/ 6436\= Expect no match 6437 aabc 6438No match 6439 6440/(?>a+|ab)+c/ 6441\= Expect no match 6442 aabc 6443No match 6444 6445/(?:a+|ab)+c/ 6446 aabc 6447 0: aabc 6448 6449/^(?:a|ab)+c/ 6450 aaaabc 6451 0: aaaabc 6452 6453/(?=abc){0}xyz/ 6454 xyz 6455 0: xyz 6456 6457/(?=abc){1}xyz/ 6458\= Expect no match 6459 xyz 6460No match 6461 6462/(?=(a))?./ 6463 ab 6464 0: a 6465 1: a 6466 bc 6467 0: b 6468 6469/(?=(a))??./ 6470 ab 6471 0: a 6472 bc 6473 0: b 6474 6475/^(?!a){0}\w+/ 6476 aaaaa 6477 0: aaaaa 6478 6479/(?<=(abc))?xyz/ 6480 abcxyz 6481 0: xyz 6482 1: abc 6483 pqrxyz 6484 0: xyz 6485 6486/^[g<a>]+/ 6487 ggg<<<aaa>>> 6488 0: ggg<<<aaa>>> 6489\= Expect no match 6490 \\ga 6491No match 6492 6493/^[ga]+/ 6494 gggagagaxyz 6495 0: gggagaga 6496 6497/[:a]xxx[b:]/ 6498 :xxx: 6499 0: :xxx: 6500 6501/(?<=a{2})b/i 6502 xaabc 6503 0: b 6504\= Expect no match 6505 xabc 6506No match 6507 6508/(?<!a{2})b/i 6509 xabc 6510 0: b 6511\= Expect no match 6512 xaabc 6513No match 6514 6515/(?<=[^a]{2})b/ 6516 axxbc 6517 0: b 6518 aAAbc 6519 0: b 6520\= Expect no match 6521 xaabc 6522No match 6523 6524/(?<=[^a]{2})b/i 6525 axxbc 6526 0: b 6527\= Expect no match 6528 aAAbc 6529No match 6530 xaabc 6531No match 6532 6533#/(?|(abc)|(xyz))\1/ 6534# abcabc 6535# 0: abcabc 6536# 1: abc 6537# xyzxyz 6538# 0: xyzxyz 6539# 1: xyz 6540#\= Expect no match 6541# abcxyz 6542#No match 6543# xyzabc 6544#No match 6545 6546#/(?|(abc)|(xyz))(?1)/ 6547# abcabc 6548# 0: abcabc 6549# 1: abc 6550# xyzabc 6551# 0: xyzabc 6552# 1: xyz 6553#\= Expect no match 6554# xyzxyz 6555#No match 6556 6557#/^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/ 6558# XYabcdY 6559# 0: XYabcdY 6560# 1: a 6561# 2: b 6562# 3: c 6563# 4: d 6564# 5: Y 6565 6566#/^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/ 6567# XYabcdY 6568# 0: XYabcdY 6569# 1: a 6570# 2: b 6571# 3: <unset> 6572# 4: <unset> 6573# 5: c 6574# 6: d 6575# 7: Y 6576 6577#/^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/ 6578# XYabcdY 6579# 0: XYabcdY 6580# 1: a 6581# 2: b 6582# 3: <unset> 6583# 4: <unset> 6584# 5: c 6585# 6: d 6586# 7: Y 6587 6588/(?'abc'\w+):\k<abc>{2}/ 6589 a:aaxyz 6590 0: a:aa 6591 1: a 6592 ab:ababxyz 6593 0: ab:abab 6594 1: ab 6595\= Expect no match 6596 a:axyz 6597No match 6598 ab:abxyz 6599No match 6600 6601/^(?<ab>a)? (?(ab)b|c) (?(ab)d|e)/x 6602 abd 6603 0: abd 6604 1: a 6605 ce 6606 0: ce 6607 6608# .NET has more consistent grouping numbers with these dupe groups for the two options 6609/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?(quote)[a-z]+|[0-9]+)/x,dupnames 6610 a\"aaaaa 6611 0: a"aaaaa 6612 1: " 6613 2: <unset> 6614 3: " 6615 b\"aaaaa 6616 0: b"aaaaa 6617 1: " 6618 2: <unset> 6619 3: " 6620\= Expect no match 6621 b\"11111 6622No match 6623 6624#/(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/ 6625# 0 6626# 0: 0 6627# 1: 0 6628# 00 6629# 0: 00 6630# 1: 00 6631# 2: 0 6632# 0000 6633# 0: 0000 6634# 1: 0000 6635# 2: 0 6636 6637#/(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/ 6638# 0 6639# 0: 0 6640# 1: 0 6641# 2: 0 6642# 00 6643# 0: 0 6644# 1: 0 6645# 2: 0 6646# 0000 6647# 0: 0 6648# 1: 0 6649# 2: 0 6650 6651# Check the use of names for failure 6652 6653# Check opening parens in comment when seeking forward reference. 6654 6655#/(?P<abn>(?P=abn)xxx|)+/ 6656# xxx 6657# 0: 6658# 1: 6659 6660#Posses 6661/^(a)?(\w)/ 6662 aaaaX 6663 0: aa 6664 1: a 6665 2: a 6666 YZ 6667 0: Y 6668 1: <unset> 6669 2: Y 6670 6671#Posses 6672/^(?:a)?(\w)/ 6673 aaaaX 6674 0: aa 6675 1: a 6676 YZ 6677 0: Y 6678 1: Y 6679 6680/\A.*?(a|bc)/ 6681 ba 6682 0: ba 6683 1: a 6684 6685/\A.*?(?:a|bc|d)/ 6686 ba 6687 0: ba 6688 6689# -------------------------- 6690 6691/(another)?(\1?)test/ 6692 hello world test 6693 0: test 6694 1: <unset> 6695 2: 6696 6697/(another)?(\1+)test/ 6698\= Expect no match 6699 hello world test 6700No match 6701 6702/((?:a?)*)*c/ 6703 aac 6704 0: aac 6705 1: 6706 6707/((?>a?)*)*c/ 6708 aac 6709 0: aac 6710 1: 6711 6712/(?>.*?a)(?<=ba)/ 6713 aba 6714 0: ba 6715 6716/(?:.*?a)(?<=ba)/ 6717 aba 6718 0: aba 6719 6720/(?>.*?a)b/s 6721 aab 6722 0: ab 6723 6724/(?>.*?a)b/ 6725 aab 6726 0: ab 6727 6728/(?>^a)b/s 6729\= Expect no match 6730 aab 6731No match 6732 6733/(?>.*?)(?<=(abcd)|(wxyz))/ 6734 alphabetabcd 6735 0: 6736 1: abcd 6737 endingwxyz 6738 0: 6739 1: <unset> 6740 2: wxyz 6741 6742/(?>.*)(?<=(abcd)|(wxyz))/ 6743 alphabetabcd 6744 0: alphabetabcd 6745 1: abcd 6746 endingwxyz 6747 0: endingwxyz 6748 1: <unset> 6749 2: wxyz 6750 6751"(?>.*)foo" 6752\= Expect no match 6753 abcdfooxyz 6754No match 6755 6756"(?>.*?)foo" 6757 abcdfooxyz 6758 0: foo 6759 6760# Tests that try to figure out how Perl works. My hypothesis is that the first 6761# verb that is backtracked onto is the one that acts. This seems to be the case 6762# almost all the time, but there is one exception that is perhaps a bug. 6763 6764/a(?=bc).|abd/ 6765 abd 6766 0: abd 6767 abc 6768 0: ab 6769 6770/a(?>bc)d|abd/ 6771 abceabd 6772 0: abd 6773 6774# These tests were formerly in test 2, but changes in PCRE and Perl have 6775# made them compatible. 6776 6777/^(a)?(?(1)a|b)+$/ 6778\= Expect no match 6779 a 6780No match 6781 6782# ---- 6783 6784/^\d*\w{4}/ 6785 1234 6786 0: 1234 6787\= Expect no match 6788 123 6789No match 6790 6791/^[^b]*\w{4}/ 6792 aaaa 6793 0: aaaa 6794\= Expect no match 6795 aaa 6796No match 6797 6798/^[^b]*\w{4}/i 6799 aaaa 6800 0: aaaa 6801\= Expect no match 6802 aaa 6803No match 6804 6805/^a*\w{4}/ 6806 aaaa 6807 0: aaaa 6808\= Expect no match 6809 aaa 6810No match 6811 6812/^a*\w{4}/i 6813 aaaa 6814 0: aaaa 6815\= Expect no match 6816 aaa 6817No match 6818 6819/(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames 6820 foofoo 6821 0: foofoo 6822 1: foo 6823 barbar 6824 0: barbar 6825 1: bar 6826 6827# A notable difference between PCRE and .NET. According to 6828# the PCRE docs: 6829# If you make a subroutine call to a non-unique named 6830# subpattern, the one that corresponds to the first 6831# occurrence of the name is used. In the absence of 6832# duplicate numbers (see the previous section) this is 6833# the one with the lowest number. 6834# .NET takes the most recently captured number according to MSDN: 6835# A backreference refers to the most recent definition of 6836# a group (the definition most immediately to the left, 6837# when matching left to right). When a group makes multiple 6838# captures, a backreference refers to the most recent capture. 6839 6840#/(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames 6841# AfooA 6842# 0: AfooA 6843# 1: A 6844# 2: foo 6845# AbarA 6846# 0: AbarA 6847# 1: A 6848# 2: <unset> 6849# 3: bar 6850#\= Expect no match 6851# Afoofoo 6852#No match 6853# Abarbar 6854#No match 6855 6856/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ 6857 1 IN SOA non-sp1 non-sp2( 6858 0: 1 IN SOA non-sp1 non-sp2( 6859 1: 1 6860 2: non-sp1 6861 3: non-sp2 6862 6863# TODO: .NET's group number ordering here in the second example is a bit odd 6864/^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?(A)x) (?(B)y)$/x,dupnames 6865 Ax 6866 0: Ax 6867 1: A 6868 BAxy 6869 0: BAxy 6870 1: A 6871 2: B 6872 6873/ ^ a + b $ /x 6874 aaaab 6875 0: aaaab 6876 6877/ ^ a + #comment 6878 b $ /x 6879 aaaab 6880 0: aaaab 6881 6882/ ^ a + #comment 6883 #comment 6884 b $ /x 6885 aaaab 6886 0: aaaab 6887 6888/ ^ (?> a + ) b $ /x 6889 aaaab 6890 0: aaaab 6891 6892/ ^ ( a + ) + \w $ /x 6893 aaaab 6894 0: aaaab 6895 1: aaaa 6896 6897/(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/ 6898\= Expect no match 6899 acb 6900No match 6901 6902#Posses 6903#/\A(?:[^\"]+|\"(?:[^\"]*|\"\")*\")+/ 6904# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 6905# 0: NON QUOTED "QUOT""ED" AFTER 6906 6907#Posses 6908#/\A(?:[^\"]+|\"(?:[^\"]+|\"\")*\")+/ 6909# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 6910# 0: NON QUOTED "QUOT""ED" AFTER 6911 6912#Posses 6913#/\A(?:[^\"]+|\"(?:[^\"]+|\"\")+\")+/ 6914# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 6915# 0: NON QUOTED "QUOT""ED" AFTER 6916 6917#Posses 6918#/\A([^\"1]+|[\"2]([^\"3]*|[\"4][\"5])*[\"6])+/ 6919# NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 6920# 0: NON QUOTED "QUOT""ED" AFTER 6921# 1: AFTER 6922# 2: 6923 6924/^\w+(?>\s*)(?<=\w)/ 6925 test test 6926 0: tes 6927 6928#/(?P<Name>a)?(?P<Name2>b)?(?(<Name>)c|d)*l/ 6929# acl 6930# 0: acl 6931# 1: a 6932# bdl 6933# 0: bdl 6934# 1: <unset> 6935# 2: b 6936# adl 6937# 0: dl 6938# bcl 6939# 0: l 6940 6941/\sabc/ 6942 \x0babc 6943 0: \x0babc 6944 6945#/[\Qa]\E]+/ 6946# aa]] 6947# 0: aa]] 6948 6949#/[\Q]a\E]+/ 6950# aa]] 6951# 0: aa]] 6952 6953/A((((((((a))))))))\8B/ 6954 AaaB 6955 0: AaaB 6956 1: a 6957 2: a 6958 3: a 6959 4: a 6960 5: a 6961 6: a 6962 7: a 6963 8: a 6964 6965/A(((((((((a)))))))))\9B/ 6966 AaaB 6967 0: AaaB 6968 1: a 6969 2: a 6970 3: a 6971 4: a 6972 5: a 6973 6: a 6974 7: a 6975 8: a 6976 9: a 6977 6978/(|ab)*?d/ 6979 abd 6980 0: abd 6981 1: ab 6982 xyd 6983 0: d 6984 6985/(\2|a)(\1)/ 6986 aaa 6987 0: aa 6988 1: a 6989 2: a 6990 6991/(\2)(\1)/ 6992 6993"Z*(|d*){216}" 6994 6995/((((((((((((x))))))))))))\12/ 6996 xx 6997 0: xx 6998 1: x 6999 2: x 7000 3: x 7001 4: x 7002 5: x 7003 6: x 7004 7: x 7005 8: x 7006 9: x 700710: x 700811: x 700912: x 7010 7011#"(?|(\k'Pm')|(?'Pm'))" 7012# abcd 7013# 0: 7014# 1: 7015 7016#/(?|(aaa)|(b))\g{1}/ 7017# aaaaaa 7018# 0: aaaaaa 7019# 1: aaa 7020# bb 7021# 0: bb 7022# 1: b 7023 7024#/(?|(aaa)|(b))(?1)/ 7025# aaaaaa 7026# 0: aaaaaa 7027# 1: aaa 7028# baaa 7029# 0: baaa 7030# 1: b 7031#\= Expect no match 7032# bb 7033#No match 7034 7035#/(?|(aaa)|(b))/ 7036# xaaa 7037# 0: aaa 7038# 1: aaa 7039# xbc 7040# 0: b 7041# 1: b 7042 7043#/(?|(?'a'aaa)|(?'a'b))\k'a'/ 7044# aaaaaa 7045# 0: aaaaaa 7046# 1: aaa 7047# bb 7048# 0: bb 7049# 1: b 7050 7051#/(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/dupnames 7052# aaaccccaaa 7053# 0: aaaccccaaa 7054# 1: aaa 7055# 2: cccc 7056# bccccb 7057# 0: bccccb 7058# 1: b 7059# 2: cccc 7060 7061# End of testinput1 7062