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.sh script. 4 5# WARNING: Use only / as the pattern delimiter. Although pcre2test supports 6# a number of delimiters, all those other than / give problems with the 7# perltest.sh script. 8 9#forbid_utf 10#newline_default lf any anycrlf 11#perltest 12 13/the quick brown fox/ 14 the quick brown fox 15 0: the quick brown fox 16 What do you know about the quick brown fox? 17 0: the quick brown fox 18\= Expect no match 19 The quick brown FOX 20No match 21 What do you know about THE QUICK BROWN FOX? 22No match 23 24/The quick brown fox/i 25 the quick brown fox 26 0: the quick brown fox 27 The quick brown FOX 28 0: The quick brown FOX 29 What do you know about the quick brown fox? 30 0: the quick brown fox 31 What do you know about THE QUICK BROWN FOX? 32 0: THE QUICK BROWN FOX 33 34/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/ 35 abcd\t\n\r\f\a\e9;\$\\?caxyz 36 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz 37 38/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/ 39 abxyzpqrrrabbxyyyypqAzz 40 0: abxyzpqrrrabbxyyyypqAzz 41 abxyzpqrrrabbxyyyypqAzz 42 0: abxyzpqrrrabbxyyyypqAzz 43 aabxyzpqrrrabbxyyyypqAzz 44 0: aabxyzpqrrrabbxyyyypqAzz 45 aaabxyzpqrrrabbxyyyypqAzz 46 0: aaabxyzpqrrrabbxyyyypqAzz 47 aaaabxyzpqrrrabbxyyyypqAzz 48 0: aaaabxyzpqrrrabbxyyyypqAzz 49 abcxyzpqrrrabbxyyyypqAzz 50 0: abcxyzpqrrrabbxyyyypqAzz 51 aabcxyzpqrrrabbxyyyypqAzz 52 0: aabcxyzpqrrrabbxyyyypqAzz 53 aaabcxyzpqrrrabbxyyyypAzz 54 0: aaabcxyzpqrrrabbxyyyypAzz 55 aaabcxyzpqrrrabbxyyyypqAzz 56 0: aaabcxyzpqrrrabbxyyyypqAzz 57 aaabcxyzpqrrrabbxyyyypqqAzz 58 0: aaabcxyzpqrrrabbxyyyypqqAzz 59 aaabcxyzpqrrrabbxyyyypqqqAzz 60 0: aaabcxyzpqrrrabbxyyyypqqqAzz 61 aaabcxyzpqrrrabbxyyyypqqqqAzz 62 0: aaabcxyzpqrrrabbxyyyypqqqqAzz 63 aaabcxyzpqrrrabbxyyyypqqqqqAzz 64 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz 65 aaabcxyzpqrrrabbxyyyypqqqqqqAzz 66 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz 67 aaaabcxyzpqrrrabbxyyyypqAzz 68 0: aaaabcxyzpqrrrabbxyyyypqAzz 69 abxyzzpqrrrabbxyyyypqAzz 70 0: abxyzzpqrrrabbxyyyypqAzz 71 aabxyzzzpqrrrabbxyyyypqAzz 72 0: aabxyzzzpqrrrabbxyyyypqAzz 73 aaabxyzzzzpqrrrabbxyyyypqAzz 74 0: aaabxyzzzzpqrrrabbxyyyypqAzz 75 aaaabxyzzzzpqrrrabbxyyyypqAzz 76 0: aaaabxyzzzzpqrrrabbxyyyypqAzz 77 abcxyzzpqrrrabbxyyyypqAzz 78 0: abcxyzzpqrrrabbxyyyypqAzz 79 aabcxyzzzpqrrrabbxyyyypqAzz 80 0: aabcxyzzzpqrrrabbxyyyypqAzz 81 aaabcxyzzzzpqrrrabbxyyyypqAzz 82 0: aaabcxyzzzzpqrrrabbxyyyypqAzz 83 aaaabcxyzzzzpqrrrabbxyyyypqAzz 84 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz 85 aaaabcxyzzzzpqrrrabbbxyyyypqAzz 86 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz 87 aaaabcxyzzzzpqrrrabbbxyyyyypqAzz 88 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz 89 aaabcxyzpqrrrabbxyyyypABzz 90 0: aaabcxyzpqrrrabbxyyyypABzz 91 aaabcxyzpqrrrabbxyyyypABBzz 92 0: aaabcxyzpqrrrabbxyyyypABBzz 93 >>>aaabxyzpqrrrabbxyyyypqAzz 94 0: aaabxyzpqrrrabbxyyyypqAzz 95 >aaaabxyzpqrrrabbxyyyypqAzz 96 0: aaaabxyzpqrrrabbxyyyypqAzz 97 >>>>abcxyzpqrrrabbxyyyypqAzz 98 0: abcxyzpqrrrabbxyyyypqAzz 99\= Expect no match 100 abxyzpqrrabbxyyyypqAzz 101No match 102 abxyzpqrrrrabbxyyyypqAzz 103No match 104 abxyzpqrrrabxyyyypqAzz 105No match 106 aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz 107No match 108 aaaabcxyzzzzpqrrrabbbxyyypqAzz 109No match 110 aaabcxyzpqrrrabbxyyyypqqqqqqqAzz 111No match 112 113/^(abc){1,2}zz/ 114 abczz 115 0: abczz 116 1: abc 117 abcabczz 118 0: abcabczz 119 1: abc 120\= Expect no match 121 zz 122No match 123 abcabcabczz 124No match 125 >>abczz 126No match 127 128/^(b+?|a){1,2}?c/ 129 bc 130 0: bc 131 1: b 132 bbc 133 0: bbc 134 1: b 135 bbbc 136 0: bbbc 137 1: bb 138 bac 139 0: bac 140 1: a 141 bbac 142 0: bbac 143 1: a 144 aac 145 0: aac 146 1: a 147 abbbbbbbbbbbc 148 0: abbbbbbbbbbbc 149 1: bbbbbbbbbbb 150 bbbbbbbbbbbac 151 0: bbbbbbbbbbbac 152 1: a 153\= Expect no match 154 aaac 155No match 156 abbbbbbbbbbbac 157No match 158 159/^(b+|a){1,2}c/ 160 bc 161 0: bc 162 1: b 163 bbc 164 0: bbc 165 1: bb 166 bbbc 167 0: bbbc 168 1: bbb 169 bac 170 0: bac 171 1: a 172 bbac 173 0: bbac 174 1: a 175 aac 176 0: aac 177 1: a 178 abbbbbbbbbbbc 179 0: abbbbbbbbbbbc 180 1: bbbbbbbbbbb 181 bbbbbbbbbbbac 182 0: bbbbbbbbbbbac 183 1: a 184\= Expect no match 185 aaac 186No match 187 abbbbbbbbbbbac 188No match 189 190/^(ba|b*){1,2}?bc/ 191 babc 192 0: babc 193 1: ba 194 bbabc 195 0: bbabc 196 1: ba 197 bababc 198 0: bababc 199 1: ba 200\= Expect no match 201 bababbc 202No match 203 babababc 204No match 205 206/^\ca\cA\c[;\c:/ 207 \x01\x01\e;z 208 0: \x01\x01\x1b;z 209 210/^[ab\]cde]/ 211 athing 212 0: a 213 bthing 214 0: b 215 ]thing 216 0: ] 217 cthing 218 0: c 219 dthing 220 0: d 221 ething 222 0: e 223\= Expect no match 224 fthing 225No match 226 [thing 227No match 228 \\thing 229No match 230 231/^[]cde]/ 232 ]thing 233 0: ] 234 cthing 235 0: c 236 dthing 237 0: d 238 ething 239 0: e 240\= Expect no match 241 athing 242No match 243 fthing 244No match 245 246/^[^ab\]cde]/ 247 fthing 248 0: f 249 [thing 250 0: [ 251 \\thing 252 0: \ 253\= Expect no match 254 athing 255No match 256 bthing 257No match 258 ]thing 259No match 260 cthing 261No match 262 dthing 263No match 264 ething 265No match 266 267/^[^]cde]/ 268 athing 269 0: a 270 fthing 271 0: f 272\= Expect no match 273 ]thing 274No match 275 cthing 276No match 277 dthing 278No match 279 ething 280No match 281 282/^\�/ 283 � 284 0: \x81 285 286/^�/ 287 � 288 0: \xff 289 290/^[0-9]+$/ 291 0 292 0: 0 293 1 294 0: 1 295 2 296 0: 2 297 3 298 0: 3 299 4 300 0: 4 301 5 302 0: 5 303 6 304 0: 6 305 7 306 0: 7 307 8 308 0: 8 309 9 310 0: 9 311 10 312 0: 10 313 100 314 0: 100 315\= Expect no match 316 abc 317No match 318 319/^.*nter/ 320 enter 321 0: enter 322 inter 323 0: inter 324 uponter 325 0: uponter 326 327/^xxx[0-9]+$/ 328 xxx0 329 0: xxx0 330 xxx1234 331 0: xxx1234 332\= Expect no match 333 xxx 334No match 335 336/^.+[0-9][0-9][0-9]$/ 337 x123 338 0: x123 339 x1234 340 0: x1234 341 xx123 342 0: xx123 343 123456 344 0: 123456 345\= Expect no match 346 123 347No match 348 349/^.+?[0-9][0-9][0-9]$/ 350 x123 351 0: x123 352 x1234 353 0: x1234 354 xx123 355 0: xx123 356 123456 357 0: 123456 358\= Expect no match 359 123 360No match 361 362/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/ 363 abc!pqr=apquxz.ixr.zzz.ac.uk 364 0: abc!pqr=apquxz.ixr.zzz.ac.uk 365 1: abc 366 2: pqr 367\= Expect no match 368 !pqr=apquxz.ixr.zzz.ac.uk 369No match 370 abc!=apquxz.ixr.zzz.ac.uk 371No match 372 abc!pqr=apquxz:ixr.zzz.ac.uk 373No match 374 abc!pqr=apquxz.ixr.zzz.ac.ukk 375No match 376 377/:/ 378 Well, we need a colon: somewhere 379 0: : 380\= Expect no match 381 Fail without a colon 382No match 383 384/([\da-f:]+)$/i 385 0abc 386 0: 0abc 387 1: 0abc 388 abc 389 0: abc 390 1: abc 391 fed 392 0: fed 393 1: fed 394 E 395 0: E 396 1: E 397 :: 398 0: :: 399 1: :: 400 5f03:12C0::932e 401 0: 5f03:12C0::932e 402 1: 5f03:12C0::932e 403 fed def 404 0: def 405 1: def 406 Any old stuff 407 0: ff 408 1: ff 409\= Expect no match 410 0zzz 411No match 412 gzzz 413No match 414 fed\x20 415No match 416 Any old rubbish 417No match 418 419/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ 420 .1.2.3 421 0: .1.2.3 422 1: 1 423 2: 2 424 3: 3 425 A.12.123.0 426 0: A.12.123.0 427 1: 12 428 2: 123 429 3: 0 430\= Expect no match 431 .1.2.3333 432No match 433 1.2.3 434No match 435 1234.2.3 436No match 437 438/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ 439 1 IN SOA non-sp1 non-sp2( 440 0: 1 IN SOA non-sp1 non-sp2( 441 1: 1 442 2: non-sp1 443 3: non-sp2 444 1 IN SOA non-sp1 non-sp2 ( 445 0: 1 IN SOA non-sp1 non-sp2 ( 446 1: 1 447 2: non-sp1 448 3: non-sp2 449\= Expect no match 450 1IN SOA non-sp1 non-sp2( 451No match 452 453/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/ 454 a. 455 0: a. 456 Z. 457 0: Z. 458 2. 459 0: 2. 460 ab-c.pq-r. 461 0: ab-c.pq-r. 462 1: .pq-r 463 sxk.zzz.ac.uk. 464 0: sxk.zzz.ac.uk. 465 1: .uk 466 x-.y-. 467 0: x-.y-. 468 1: .y- 469\= Expect no match 470 -abc.peq. 471No match 472 473/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/ 474 *.a 475 0: *.a 476 *.b0-a 477 0: *.b0-a 478 1: 0-a 479 *.c3-b.c 480 0: *.c3-b.c 481 1: 3-b 482 2: .c 483 *.c-a.b-c 484 0: *.c-a.b-c 485 1: -a 486 2: .b-c 487 3: -c 488\= Expect no match 489 *.0 490No match 491 *.a- 492No match 493 *.a-b.c- 494No match 495 *.c-a.0-c 496No match 497 498/^(?=ab(de))(abd)(e)/ 499 abde 500 0: abde 501 1: de 502 2: abd 503 3: e 504 505/^(?!(ab)de|x)(abd)(f)/ 506 abdf 507 0: abdf 508 1: <unset> 509 2: abd 510 3: f 511 512/^(?=(ab(cd)))(ab)/ 513 abcd 514 0: ab 515 1: abcd 516 2: cd 517 3: ab 518 519/^[\da-f](\.[\da-f])*$/i 520 a.b.c.d 521 0: a.b.c.d 522 1: .d 523 A.B.C.D 524 0: A.B.C.D 525 1: .D 526 a.b.c.1.2.3.C 527 0: a.b.c.1.2.3.C 528 1: .C 529 530/^\".*\"\s*(;.*)?$/ 531 \"1234\" 532 0: "1234" 533 \"abcd\" ; 534 0: "abcd" ; 535 1: ; 536 \"\" ; rhubarb 537 0: "" ; rhubarb 538 1: ; rhubarb 539\= Expect no match 540 \"1234\" : things 541No match 542 543/^$/ 544 \ 545 0: 546\= Expect no match 547 A non-empty line 548No match 549 550/ ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x 551 ab c 552 0: ab c 553\= Expect no match 554 abc 555No match 556 ab cde 557No match 558 559/(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/ 560 ab c 561 0: ab c 562\= Expect no match 563 abc 564No match 565 ab cde 566No match 567 568/^ a\ b[c ]d $/x 569 a bcd 570 0: a bcd 571 a b d 572 0: a b d 573\= Expect no match 574 abcd 575No match 576 ab d 577No match 578 579/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/ 580 abcdefhijklm 581 0: abcdefhijklm 582 1: abc 583 2: bc 584 3: c 585 4: def 586 5: ef 587 6: f 588 7: hij 589 8: ij 590 9: j 59110: klm 59211: lm 59312: m 594 595/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/ 596 abcdefhijklm 597 0: abcdefhijklm 598 1: bc 599 2: c 600 3: ef 601 4: f 602 5: ij 603 6: j 604 7: lm 605 8: m 606 607/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/ 608 a+ Z0+\x08\n\x1d\x12 609 0: a+ Z0+\x08\x0a\x1d\x12 610 611/^[.^$|()*+?{,}]+/ 612 .^\$(*+)|{?,?} 613 0: .^$(*+)|{?,?} 614 615/^a*\w/ 616 z 617 0: z 618 az 619 0: az 620 aaaz 621 0: aaaz 622 a 623 0: a 624 aa 625 0: aa 626 aaaa 627 0: aaaa 628 a+ 629 0: a 630 aa+ 631 0: aa 632 633/^a*?\w/ 634 z 635 0: z 636 az 637 0: a 638 aaaz 639 0: a 640 a 641 0: a 642 aa 643 0: a 644 aaaa 645 0: a 646 a+ 647 0: a 648 aa+ 649 0: a 650 651/^a+\w/ 652 az 653 0: az 654 aaaz 655 0: aaaz 656 aa 657 0: aa 658 aaaa 659 0: aaaa 660 aa+ 661 0: aa 662 663/^a+?\w/ 664 az 665 0: az 666 aaaz 667 0: aa 668 aa 669 0: aa 670 aaaa 671 0: aa 672 aa+ 673 0: aa 674 675/^\d{8}\w{2,}/ 676 1234567890 677 0: 1234567890 678 12345678ab 679 0: 12345678ab 680 12345678__ 681 0: 12345678__ 682\= Expect no match 683 1234567 684No match 685 686/^[aeiou\d]{4,5}$/ 687 uoie 688 0: uoie 689 1234 690 0: 1234 691 12345 692 0: 12345 693 aaaaa 694 0: aaaaa 695\= Expect no match 696 123456 697No match 698 699/^[aeiou\d]{4,5}?/ 700 uoie 701 0: uoie 702 1234 703 0: 1234 704 12345 705 0: 1234 706 aaaaa 707 0: aaaa 708 123456 709 0: 1234 710 711/\A(abc|def)=(\1){2,3}\Z/ 712 abc=abcabc 713 0: abc=abcabc 714 1: abc 715 2: abc 716 def=defdefdef 717 0: def=defdefdef 718 1: def 719 2: def 720\= Expect no match 721 abc=defdef 722No match 723 724/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/ 725 abcdefghijkcda2 726 0: abcdefghijkcda2 727 1: a 728 2: b 729 3: c 730 4: d 731 5: e 732 6: f 733 7: g 734 8: h 735 9: i 73610: j 73711: k 73812: cd 739 abcdefghijkkkkcda2 740 0: abcdefghijkkkkcda2 741 1: a 742 2: b 743 3: c 744 4: d 745 5: e 746 6: f 747 7: g 748 8: h 749 9: i 75010: j 75111: k 75212: cd 753 754/(cat(a(ract|tonic)|erpillar)) \1()2(3)/ 755 cataract cataract23 756 0: cataract cataract23 757 1: cataract 758 2: aract 759 3: ract 760 4: 761 5: 3 762 catatonic catatonic23 763 0: catatonic catatonic23 764 1: catatonic 765 2: atonic 766 3: tonic 767 4: 768 5: 3 769 caterpillar caterpillar23 770 0: caterpillar caterpillar23 771 1: caterpillar 772 2: erpillar 773 3: <unset> 774 4: 775 5: 3 776 777 778/^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]/ 779 From abcd Mon Sep 01 12:33:02 1997 780 0: From abcd Mon Sep 01 12:33 781 1: abcd 782 783/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/ 784 From abcd Mon Sep 01 12:33:02 1997 785 0: From abcd Mon Sep 01 12:33 786 1: Sep 787 From abcd Mon Sep 1 12:33:02 1997 788 0: From abcd Mon Sep 1 12:33 789 1: Sep 790\= Expect no match 791 From abcd Sep 01 12:33:02 1997 792No match 793 794/^12.34/s 795 12\n34 796 0: 12\x0a34 797 12\r34 798 0: 12\x0d34 799 800/\w+(?=\t)/ 801 the quick brown\t fox 802 0: brown 803 804/foo(?!bar)(.*)/ 805 foobar is foolish see? 806 0: foolish see? 807 1: lish see? 808 809/(?:(?!foo)...|^.{0,2})bar(.*)/ 810 foobar crowbar etc 811 0: rowbar etc 812 1: etc 813 barrel 814 0: barrel 815 1: rel 816 2barrel 817 0: 2barrel 818 1: rel 819 A barrel 820 0: A barrel 821 1: rel 822 823/^(\D*)(?=\d)(?!123)/ 824 abc456 825 0: abc 826 1: abc 827\= Expect no match 828 abc123 829No match 830 831/^1234(?# test newlines 832 inside)/ 833 1234 834 0: 1234 835 836/^1234 #comment in extended re 837 /x 838 1234 839 0: 1234 840 841/#rhubarb 842 abcd/x 843 abcd 844 0: abcd 845 846/^abcd#rhubarb/x 847 abcd 848 0: abcd 849 850/^(a)\1{2,3}(.)/ 851 aaab 852 0: aaab 853 1: a 854 2: b 855 aaaab 856 0: aaaab 857 1: a 858 2: b 859 aaaaab 860 0: aaaaa 861 1: a 862 2: a 863 aaaaaab 864 0: aaaaa 865 1: a 866 2: a 867 868/(?!^)abc/ 869 the abc 870 0: abc 871\= Expect no match 872 abc 873No match 874 875/(?=^)abc/ 876 abc 877 0: abc 878\= Expect no match 879 the abc 880No match 881 882/^[ab]{1,3}(ab*|b)/ 883 aabbbbb 884 0: aabb 885 1: b 886 887/^[ab]{1,3}?(ab*|b)/ 888 aabbbbb 889 0: aabbbbb 890 1: abbbbb 891 892/^[ab]{1,3}?(ab*?|b)/ 893 aabbbbb 894 0: aa 895 1: a 896 897/^[ab]{1,3}(ab*?|b)/ 898 aabbbbb 899 0: aabb 900 1: b 901 902/ (?: [\040\t] | \( 903(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 904\) )* # optional leading comment 905(?: (?: 906[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 907(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 908| 909" (?: # opening quote... 910[^\\\x80-\xff\n\015"] # Anything except backslash and quote 911| # or 912\\ [^\x80-\xff] # Escaped something (something != CR) 913)* " # closing quote 914) # initial word 915(?: (?: [\040\t] | \( 916(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 917\) )* \. (?: [\040\t] | \( 918(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 919\) )* (?: 920[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 921(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 922| 923" (?: # opening quote... 924[^\\\x80-\xff\n\015"] # Anything except backslash and quote 925| # or 926\\ [^\x80-\xff] # Escaped something (something != CR) 927)* " # closing quote 928) )* # further okay, if led by a period 929(?: [\040\t] | \( 930(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 931\) )* @ (?: [\040\t] | \( 932(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 933\) )* (?: 934[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 935(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 936| \[ # [ 937(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 938\] # ] 939) # initial subdomain 940(?: # 941(?: [\040\t] | \( 942(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 943\) )* \. # if led by a period... 944(?: [\040\t] | \( 945(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 946\) )* (?: 947[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 948(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 949| \[ # [ 950(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 951\] # ] 952) # ...further okay 953)* 954# address 955| # or 956(?: 957[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 958(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 959| 960" (?: # opening quote... 961[^\\\x80-\xff\n\015"] # Anything except backslash and quote 962| # or 963\\ [^\x80-\xff] # Escaped something (something != CR) 964)* " # closing quote 965) # one word, optionally followed by.... 966(?: 967[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or... 968\( 969(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 970\) | # comments, or... 971 972" (?: # opening quote... 973[^\\\x80-\xff\n\015"] # Anything except backslash and quote 974| # or 975\\ [^\x80-\xff] # Escaped something (something != CR) 976)* " # closing quote 977# quoted strings 978)* 979< (?: [\040\t] | \( 980(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 981\) )* # leading < 982(?: @ (?: [\040\t] | \( 983(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 984\) )* (?: 985[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 986(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 987| \[ # [ 988(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 989\] # ] 990) # initial subdomain 991(?: # 992(?: [\040\t] | \( 993(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 994\) )* \. # if led by a period... 995(?: [\040\t] | \( 996(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 997\) )* (?: 998[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 999(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1000| \[ # [ 1001(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1002\] # ] 1003) # ...further okay 1004)* 1005 1006(?: (?: [\040\t] | \( 1007(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1008\) )* , (?: [\040\t] | \( 1009(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1010\) )* @ (?: [\040\t] | \( 1011(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1012\) )* (?: 1013[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1014(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1015| \[ # [ 1016(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1017\] # ] 1018) # initial subdomain 1019(?: # 1020(?: [\040\t] | \( 1021(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1022\) )* \. # if led by a period... 1023(?: [\040\t] | \( 1024(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1025\) )* (?: 1026[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1027(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1028| \[ # [ 1029(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1030\] # ] 1031) # ...further okay 1032)* 1033)* # further okay, if led by comma 1034: # closing colon 1035(?: [\040\t] | \( 1036(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1037\) )* )? # optional route 1038(?: 1039[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1040(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1041| 1042" (?: # opening quote... 1043[^\\\x80-\xff\n\015"] # Anything except backslash and quote 1044| # or 1045\\ [^\x80-\xff] # Escaped something (something != CR) 1046)* " # closing quote 1047) # initial word 1048(?: (?: [\040\t] | \( 1049(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1050\) )* \. (?: [\040\t] | \( 1051(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1052\) )* (?: 1053[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1054(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1055| 1056" (?: # opening quote... 1057[^\\\x80-\xff\n\015"] # Anything except backslash and quote 1058| # or 1059\\ [^\x80-\xff] # Escaped something (something != CR) 1060)* " # closing quote 1061) )* # further okay, if led by a period 1062(?: [\040\t] | \( 1063(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1064\) )* @ (?: [\040\t] | \( 1065(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1066\) )* (?: 1067[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1068(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1069| \[ # [ 1070(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1071\] # ] 1072) # initial subdomain 1073(?: # 1074(?: [\040\t] | \( 1075(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1076\) )* \. # if led by a period... 1077(?: [\040\t] | \( 1078(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1079\) )* (?: 1080[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1081(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1082| \[ # [ 1083(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1084\] # ] 1085) # ...further okay 1086)* 1087# address spec 1088(?: [\040\t] | \( 1089(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1090\) )* > # trailing > 1091# name and address 1092) (?: [\040\t] | \( 1093(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 1094\) )* # optional trailing comment 1095/x 1096 Alan Other <user\@dom.ain> 1097 0: Alan Other <[email protected]> 1098 <user\@dom.ain> 1099 0: [email protected] 1100 user\@dom.ain 1101 0: [email protected] 1102 \"A. Other\" <user.1234\@dom.ain> (a comment) 1103 0: "A. Other" <[email protected]> (a comment) 1104 A. Other <user.1234\@dom.ain> (a comment) 1105 0: Other <[email protected]> (a comment) 1106 \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay 1107 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay 1108 A missing angle <user\@some.where 1109 0: [email protected] 1110\= Expect no match 1111 The quick brown fox 1112No match 1113 1114/[\040\t]* # Nab whitespace. 1115(?: 1116\( # ( 1117[^\\\x80-\xff\n\015()] * # normal* 1118(?: # ( 1119(?: \\ [^\x80-\xff] | 1120\( # ( 1121[^\\\x80-\xff\n\015()] * # normal* 1122(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1123\) # ) 1124) # special 1125[^\\\x80-\xff\n\015()] * # normal* 1126)* # )* 1127\) # ) 1128[\040\t]* )* # If comment found, allow more spaces. 1129# optional leading comment 1130(?: 1131(?: 1132[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1133(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1134# Atom 1135| # or 1136" # " 1137[^\\\x80-\xff\n\015"] * # normal 1138(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 1139" # " 1140# Quoted string 1141) 1142[\040\t]* # Nab whitespace. 1143(?: 1144\( # ( 1145[^\\\x80-\xff\n\015()] * # normal* 1146(?: # ( 1147(?: \\ [^\x80-\xff] | 1148\( # ( 1149[^\\\x80-\xff\n\015()] * # normal* 1150(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1151\) # ) 1152) # special 1153[^\\\x80-\xff\n\015()] * # normal* 1154)* # )* 1155\) # ) 1156[\040\t]* )* # If comment found, allow more spaces. 1157(?: 1158\. 1159[\040\t]* # Nab whitespace. 1160(?: 1161\( # ( 1162[^\\\x80-\xff\n\015()] * # normal* 1163(?: # ( 1164(?: \\ [^\x80-\xff] | 1165\( # ( 1166[^\\\x80-\xff\n\015()] * # normal* 1167(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1168\) # ) 1169) # special 1170[^\\\x80-\xff\n\015()] * # normal* 1171)* # )* 1172\) # ) 1173[\040\t]* )* # If comment found, allow more spaces. 1174(?: 1175[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1176(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1177# Atom 1178| # or 1179" # " 1180[^\\\x80-\xff\n\015"] * # normal 1181(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 1182" # " 1183# Quoted string 1184) 1185[\040\t]* # Nab whitespace. 1186(?: 1187\( # ( 1188[^\\\x80-\xff\n\015()] * # normal* 1189(?: # ( 1190(?: \\ [^\x80-\xff] | 1191\( # ( 1192[^\\\x80-\xff\n\015()] * # normal* 1193(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1194\) # ) 1195) # special 1196[^\\\x80-\xff\n\015()] * # normal* 1197)* # )* 1198\) # ) 1199[\040\t]* )* # If comment found, allow more spaces. 1200# additional words 1201)* 1202@ 1203[\040\t]* # Nab whitespace. 1204(?: 1205\( # ( 1206[^\\\x80-\xff\n\015()] * # normal* 1207(?: # ( 1208(?: \\ [^\x80-\xff] | 1209\( # ( 1210[^\\\x80-\xff\n\015()] * # normal* 1211(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1212\) # ) 1213) # special 1214[^\\\x80-\xff\n\015()] * # normal* 1215)* # )* 1216\) # ) 1217[\040\t]* )* # If comment found, allow more spaces. 1218(?: 1219[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1220(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1221| 1222\[ # [ 1223(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1224\] # ] 1225) 1226[\040\t]* # Nab whitespace. 1227(?: 1228\( # ( 1229[^\\\x80-\xff\n\015()] * # normal* 1230(?: # ( 1231(?: \\ [^\x80-\xff] | 1232\( # ( 1233[^\\\x80-\xff\n\015()] * # normal* 1234(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1235\) # ) 1236) # special 1237[^\\\x80-\xff\n\015()] * # normal* 1238)* # )* 1239\) # ) 1240[\040\t]* )* # If comment found, allow more spaces. 1241# optional trailing comments 1242(?: 1243\. 1244[\040\t]* # Nab whitespace. 1245(?: 1246\( # ( 1247[^\\\x80-\xff\n\015()] * # normal* 1248(?: # ( 1249(?: \\ [^\x80-\xff] | 1250\( # ( 1251[^\\\x80-\xff\n\015()] * # normal* 1252(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1253\) # ) 1254) # special 1255[^\\\x80-\xff\n\015()] * # normal* 1256)* # )* 1257\) # ) 1258[\040\t]* )* # If comment found, allow more spaces. 1259(?: 1260[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1261(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1262| 1263\[ # [ 1264(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1265\] # ] 1266) 1267[\040\t]* # Nab whitespace. 1268(?: 1269\( # ( 1270[^\\\x80-\xff\n\015()] * # normal* 1271(?: # ( 1272(?: \\ [^\x80-\xff] | 1273\( # ( 1274[^\\\x80-\xff\n\015()] * # normal* 1275(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1276\) # ) 1277) # special 1278[^\\\x80-\xff\n\015()] * # normal* 1279)* # )* 1280\) # ) 1281[\040\t]* )* # If comment found, allow more spaces. 1282# optional trailing comments 1283)* 1284# address 1285| # or 1286(?: 1287[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1288(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1289# Atom 1290| # or 1291" # " 1292[^\\\x80-\xff\n\015"] * # normal 1293(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 1294" # " 1295# Quoted string 1296) 1297# leading word 1298[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces 1299(?: 1300(?: 1301\( # ( 1302[^\\\x80-\xff\n\015()] * # normal* 1303(?: # ( 1304(?: \\ [^\x80-\xff] | 1305\( # ( 1306[^\\\x80-\xff\n\015()] * # normal* 1307(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1308\) # ) 1309) # special 1310[^\\\x80-\xff\n\015()] * # normal* 1311)* # )* 1312\) # ) 1313| 1314" # " 1315[^\\\x80-\xff\n\015"] * # normal 1316(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 1317" # " 1318) # "special" comment or quoted string 1319[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal" 1320)* 1321< 1322[\040\t]* # Nab whitespace. 1323(?: 1324\( # ( 1325[^\\\x80-\xff\n\015()] * # normal* 1326(?: # ( 1327(?: \\ [^\x80-\xff] | 1328\( # ( 1329[^\\\x80-\xff\n\015()] * # normal* 1330(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1331\) # ) 1332) # special 1333[^\\\x80-\xff\n\015()] * # normal* 1334)* # )* 1335\) # ) 1336[\040\t]* )* # If comment found, allow more spaces. 1337# < 1338(?: 1339@ 1340[\040\t]* # Nab whitespace. 1341(?: 1342\( # ( 1343[^\\\x80-\xff\n\015()] * # normal* 1344(?: # ( 1345(?: \\ [^\x80-\xff] | 1346\( # ( 1347[^\\\x80-\xff\n\015()] * # normal* 1348(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1349\) # ) 1350) # special 1351[^\\\x80-\xff\n\015()] * # normal* 1352)* # )* 1353\) # ) 1354[\040\t]* )* # If comment found, allow more spaces. 1355(?: 1356[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1357(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1358| 1359\[ # [ 1360(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1361\] # ] 1362) 1363[\040\t]* # Nab whitespace. 1364(?: 1365\( # ( 1366[^\\\x80-\xff\n\015()] * # normal* 1367(?: # ( 1368(?: \\ [^\x80-\xff] | 1369\( # ( 1370[^\\\x80-\xff\n\015()] * # normal* 1371(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1372\) # ) 1373) # special 1374[^\\\x80-\xff\n\015()] * # normal* 1375)* # )* 1376\) # ) 1377[\040\t]* )* # If comment found, allow more spaces. 1378# optional trailing comments 1379(?: 1380\. 1381[\040\t]* # Nab whitespace. 1382(?: 1383\( # ( 1384[^\\\x80-\xff\n\015()] * # normal* 1385(?: # ( 1386(?: \\ [^\x80-\xff] | 1387\( # ( 1388[^\\\x80-\xff\n\015()] * # normal* 1389(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1390\) # ) 1391) # special 1392[^\\\x80-\xff\n\015()] * # normal* 1393)* # )* 1394\) # ) 1395[\040\t]* )* # If comment found, allow more spaces. 1396(?: 1397[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1398(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1399| 1400\[ # [ 1401(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1402\] # ] 1403) 1404[\040\t]* # Nab whitespace. 1405(?: 1406\( # ( 1407[^\\\x80-\xff\n\015()] * # normal* 1408(?: # ( 1409(?: \\ [^\x80-\xff] | 1410\( # ( 1411[^\\\x80-\xff\n\015()] * # normal* 1412(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1413\) # ) 1414) # special 1415[^\\\x80-\xff\n\015()] * # normal* 1416)* # )* 1417\) # ) 1418[\040\t]* )* # If comment found, allow more spaces. 1419# optional trailing comments 1420)* 1421(?: , 1422[\040\t]* # Nab whitespace. 1423(?: 1424\( # ( 1425[^\\\x80-\xff\n\015()] * # normal* 1426(?: # ( 1427(?: \\ [^\x80-\xff] | 1428\( # ( 1429[^\\\x80-\xff\n\015()] * # normal* 1430(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1431\) # ) 1432) # special 1433[^\\\x80-\xff\n\015()] * # normal* 1434)* # )* 1435\) # ) 1436[\040\t]* )* # If comment found, allow more spaces. 1437@ 1438[\040\t]* # Nab whitespace. 1439(?: 1440\( # ( 1441[^\\\x80-\xff\n\015()] * # normal* 1442(?: # ( 1443(?: \\ [^\x80-\xff] | 1444\( # ( 1445[^\\\x80-\xff\n\015()] * # normal* 1446(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1447\) # ) 1448) # special 1449[^\\\x80-\xff\n\015()] * # normal* 1450)* # )* 1451\) # ) 1452[\040\t]* )* # If comment found, allow more spaces. 1453(?: 1454[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1455(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1456| 1457\[ # [ 1458(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1459\] # ] 1460) 1461[\040\t]* # Nab whitespace. 1462(?: 1463\( # ( 1464[^\\\x80-\xff\n\015()] * # normal* 1465(?: # ( 1466(?: \\ [^\x80-\xff] | 1467\( # ( 1468[^\\\x80-\xff\n\015()] * # normal* 1469(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1470\) # ) 1471) # special 1472[^\\\x80-\xff\n\015()] * # normal* 1473)* # )* 1474\) # ) 1475[\040\t]* )* # If comment found, allow more spaces. 1476# optional trailing comments 1477(?: 1478\. 1479[\040\t]* # Nab whitespace. 1480(?: 1481\( # ( 1482[^\\\x80-\xff\n\015()] * # normal* 1483(?: # ( 1484(?: \\ [^\x80-\xff] | 1485\( # ( 1486[^\\\x80-\xff\n\015()] * # normal* 1487(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1488\) # ) 1489) # special 1490[^\\\x80-\xff\n\015()] * # normal* 1491)* # )* 1492\) # ) 1493[\040\t]* )* # If comment found, allow more spaces. 1494(?: 1495[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1496(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1497| 1498\[ # [ 1499(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1500\] # ] 1501) 1502[\040\t]* # Nab whitespace. 1503(?: 1504\( # ( 1505[^\\\x80-\xff\n\015()] * # normal* 1506(?: # ( 1507(?: \\ [^\x80-\xff] | 1508\( # ( 1509[^\\\x80-\xff\n\015()] * # normal* 1510(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1511\) # ) 1512) # special 1513[^\\\x80-\xff\n\015()] * # normal* 1514)* # )* 1515\) # ) 1516[\040\t]* )* # If comment found, allow more spaces. 1517# optional trailing comments 1518)* 1519)* # additional domains 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)? # optional route 1538(?: 1539[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1540(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1541# Atom 1542| # or 1543" # " 1544[^\\\x80-\xff\n\015"] * # normal 1545(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 1546" # " 1547# Quoted string 1548) 1549[\040\t]* # Nab whitespace. 1550(?: 1551\( # ( 1552[^\\\x80-\xff\n\015()] * # normal* 1553(?: # ( 1554(?: \\ [^\x80-\xff] | 1555\( # ( 1556[^\\\x80-\xff\n\015()] * # normal* 1557(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1558\) # ) 1559) # special 1560[^\\\x80-\xff\n\015()] * # normal* 1561)* # )* 1562\) # ) 1563[\040\t]* )* # If comment found, allow more spaces. 1564(?: 1565\. 1566[\040\t]* # Nab whitespace. 1567(?: 1568\( # ( 1569[^\\\x80-\xff\n\015()] * # normal* 1570(?: # ( 1571(?: \\ [^\x80-\xff] | 1572\( # ( 1573[^\\\x80-\xff\n\015()] * # normal* 1574(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1575\) # ) 1576) # special 1577[^\\\x80-\xff\n\015()] * # normal* 1578)* # )* 1579\) # ) 1580[\040\t]* )* # If comment found, allow more spaces. 1581(?: 1582[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1583(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1584# Atom 1585| # or 1586" # " 1587[^\\\x80-\xff\n\015"] * # normal 1588(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 1589" # " 1590# Quoted string 1591) 1592[\040\t]* # Nab whitespace. 1593(?: 1594\( # ( 1595[^\\\x80-\xff\n\015()] * # normal* 1596(?: # ( 1597(?: \\ [^\x80-\xff] | 1598\( # ( 1599[^\\\x80-\xff\n\015()] * # normal* 1600(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1601\) # ) 1602) # special 1603[^\\\x80-\xff\n\015()] * # normal* 1604)* # )* 1605\) # ) 1606[\040\t]* )* # If comment found, allow more spaces. 1607# additional words 1608)* 1609@ 1610[\040\t]* # Nab whitespace. 1611(?: 1612\( # ( 1613[^\\\x80-\xff\n\015()] * # normal* 1614(?: # ( 1615(?: \\ [^\x80-\xff] | 1616\( # ( 1617[^\\\x80-\xff\n\015()] * # normal* 1618(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1619\) # ) 1620) # special 1621[^\\\x80-\xff\n\015()] * # normal* 1622)* # )* 1623\) # ) 1624[\040\t]* )* # If comment found, allow more spaces. 1625(?: 1626[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1627(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1628| 1629\[ # [ 1630(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1631\] # ] 1632) 1633[\040\t]* # Nab whitespace. 1634(?: 1635\( # ( 1636[^\\\x80-\xff\n\015()] * # normal* 1637(?: # ( 1638(?: \\ [^\x80-\xff] | 1639\( # ( 1640[^\\\x80-\xff\n\015()] * # normal* 1641(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1642\) # ) 1643) # special 1644[^\\\x80-\xff\n\015()] * # normal* 1645)* # )* 1646\) # ) 1647[\040\t]* )* # If comment found, allow more spaces. 1648# optional trailing comments 1649(?: 1650\. 1651[\040\t]* # Nab whitespace. 1652(?: 1653\( # ( 1654[^\\\x80-\xff\n\015()] * # normal* 1655(?: # ( 1656(?: \\ [^\x80-\xff] | 1657\( # ( 1658[^\\\x80-\xff\n\015()] * # normal* 1659(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1660\) # ) 1661) # special 1662[^\\\x80-\xff\n\015()] * # normal* 1663)* # )* 1664\) # ) 1665[\040\t]* )* # If comment found, allow more spaces. 1666(?: 1667[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1668(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1669| 1670\[ # [ 1671(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1672\] # ] 1673) 1674[\040\t]* # Nab whitespace. 1675(?: 1676\( # ( 1677[^\\\x80-\xff\n\015()] * # normal* 1678(?: # ( 1679(?: \\ [^\x80-\xff] | 1680\( # ( 1681[^\\\x80-\xff\n\015()] * # normal* 1682(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1683\) # ) 1684) # special 1685[^\\\x80-\xff\n\015()] * # normal* 1686)* # )* 1687\) # ) 1688[\040\t]* )* # If comment found, allow more spaces. 1689# optional trailing comments 1690)* 1691# address spec 1692> # > 1693# name and address 1694) 1695/x 1696 Alan Other <user\@dom.ain> 1697 0: Alan Other <[email protected]> 1698 <user\@dom.ain> 1699 0: [email protected] 1700 user\@dom.ain 1701 0: [email protected] 1702 \"A. Other\" <user.1234\@dom.ain> (a comment) 1703 0: "A. Other" <[email protected]> 1704 A. Other <user.1234\@dom.ain> (a comment) 1705 0: Other <[email protected]> 1706 \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay 1707 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay 1708 A missing angle <user\@some.where 1709 0: [email protected] 1710\= Expect no match 1711 The quick brown fox 1712No match 1713 1714/abc\0def\00pqr\000xyz\0000AB/ 1715 abc\0def\00pqr\000xyz\0000AB 1716 0: abc\x00def\x00pqr\x00xyz\x000AB 1717 abc456 abc\0def\00pqr\000xyz\0000ABCDE 1718 0: abc\x00def\x00pqr\x00xyz\x000AB 1719 1720/abc\x0def\x00pqr\x000xyz\x0000AB/ 1721 abc\x0def\x00pqr\x000xyz\x0000AB 1722 0: abc\x0def\x00pqr\x000xyz\x0000AB 1723 abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE 1724 0: abc\x0def\x00pqr\x000xyz\x0000AB 1725 1726/^[\000-\037]/ 1727 \0A 1728 0: \x00 1729 \01B 1730 0: \x01 1731 \037C 1732 0: \x1f 1733 1734/\0*/ 1735 \0\0\0\0 1736 0: \x00\x00\x00\x00 1737 1738/A\x0{2,3}Z/ 1739 The A\x0\x0Z 1740 0: A\x00\x00Z 1741 An A\0\x0\0Z 1742 0: A\x00\x00\x00Z 1743\= Expect no match 1744 A\0Z 1745No match 1746 A\0\x0\0\x0Z 1747No match 1748 1749/^(cow|)\1(bell)/ 1750 cowcowbell 1751 0: cowcowbell 1752 1: cow 1753 2: bell 1754 bell 1755 0: bell 1756 1: 1757 2: bell 1758\= Expect no match 1759 cowbell 1760No match 1761 1762/^\s/ 1763 \040abc 1764 0: 1765 \x0cabc 1766 0: \x0c 1767 \nabc 1768 0: \x0a 1769 \rabc 1770 0: \x0d 1771 \tabc 1772 0: \x09 1773\= Expect no match 1774 abc 1775No match 1776 1777/^a b 1778 c/x 1779 abc 1780 0: abc 1781 1782/^(a|)\1*b/ 1783 ab 1784 0: ab 1785 1: a 1786 aaaab 1787 0: aaaab 1788 1: a 1789 b 1790 0: b 1791 1: 1792\= Expect no match 1793 acb 1794No match 1795 1796/^(a|)\1+b/ 1797 aab 1798 0: aab 1799 1: a 1800 aaaab 1801 0: aaaab 1802 1: a 1803 b 1804 0: b 1805 1: 1806\= Expect no match 1807 ab 1808No match 1809 1810/^(a|)\1?b/ 1811 ab 1812 0: ab 1813 1: a 1814 aab 1815 0: aab 1816 1: a 1817 b 1818 0: b 1819 1: 1820\= Expect no match 1821 acb 1822No match 1823 1824/^(a|)\1{2}b/ 1825 aaab 1826 0: aaab 1827 1: a 1828 b 1829 0: b 1830 1: 1831\= Expect no match 1832 ab 1833No match 1834 aab 1835No match 1836 aaaab 1837No match 1838 1839/^(a|)\1{2,3}b/ 1840 aaab 1841 0: aaab 1842 1: a 1843 aaaab 1844 0: aaaab 1845 1: a 1846 b 1847 0: b 1848 1: 1849\= Expect no match 1850 ab 1851No match 1852 aab 1853No match 1854 aaaaab 1855No match 1856 1857/ab{1,3}bc/ 1858 abbbbc 1859 0: abbbbc 1860 abbbc 1861 0: abbbc 1862 abbc 1863 0: abbc 1864\= Expect no match 1865 abc 1866No match 1867 abbbbbc 1868No match 1869 1870/([^.]*)\.([^:]*):[T ]+(.*)/ 1871 track1.title:TBlah blah blah 1872 0: track1.title:TBlah blah blah 1873 1: track1 1874 2: title 1875 3: Blah blah blah 1876 1877/([^.]*)\.([^:]*):[T ]+(.*)/i 1878 track1.title:TBlah blah blah 1879 0: track1.title:TBlah blah blah 1880 1: track1 1881 2: title 1882 3: Blah blah blah 1883 1884/([^.]*)\.([^:]*):[t ]+(.*)/i 1885 track1.title:TBlah blah blah 1886 0: track1.title:TBlah blah blah 1887 1: track1 1888 2: title 1889 3: Blah blah blah 1890 1891/^[W-c]+$/ 1892 WXY_^abc 1893 0: WXY_^abc 1894\= Expect no match 1895 wxy 1896No match 1897 1898/^[W-c]+$/i 1899 WXY_^abc 1900 0: WXY_^abc 1901 wxy_^ABC 1902 0: wxy_^ABC 1903 1904/^[\x3f-\x5F]+$/i 1905 WXY_^abc 1906 0: WXY_^abc 1907 wxy_^ABC 1908 0: wxy_^ABC 1909 1910/^abc$/m 1911 abc 1912 0: abc 1913 qqq\nabc 1914 0: abc 1915 abc\nzzz 1916 0: abc 1917 qqq\nabc\nzzz 1918 0: abc 1919 1920/^abc$/ 1921 abc 1922 0: abc 1923\= Expect no match 1924 qqq\nabc 1925No match 1926 abc\nzzz 1927No match 1928 qqq\nabc\nzzz 1929No match 1930 1931/\Aabc\Z/m 1932 abc 1933 0: abc 1934 abc\n 1935 0: abc 1936\= Expect no match 1937 qqq\nabc 1938No match 1939 abc\nzzz 1940No match 1941 qqq\nabc\nzzz 1942No match 1943 1944/\A(.)*\Z/s 1945 abc\ndef 1946 0: abc\x0adef 1947 1: f 1948 1949/\A(.)*\Z/m 1950\= Expect no match 1951 abc\ndef 1952No match 1953 1954/(?:b)|(?::+)/ 1955 b::c 1956 0: b 1957 c::b 1958 0: :: 1959 1960/[-az]+/ 1961 az- 1962 0: az- 1963\= Expect no match 1964 b 1965No match 1966 1967/[az-]+/ 1968 za- 1969 0: za- 1970\= Expect no match 1971 b 1972No match 1973 1974/[a\-z]+/ 1975 a-z 1976 0: a-z 1977\= Expect no match 1978 b 1979No match 1980 1981/[a-z]+/ 1982 abcdxyz 1983 0: abcdxyz 1984 1985/[\d-]+/ 1986 12-34 1987 0: 12-34 1988\= Expect no match 1989 aaa 1990No match 1991 1992/\x5c/ 1993 \\ 1994 0: \ 1995 1996/\x20Z/ 1997 the Zoo 1998 0: Z 1999\= Expect no match 2000 Zulu 2001No match 2002 2003/(abc)\1/i 2004 abcabc 2005 0: abcabc 2006 1: abc 2007 ABCabc 2008 0: ABCabc 2009 1: ABC 2010 abcABC 2011 0: abcABC 2012 1: abc 2013 2014/abc$/ 2015 abc 2016 0: abc 2017 abc\n 2018 0: abc 2019\= Expect no match 2020 abc\ndef 2021No match 2022 2023/(abc)\123/ 2024 abc\x53 2025 0: abcS 2026 1: abc 2027 2028/(abc)\223/ 2029 abc\x93 2030 0: abc\x93 2031 1: abc 2032 2033/(abc)\323/ 2034 abc\xd3 2035 0: abc\xd3 2036 1: abc 2037 2038/(abc)\100/ 2039 abc\x40 2040 0: abc@ 2041 1: abc 2042 abc\100 2043 0: abc@ 2044 1: abc 2045 2046/(abc)\1000/ 2047 abc\x400 2048 0: abc@0 2049 1: abc 2050 abc\x40\x30 2051 0: abc@0 2052 1: abc 2053 abc\1000 2054 0: abc@0 2055 1: abc 2056 abc\100\x30 2057 0: abc@0 2058 1: abc 2059 abc\100\060 2060 0: abc@0 2061 1: abc 2062 abc\100\60 2063 0: abc@0 2064 1: abc 2065 2066/^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/ 2067 ABCDEFGHIHI 2068 0: ABCDEFGHIHI 2069 1: A 2070 2: B 2071 3: C 2072 4: D 2073 5: E 2074 6: F 2075 7: G 2076 8: H 2077 9: I 2078 2079/^[A\8B\9C]+$/ 2080 A8B9C 2081 0: A8B9C 2082\= Expect no match 2083 A8B9C\x00 2084No match 2085 2086/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/ 2087 abcdefghijkllS 2088 0: abcdefghijkllS 2089 1: a 2090 2: b 2091 3: c 2092 4: d 2093 5: e 2094 6: f 2095 7: g 2096 8: h 2097 9: i 209810: j 209911: k 210012: l 2101 2102/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/ 2103 abcdefghijk\12S 2104 0: abcdefghijk\x0aS 2105 1: a 2106 2: b 2107 3: c 2108 4: d 2109 5: e 2110 6: f 2111 7: g 2112 8: h 2113 9: i 211410: j 211511: k 2116 2117/a{0}bc/ 2118 bc 2119 0: bc 2120 2121/(a|(bc)){0,0}?xyz/ 2122 xyz 2123 0: xyz 2124 2125/abc[\10]de/ 2126 abc\010de 2127 0: abc\x08de 2128 2129/abc[\1]de/ 2130 abc\1de 2131 0: abc\x01de 2132 2133/(abc)[\1]de/ 2134 abc\1de 2135 0: abc\x01de 2136 1: abc 2137 2138/(?s)a.b/ 2139 a\nb 2140 0: a\x0ab 2141 2142/^([^a])([^\b])([^c]*)([^d]{3,4})/ 2143 baNOTccccd 2144 0: baNOTcccc 2145 1: b 2146 2: a 2147 3: NOT 2148 4: cccc 2149 baNOTcccd 2150 0: baNOTccc 2151 1: b 2152 2: a 2153 3: NOT 2154 4: ccc 2155 baNOTccd 2156 0: baNOTcc 2157 1: b 2158 2: a 2159 3: NO 2160 4: Tcc 2161 bacccd 2162 0: baccc 2163 1: b 2164 2: a 2165 3: 2166 4: ccc 2167\= Expect no match 2168 anything 2169No match 2170 b\bc 2171No match 2172 baccd 2173No match 2174 2175/[^a]/ 2176 Abc 2177 0: A 2178 2179/[^a]/i 2180 Abc 2181 0: b 2182 2183/[^a]+/ 2184 AAAaAbc 2185 0: AAA 2186 2187/[^a]+/i 2188 AAAaAbc 2189 0: bc 2190 2191/[^a]+/ 2192 bbb\nccc 2193 0: bbb\x0accc 2194 2195/[^k]$/ 2196 abc 2197 0: c 2198\= Expect no match 2199 abk 2200No match 2201 2202/[^k]{2,3}$/ 2203 abc 2204 0: abc 2205 kbc 2206 0: bc 2207 kabc 2208 0: abc 2209\= Expect no match 2210 abk 2211No match 2212 akb 2213No match 2214 akk 2215No match 2216 2217/^\d{8,}\@.+[^k]$/ 2218 12345678\@a.b.c.d 2219 0: [email protected] 2220 123456789\@x.y.z 2221 0: [email protected] 2222\= Expect no match 2223 12345678\@x.y.uk 2224No match 2225 1234567\@a.b.c.d 2226No match 2227 2228/(a)\1{8,}/ 2229 aaaaaaaaa 2230 0: aaaaaaaaa 2231 1: a 2232 aaaaaaaaaa 2233 0: aaaaaaaaaa 2234 1: a 2235\= Expect no match 2236 aaaaaaa 2237No match 2238 2239/[^a]/ 2240 aaaabcd 2241 0: b 2242 aaAabcd 2243 0: A 2244 2245/[^a]/i 2246 aaaabcd 2247 0: b 2248 aaAabcd 2249 0: b 2250 2251/[^az]/ 2252 aaaabcd 2253 0: b 2254 aaAabcd 2255 0: A 2256 2257/[^az]/i 2258 aaaabcd 2259 0: b 2260 aaAabcd 2261 0: b 2262 2263/\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/ 2264 \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377 2265 0: \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff 2266 2267/P[^*]TAIRE[^*]{1,6}?LL/ 2268 xxxxxxxxxxxPSTAIREISLLxxxxxxxxx 2269 0: PSTAIREISLL 2270 2271/P[^*]TAIRE[^*]{1,}?LL/ 2272 xxxxxxxxxxxPSTAIREISLLxxxxxxxxx 2273 0: PSTAIREISLL 2274 2275/(\.\d\d[1-9]?)\d+/ 2276 1.230003938 2277 0: .230003938 2278 1: .23 2279 1.875000282 2280 0: .875000282 2281 1: .875 2282 1.235 2283 0: .235 2284 1: .23 2285 2286/(\.\d\d((?=0)|\d(?=\d)))/ 2287 1.230003938 2288 0: .23 2289 1: .23 2290 2: 2291 1.875000282 2292 0: .875 2293 1: .875 2294 2: 5 2295\= Expect no match 2296 1.235 2297No match 2298 2299/a(?)b/ 2300 ab 2301 0: ab 2302 2303/\b(foo)\s+(\w+)/i 2304 Food is on the foo table 2305 0: foo table 2306 1: foo 2307 2: table 2308 2309/foo(.*)bar/ 2310 The food is under the bar in the barn. 2311 0: food is under the bar in the bar 2312 1: d is under the bar in the 2313 2314/foo(.*?)bar/ 2315 The food is under the bar in the barn. 2316 0: food is under the bar 2317 1: d is under the 2318 2319/(.*)(\d*)/ 2320 I have 2 numbers: 53147 2321 0: I have 2 numbers: 53147 2322 1: I have 2 numbers: 53147 2323 2: 2324 2325/(.*)(\d+)/ 2326 I have 2 numbers: 53147 2327 0: I have 2 numbers: 53147 2328 1: I have 2 numbers: 5314 2329 2: 7 2330 2331/(.*?)(\d*)/ 2332 I have 2 numbers: 53147 2333 0: 2334 1: 2335 2: 2336 2337/(.*?)(\d+)/ 2338 I have 2 numbers: 53147 2339 0: I have 2 2340 1: I have 2341 2: 2 2342 2343/(.*)(\d+)$/ 2344 I have 2 numbers: 53147 2345 0: I have 2 numbers: 53147 2346 1: I have 2 numbers: 5314 2347 2: 7 2348 2349/(.*?)(\d+)$/ 2350 I have 2 numbers: 53147 2351 0: I have 2 numbers: 53147 2352 1: I have 2 numbers: 2353 2: 53147 2354 2355/(.*)\b(\d+)$/ 2356 I have 2 numbers: 53147 2357 0: I have 2 numbers: 53147 2358 1: I have 2 numbers: 2359 2: 53147 2360 2361/(.*\D)(\d+)$/ 2362 I have 2 numbers: 53147 2363 0: I have 2 numbers: 53147 2364 1: I have 2 numbers: 2365 2: 53147 2366 2367/^\D*(?!123)/ 2368 ABC123 2369 0: AB 2370 2371/^(\D*)(?=\d)(?!123)/ 2372 ABC445 2373 0: ABC 2374 1: ABC 2375\= Expect no match 2376 ABC123 2377No match 2378 2379/^[W-]46]/ 2380 W46]789 2381 0: W46] 2382 -46]789 2383 0: -46] 2384\= Expect no match 2385 Wall 2386No match 2387 Zebra 2388No match 2389 42 2390No match 2391 [abcd] 2392No match 2393 ]abcd[ 2394No match 2395 2396/^[W-\]46]/ 2397 W46]789 2398 0: W 2399 Wall 2400 0: W 2401 Zebra 2402 0: Z 2403 Xylophone 2404 0: X 2405 42 2406 0: 4 2407 [abcd] 2408 0: [ 2409 ]abcd[ 2410 0: ] 2411 \\backslash 2412 0: \ 2413\= Expect no match 2414 -46]789 2415No match 2416 well 2417No match 2418 2419/\d\d\/\d\d\/\d\d\d\d/ 2420 01/01/2000 2421 0: 01/01/2000 2422 2423/word (?:[a-zA-Z0-9]+ ){0,10}otherword/ 2424 word cat dog elephant mussel cow horse canary baboon snake shark otherword 2425 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword 2426\= Expect no match 2427 word cat dog elephant mussel cow horse canary baboon snake shark 2428No match 2429 2430/word (?:[a-zA-Z0-9]+ ){0,300}otherword/ 2431\= Expect no match 2432 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 2433No match 2434 2435/^(a){0,0}/ 2436 bcd 2437 0: 2438 abc 2439 0: 2440 aab 2441 0: 2442 2443/^(a){0,1}/ 2444 bcd 2445 0: 2446 abc 2447 0: a 2448 1: a 2449 aab 2450 0: a 2451 1: a 2452 2453/^(a){0,2}/ 2454 bcd 2455 0: 2456 abc 2457 0: a 2458 1: a 2459 aab 2460 0: aa 2461 1: a 2462 2463/^(a){0,3}/ 2464 bcd 2465 0: 2466 abc 2467 0: a 2468 1: a 2469 aab 2470 0: aa 2471 1: a 2472 aaa 2473 0: aaa 2474 1: a 2475 2476/^(a){0,}/ 2477 bcd 2478 0: 2479 abc 2480 0: a 2481 1: a 2482 aab 2483 0: aa 2484 1: a 2485 aaa 2486 0: aaa 2487 1: a 2488 aaaaaaaa 2489 0: aaaaaaaa 2490 1: a 2491 2492/^(a){1,1}/ 2493 abc 2494 0: a 2495 1: a 2496 aab 2497 0: a 2498 1: a 2499\= Expect no match 2500 bcd 2501No match 2502 2503/^(a){1,2}/ 2504 abc 2505 0: a 2506 1: a 2507 aab 2508 0: aa 2509 1: a 2510\= Expect no match 2511 bcd 2512No match 2513 2514/^(a){1,3}/ 2515 abc 2516 0: a 2517 1: a 2518 aab 2519 0: aa 2520 1: a 2521 aaa 2522 0: aaa 2523 1: a 2524\= Expect no match 2525 bcd 2526No match 2527 2528/^(a){1,}/ 2529 abc 2530 0: a 2531 1: a 2532 aab 2533 0: aa 2534 1: a 2535 aaa 2536 0: aaa 2537 1: a 2538 aaaaaaaa 2539 0: aaaaaaaa 2540 1: a 2541\= Expect no match 2542 bcd 2543No match 2544 2545/.*\.gif/ 2546 borfle\nbib.gif\nno 2547 0: bib.gif 2548 2549/.{0,}\.gif/ 2550 borfle\nbib.gif\nno 2551 0: bib.gif 2552 2553/.*\.gif/m 2554 borfle\nbib.gif\nno 2555 0: bib.gif 2556 2557/.*\.gif/s 2558 borfle\nbib.gif\nno 2559 0: borfle\x0abib.gif 2560 2561/.*\.gif/ms 2562 borfle\nbib.gif\nno 2563 0: borfle\x0abib.gif 2564 2565/.*$/ 2566 borfle\nbib.gif\nno 2567 0: no 2568 2569/.*$/m 2570 borfle\nbib.gif\nno 2571 0: borfle 2572 2573/.*$/s 2574 borfle\nbib.gif\nno 2575 0: borfle\x0abib.gif\x0ano 2576 2577/.*$/ms 2578 borfle\nbib.gif\nno 2579 0: borfle\x0abib.gif\x0ano 2580 2581/.*$/ 2582 borfle\nbib.gif\nno\n 2583 0: no 2584 2585/.*$/m 2586 borfle\nbib.gif\nno\n 2587 0: borfle 2588 2589/.*$/s 2590 borfle\nbib.gif\nno\n 2591 0: borfle\x0abib.gif\x0ano\x0a 2592 2593/.*$/ms 2594 borfle\nbib.gif\nno\n 2595 0: borfle\x0abib.gif\x0ano\x0a 2596 2597/(.*X|^B)/ 2598 abcde\n1234Xyz 2599 0: 1234X 2600 1: 1234X 2601 BarFoo 2602 0: B 2603 1: B 2604\= Expect no match 2605 abcde\nBar 2606No match 2607 2608/(.*X|^B)/m 2609 abcde\n1234Xyz 2610 0: 1234X 2611 1: 1234X 2612 BarFoo 2613 0: B 2614 1: B 2615 abcde\nBar 2616 0: B 2617 1: B 2618 2619/(.*X|^B)/s 2620 abcde\n1234Xyz 2621 0: abcde\x0a1234X 2622 1: abcde\x0a1234X 2623 BarFoo 2624 0: B 2625 1: B 2626\= Expect no match 2627 abcde\nBar 2628No match 2629 2630/(.*X|^B)/ms 2631 abcde\n1234Xyz 2632 0: abcde\x0a1234X 2633 1: abcde\x0a1234X 2634 BarFoo 2635 0: B 2636 1: B 2637 abcde\nBar 2638 0: B 2639 1: B 2640 2641/(?s)(.*X|^B)/ 2642 abcde\n1234Xyz 2643 0: abcde\x0a1234X 2644 1: abcde\x0a1234X 2645 BarFoo 2646 0: B 2647 1: B 2648\= Expect no match 2649 abcde\nBar 2650No match 2651 2652/(?s:.*X|^B)/ 2653 abcde\n1234Xyz 2654 0: abcde\x0a1234X 2655 BarFoo 2656 0: B 2657\= Expect no match 2658 abcde\nBar 2659No match 2660 2661/^.*B/ 2662\= Expect no match 2663 abc\nB 2664No match 2665 2666/(?s)^.*B/ 2667 abc\nB 2668 0: abc\x0aB 2669 2670/(?m)^.*B/ 2671 abc\nB 2672 0: B 2673 2674/(?ms)^.*B/ 2675 abc\nB 2676 0: abc\x0aB 2677 2678/(?ms)^B/ 2679 abc\nB 2680 0: B 2681 2682/(?s)B$/ 2683 B\n 2684 0: B 2685 2686/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/ 2687 123456654321 2688 0: 123456654321 2689 2690/^\d\d\d\d\d\d\d\d\d\d\d\d/ 2691 123456654321 2692 0: 123456654321 2693 2694/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/ 2695 123456654321 2696 0: 123456654321 2697 2698/^[abc]{12}/ 2699 abcabcabcabc 2700 0: abcabcabcabc 2701 2702/^[a-c]{12}/ 2703 abcabcabcabc 2704 0: abcabcabcabc 2705 2706/^(a|b|c){12}/ 2707 abcabcabcabc 2708 0: abcabcabcabc 2709 1: c 2710 2711/^[abcdefghijklmnopqrstuvwxy0123456789]/ 2712 n 2713 0: n 2714\= Expect no match 2715 z 2716No match 2717 2718/abcde{0,0}/ 2719 abcd 2720 0: abcd 2721\= Expect no match 2722 abce 2723No match 2724 2725/ab[cd]{0,0}e/ 2726 abe 2727 0: abe 2728\= Expect no match 2729 abcde 2730No match 2731 2732/ab(c){0,0}d/ 2733 abd 2734 0: abd 2735\= Expect no match 2736 abcd 2737No match 2738 2739/a(b*)/ 2740 a 2741 0: a 2742 1: 2743 ab 2744 0: ab 2745 1: b 2746 abbbb 2747 0: abbbb 2748 1: bbbb 2749\= Expect no match 2750 bbbbb 2751No match 2752 2753/ab\d{0}e/ 2754 abe 2755 0: abe 2756\= Expect no match 2757 ab1e 2758No match 2759 2760/"([^\\"]+|\\.)*"/ 2761 the \"quick\" brown fox 2762 0: "quick" 2763 1: quick 2764 \"the \\\"quick\\\" brown fox\" 2765 0: "the \"quick\" brown fox" 2766 1: brown fox 2767 2768/.*?/g,aftertext 2769 abc 2770 0: 2771 0+ abc 2772 0: a 2773 0+ bc 2774 0: 2775 0+ bc 2776 0: b 2777 0+ c 2778 0: 2779 0+ c 2780 0: c 2781 0+ 2782 0: 2783 0+ 2784 2785/\b/g,aftertext 2786 abc 2787 0: 2788 0+ abc 2789 0: 2790 0+ 2791 2792/\b/g,aftertext 2793 abc 2794 0: 2795 0+ abc 2796 0: 2797 0+ 2798 2799//g 2800 abc 2801 0: 2802 0: 2803 0: 2804 0: 2805 2806/<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 2807 <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> 2808 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> 2809 1: BGCOLOR='#DBE9E9' 2810 2: align=left valign=top 2811 3: 43. 2812 4: <a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286) 2813 5: 2814 6: 2815 7: <unset> 2816 8: align=left valign=top 2817 9: Lega lstaff.com 281810: align=left valign=top 281911: CA - Statewide 2820 2821/a[^a]b/ 2822 acb 2823 0: acb 2824 a\nb 2825 0: a\x0ab 2826 2827/a.b/ 2828 acb 2829 0: acb 2830\= Expect no match 2831 a\nb 2832No match 2833 2834/a[^a]b/s 2835 acb 2836 0: acb 2837 a\nb 2838 0: a\x0ab 2839 2840/a.b/s 2841 acb 2842 0: acb 2843 a\nb 2844 0: a\x0ab 2845 2846/^(b+?|a){1,2}?c/ 2847 bac 2848 0: bac 2849 1: a 2850 bbac 2851 0: bbac 2852 1: a 2853 bbbac 2854 0: bbbac 2855 1: a 2856 bbbbac 2857 0: bbbbac 2858 1: a 2859 bbbbbac 2860 0: bbbbbac 2861 1: a 2862 2863/^(b+|a){1,2}?c/ 2864 bac 2865 0: bac 2866 1: a 2867 bbac 2868 0: bbac 2869 1: a 2870 bbbac 2871 0: bbbac 2872 1: a 2873 bbbbac 2874 0: bbbbac 2875 1: a 2876 bbbbbac 2877 0: bbbbbac 2878 1: a 2879 2880/(?!\A)x/m 2881 a\bx\n 2882 0: x 2883 a\nx\n 2884 0: x 2885\= Expect no match 2886 x\nb\n 2887No match 2888 2889/(A|B)*?CD/ 2890 CD 2891 0: CD 2892 2893/(A|B)*CD/ 2894 CD 2895 0: CD 2896 2897/(AB)*?\1/ 2898 ABABAB 2899 0: ABAB 2900 1: AB 2901 2902/(AB)*\1/ 2903 ABABAB 2904 0: ABABAB 2905 1: AB 2906 2907/(?<!bar)foo/ 2908 foo 2909 0: foo 2910 catfood 2911 0: foo 2912 arfootle 2913 0: foo 2914 rfoosh 2915 0: foo 2916\= Expect no match 2917 barfoo 2918No match 2919 towbarfoo 2920No match 2921 2922/\w{3}(?<!bar)foo/ 2923 catfood 2924 0: catfoo 2925\= Expect no match 2926 foo 2927No match 2928 barfoo 2929No match 2930 towbarfoo 2931No match 2932 2933/(?<=(foo)a)bar/ 2934 fooabar 2935 0: bar 2936 1: foo 2937\= Expect no match 2938 bar 2939No match 2940 foobbar 2941No match 2942 2943/\Aabc\z/m 2944 abc 2945 0: abc 2946\= Expect no match 2947 abc\n 2948No match 2949 qqq\nabc 2950No match 2951 abc\nzzz 2952No match 2953 qqq\nabc\nzzz 2954No match 2955 2956/(?>.*\/)foo/ 2957 /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo 2958 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo 2959\= Expect no match 2960 /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/ 2961No match 2962 2963/(?>(\.\d\d[1-9]?))\d+/ 2964 1.230003938 2965 0: .230003938 2966 1: .23 2967 1.875000282 2968 0: .875000282 2969 1: .875 2970\= Expect no match 2971 1.235 2972No match 2973 2974/^((?>\w+)|(?>\s+))*$/ 2975 now is the time for all good men to come to the aid of the party 2976 0: now is the time for all good men to come to the aid of the party 2977 1: party 2978\= Expect no match 2979 this is not a line with only words and spaces! 2980No match 2981 2982/(\d+)(\w)/ 2983 12345a 2984 0: 12345a 2985 1: 12345 2986 2: a 2987 12345+ 2988 0: 12345 2989 1: 1234 2990 2: 5 2991 2992/((?>\d+))(\w)/ 2993 12345a 2994 0: 12345a 2995 1: 12345 2996 2: a 2997\= Expect no match 2998 12345+ 2999No match 3000 3001/(?>a+)b/ 3002 aaab 3003 0: aaab 3004 3005/((?>a+)b)/ 3006 aaab 3007 0: aaab 3008 1: aaab 3009 3010/(?>(a+))b/ 3011 aaab 3012 0: aaab 3013 1: aaa 3014 3015/(?>b)+/ 3016 aaabbbccc 3017 0: bbb 3018 3019/(?>a+|b+|c+)*c/ 3020 aaabbbbccccd 3021 0: aaabbbbc 3022 3023/((?>[^()]+)|\([^()]*\))+/ 3024 ((abc(ade)ufh()()x 3025 0: abc(ade)ufh()()x 3026 1: x 3027 3028/\(((?>[^()]+)|\([^()]+\))+\)/ 3029 (abc) 3030 0: (abc) 3031 1: abc 3032 (abc(def)xyz) 3033 0: (abc(def)xyz) 3034 1: xyz 3035\= Expect no match 3036 ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3037No match 3038 3039/a(?-i)b/i 3040 ab 3041 0: ab 3042 Ab 3043 0: Ab 3044\= Expect no match 3045 aB 3046No match 3047 AB 3048No match 3049 3050/(a (?x)b c)d e/ 3051 a bcd e 3052 0: a bcd e 3053 1: a bc 3054\= Expect no match 3055 a b cd e 3056No match 3057 abcd e 3058No match 3059 a bcde 3060No match 3061 3062/(a b(?x)c d (?-x)e f)/ 3063 a bcde f 3064 0: a bcde f 3065 1: a bcde f 3066\= Expect no match 3067 abcdef 3068No match 3069 3070/(a(?i)b)c/ 3071 abc 3072 0: abc 3073 1: ab 3074 aBc 3075 0: aBc 3076 1: aB 3077\= Expect no match 3078 abC 3079No match 3080 aBC 3081No match 3082 Abc 3083No match 3084 ABc 3085No match 3086 ABC 3087No match 3088 AbC 3089No match 3090 3091/a(?i:b)c/ 3092 abc 3093 0: abc 3094 aBc 3095 0: aBc 3096\= Expect no match 3097 ABC 3098No match 3099 abC 3100No match 3101 aBC 3102No match 3103 3104/a(?i:b)*c/ 3105 aBc 3106 0: aBc 3107 aBBc 3108 0: aBBc 3109\= Expect no match 3110 aBC 3111No match 3112 aBBC 3113No match 3114 3115/a(?=b(?i)c)\w\wd/ 3116 abcd 3117 0: abcd 3118 abCd 3119 0: abCd 3120\= Expect no match 3121 aBCd 3122No match 3123 abcD 3124No match 3125 3126/(?s-i:more.*than).*million/i 3127 more than million 3128 0: more than million 3129 more than MILLION 3130 0: more than MILLION 3131 more \n than Million 3132 0: more \x0a than Million 3133\= Expect no match 3134 MORE THAN MILLION 3135No match 3136 more \n than \n million 3137No match 3138 3139/(?:(?s-i)more.*than).*million/i 3140 more than million 3141 0: more than million 3142 more than MILLION 3143 0: more than MILLION 3144 more \n than Million 3145 0: more \x0a than Million 3146\= Expect no match 3147 MORE THAN MILLION 3148No match 3149 more \n than \n million 3150No match 3151 3152/(?>a(?i)b+)+c/ 3153 abc 3154 0: abc 3155 aBbc 3156 0: aBbc 3157 aBBc 3158 0: aBBc 3159\= Expect no match 3160 Abc 3161No match 3162 abAb 3163No match 3164 abbC 3165No match 3166 3167/(?=a(?i)b)\w\wc/ 3168 abc 3169 0: abc 3170 aBc 3171 0: aBc 3172\= Expect no match 3173 Ab 3174No match 3175 abC 3176No match 3177 aBC 3178No match 3179 3180/(?<=a(?i)b)(\w\w)c/ 3181 abxxc 3182 0: xxc 3183 1: xx 3184 aBxxc 3185 0: xxc 3186 1: xx 3187\= Expect no match 3188 Abxxc 3189No match 3190 ABxxc 3191No match 3192 abxxC 3193No match 3194 3195/(?:(a)|b)(?(1)A|B)/ 3196 aA 3197 0: aA 3198 1: a 3199 bB 3200 0: bB 3201\= Expect no match 3202 aB 3203No match 3204 bA 3205No match 3206 3207/^(a)?(?(1)a|b)+$/ 3208 aa 3209 0: aa 3210 1: a 3211 b 3212 0: b 3213 bb 3214 0: bb 3215\= Expect no match 3216 ab 3217No match 3218 3219# Perl gets this next one wrong if the pattern ends with $; in that case it 3220# fails to match "12". 3221 3222/^(?(?=abc)\w{3}:|\d\d)/ 3223 abc: 3224 0: abc: 3225 12 3226 0: 12 3227 123 3228 0: 12 3229\= Expect no match 3230 xyz 3231No match 3232 3233/^(?(?!abc)\d\d|\w{3}:)$/ 3234 abc: 3235 0: abc: 3236 12 3237 0: 12 3238\= Expect no match 3239 123 3240No match 3241 xyz 3242No match 3243 3244/(?(?<=foo)bar|cat)/ 3245 foobar 3246 0: bar 3247 cat 3248 0: cat 3249 fcat 3250 0: cat 3251 focat 3252 0: cat 3253\= Expect no match 3254 foocat 3255No match 3256 3257/(?(?<!foo)cat|bar)/ 3258 foobar 3259 0: bar 3260 cat 3261 0: cat 3262 fcat 3263 0: cat 3264 focat 3265 0: cat 3266\= Expect no match 3267 foocat 3268No match 3269 3270/( \( )? [^()]+ (?(1) \) |) /x 3271 abcd 3272 0: abcd 3273 (abcd) 3274 0: (abcd) 3275 1: ( 3276 the quick (abcd) fox 3277 0: the quick 3278 (abcd 3279 0: abcd 3280 3281/( \( )? [^()]+ (?(1) \) ) /x 3282 abcd 3283 0: abcd 3284 (abcd) 3285 0: (abcd) 3286 1: ( 3287 the quick (abcd) fox 3288 0: the quick 3289 (abcd 3290 0: abcd 3291 3292/^(?(2)a|(1)(2))+$/ 3293 12 3294 0: 12 3295 1: 1 3296 2: 2 3297 12a 3298 0: 12a 3299 1: 1 3300 2: 2 3301 12aa 3302 0: 12aa 3303 1: 1 3304 2: 2 3305\= Expect no match 3306 1234 3307No match 3308 3309/((?i)blah)\s+\1/ 3310 blah blah 3311 0: blah blah 3312 1: blah 3313 BLAH BLAH 3314 0: BLAH BLAH 3315 1: BLAH 3316 Blah Blah 3317 0: Blah Blah 3318 1: Blah 3319 blaH blaH 3320 0: blaH blaH 3321 1: blaH 3322\= Expect no match 3323 blah BLAH 3324No match 3325 Blah blah 3326No match 3327 blaH blah 3328No match 3329 3330/((?i)blah)\s+(?i:\1)/ 3331 blah blah 3332 0: blah blah 3333 1: blah 3334 BLAH BLAH 3335 0: BLAH BLAH 3336 1: BLAH 3337 Blah Blah 3338 0: Blah Blah 3339 1: Blah 3340 blaH blaH 3341 0: blaH blaH 3342 1: blaH 3343 blah BLAH 3344 0: blah BLAH 3345 1: blah 3346 Blah blah 3347 0: Blah blah 3348 1: Blah 3349 blaH blah 3350 0: blaH blah 3351 1: blaH 3352 3353/((?i)blah)\s+(?m)A(?i:\1)/ 3354 blah ABLAH 3355 0: blah ABLAH 3356 1: blah 3357\= Expect no match 3358 blah aBLAH 3359No match 3360 3361/(?>a*)*/ 3362 a 3363 0: a 3364 aa 3365 0: aa 3366 aaaa 3367 0: aaaa 3368 3369/(abc|)+/ 3370 abc 3371 0: abc 3372 1: 3373 abcabc 3374 0: abcabc 3375 1: 3376 abcabcabc 3377 0: abcabcabc 3378 1: 3379 xyz 3380 0: 3381 1: 3382 3383/([a]*)*/ 3384 a 3385 0: a 3386 1: 3387 aaaaa 3388 0: aaaaa 3389 1: 3390 3391/([ab]*)*/ 3392 a 3393 0: a 3394 1: 3395 b 3396 0: b 3397 1: 3398 ababab 3399 0: ababab 3400 1: 3401 aaaabcde 3402 0: aaaab 3403 1: 3404 bbbb 3405 0: bbbb 3406 1: 3407 3408/([^a]*)*/ 3409 b 3410 0: b 3411 1: 3412 bbbb 3413 0: bbbb 3414 1: 3415 aaa 3416 0: 3417 1: 3418 3419/([^ab]*)*/ 3420 cccc 3421 0: cccc 3422 1: 3423 abab 3424 0: 3425 1: 3426 3427/([a]*?)*/ 3428 a 3429 0: 3430 1: 3431 aaaa 3432 0: 3433 1: 3434 3435/([ab]*?)*/ 3436 a 3437 0: 3438 1: 3439 b 3440 0: 3441 1: 3442 abab 3443 0: 3444 1: 3445 baba 3446 0: 3447 1: 3448 3449/([^a]*?)*/ 3450 b 3451 0: 3452 1: 3453 bbbb 3454 0: 3455 1: 3456 aaa 3457 0: 3458 1: 3459 3460/([^ab]*?)*/ 3461 c 3462 0: 3463 1: 3464 cccc 3465 0: 3466 1: 3467 baba 3468 0: 3469 1: 3470 3471/(?>a*)*/ 3472 a 3473 0: a 3474 aaabcde 3475 0: aaa 3476 3477/((?>a*))*/ 3478 aaaaa 3479 0: aaaaa 3480 1: 3481 aabbaa 3482 0: aa 3483 1: 3484 3485/((?>a*?))*/ 3486 aaaaa 3487 0: 3488 1: 3489 aabbaa 3490 0: 3491 1: 3492 3493/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x 3494 12-sep-98 3495 0: 12-sep-98 3496 12-09-98 3497 0: 12-09-98 3498\= Expect no match 3499 sep-12-98 3500No match 3501 3502/(?<=(foo))bar\1/ 3503 foobarfoo 3504 0: barfoo 3505 1: foo 3506 foobarfootling 3507 0: barfoo 3508 1: foo 3509\= Expect no match 3510 foobar 3511No match 3512 barfoo 3513No match 3514 3515/(?i:saturday|sunday)/ 3516 saturday 3517 0: saturday 3518 sunday 3519 0: sunday 3520 Saturday 3521 0: Saturday 3522 Sunday 3523 0: Sunday 3524 SATURDAY 3525 0: SATURDAY 3526 SUNDAY 3527 0: SUNDAY 3528 SunDay 3529 0: SunDay 3530 3531/(a(?i)bc|BB)x/ 3532 abcx 3533 0: abcx 3534 1: abc 3535 aBCx 3536 0: aBCx 3537 1: aBC 3538 bbx 3539 0: bbx 3540 1: bb 3541 BBx 3542 0: BBx 3543 1: BB 3544\= Expect no match 3545 abcX 3546No match 3547 aBCX 3548No match 3549 bbX 3550No match 3551 BBX 3552No match 3553 3554/^([ab](?i)[cd]|[ef])/ 3555 ac 3556 0: ac 3557 1: ac 3558 aC 3559 0: aC 3560 1: aC 3561 bD 3562 0: bD 3563 1: bD 3564 elephant 3565 0: e 3566 1: e 3567 Europe 3568 0: E 3569 1: E 3570 frog 3571 0: f 3572 1: f 3573 France 3574 0: F 3575 1: F 3576\= Expect no match 3577 Africa 3578No match 3579 3580/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/ 3581 ab 3582 0: ab 3583 1: ab 3584 aBd 3585 0: aBd 3586 1: aBd 3587 xy 3588 0: xy 3589 1: xy 3590 xY 3591 0: xY 3592 1: xY 3593 zebra 3594 0: z 3595 1: z 3596 Zambesi 3597 0: Z 3598 1: Z 3599\= Expect no match 3600 aCD 3601No match 3602 XY 3603No match 3604 3605/(?<=foo\n)^bar/m 3606 foo\nbar 3607 0: bar 3608\= Expect no match 3609 bar 3610No match 3611 baz\nbar 3612No match 3613 3614/(?<=(?<!foo)bar)baz/ 3615 barbaz 3616 0: baz 3617 barbarbaz 3618 0: baz 3619 koobarbaz 3620 0: baz 3621\= Expect no match 3622 baz 3623No match 3624 foobarbaz 3625No match 3626 3627# The cases of aaaa and aaaaaa are missed out below because Perl does things 3628# differently. We know that odd, and maybe incorrect, things happen with 3629# recursive references in Perl, as far as 5.11.3 - see some stuff in test #2. 3630 3631/^(a\1?){4}$/ 3632 aaaaa 3633 0: aaaaa 3634 1: a 3635 aaaaaaa 3636 0: aaaaaaa 3637 1: a 3638 aaaaaaaaaa 3639 0: aaaaaaaaaa 3640 1: aaaa 3641\= Expect no match 3642 a 3643No match 3644 aa 3645No match 3646 aaa 3647No match 3648 aaaaaaaa 3649No match 3650 aaaaaaaaa 3651No match 3652 aaaaaaaaaaa 3653No match 3654 aaaaaaaaaaaa 3655No match 3656 aaaaaaaaaaaaa 3657No match 3658 aaaaaaaaaaaaaa 3659No match 3660 aaaaaaaaaaaaaaa 3661No match 3662 aaaaaaaaaaaaaaaa 3663No match 3664 3665/^(a\1?)(a\1?)(a\2?)(a\3?)$/ 3666 aaaa 3667 0: aaaa 3668 1: a 3669 2: a 3670 3: a 3671 4: a 3672 aaaaa 3673 0: aaaaa 3674 1: a 3675 2: aa 3676 3: a 3677 4: a 3678 aaaaaa 3679 0: aaaaaa 3680 1: a 3681 2: aa 3682 3: a 3683 4: aa 3684 aaaaaaa 3685 0: aaaaaaa 3686 1: a 3687 2: aa 3688 3: aaa 3689 4: a 3690 aaaaaaaaaa 3691 0: aaaaaaaaaa 3692 1: a 3693 2: aa 3694 3: aaa 3695 4: aaaa 3696\= Expect no match 3697 a 3698No match 3699 aa 3700No match 3701 aaa 3702No match 3703 aaaaaaaa 3704No match 3705 aaaaaaaaa 3706No match 3707 aaaaaaaaaaa 3708No match 3709 aaaaaaaaaaaa 3710No match 3711 aaaaaaaaaaaaa 3712No match 3713 aaaaaaaaaaaaaa 3714No match 3715 aaaaaaaaaaaaaaa 3716No match 3717 aaaaaaaaaaaaaaaa 3718No match 3719 3720# The following tests are taken from the Perl 5.005 test suite; some of them 3721# are compatible with 5.004, but I'd rather not have to sort them out. 3722 3723/abc/ 3724 abc 3725 0: abc 3726 xabcy 3727 0: abc 3728 ababc 3729 0: abc 3730\= Expect no match 3731 xbc 3732No match 3733 axc 3734No match 3735 abx 3736No match 3737 3738/ab*c/ 3739 abc 3740 0: abc 3741 3742/ab*bc/ 3743 abc 3744 0: abc 3745 abbc 3746 0: abbc 3747 abbbbc 3748 0: abbbbc 3749 3750/.{1}/ 3751 abbbbc 3752 0: a 3753 3754/.{3,4}/ 3755 abbbbc 3756 0: abbb 3757 3758/ab{0,}bc/ 3759 abbbbc 3760 0: abbbbc 3761 3762/ab+bc/ 3763 abbc 3764 0: abbc 3765\= Expect no match 3766 abc 3767No match 3768 abq 3769No match 3770 3771/ab{1,}bc/ 3772 3773/ab+bc/ 3774 abbbbc 3775 0: abbbbc 3776 3777/ab{1,}bc/ 3778 abbbbc 3779 0: abbbbc 3780 3781/ab{1,3}bc/ 3782 abbbbc 3783 0: abbbbc 3784 3785/ab{3,4}bc/ 3786 abbbbc 3787 0: abbbbc 3788 3789/ab{4,5}bc/ 3790\= Expect no match 3791 abq 3792No match 3793 abbbbc 3794No match 3795 3796/ab?bc/ 3797 abbc 3798 0: abbc 3799 abc 3800 0: abc 3801 3802/ab{0,1}bc/ 3803 abc 3804 0: abc 3805 3806/ab?bc/ 3807 3808/ab?c/ 3809 abc 3810 0: abc 3811 3812/ab{0,1}c/ 3813 abc 3814 0: abc 3815 3816/^abc$/ 3817 abc 3818 0: abc 3819\= Expect no match 3820 abbbbc 3821No match 3822 abcc 3823No match 3824 3825/^abc/ 3826 abcc 3827 0: abc 3828 3829/^abc$/ 3830 3831/abc$/ 3832 aabc 3833 0: abc 3834\= Expect no match 3835 aabcd 3836No match 3837 3838/^/ 3839 abc 3840 0: 3841 3842/$/ 3843 abc 3844 0: 3845 3846/a.c/ 3847 abc 3848 0: abc 3849 axc 3850 0: axc 3851 3852/a.*c/ 3853 axyzc 3854 0: axyzc 3855 3856/a[bc]d/ 3857 abd 3858 0: abd 3859\= Expect no match 3860 axyzd 3861No match 3862 abc 3863No match 3864 3865/a[b-d]e/ 3866 ace 3867 0: ace 3868 3869/a[b-d]/ 3870 aac 3871 0: ac 3872 3873/a[-b]/ 3874 a- 3875 0: a- 3876 3877/a[b-]/ 3878 a- 3879 0: a- 3880 3881/a]/ 3882 a] 3883 0: a] 3884 3885/a[]]b/ 3886 a]b 3887 0: a]b 3888 3889/a[^bc]d/ 3890 aed 3891 0: aed 3892\= Expect no match 3893 abd 3894No match 3895 abd 3896No match 3897 3898/a[^-b]c/ 3899 adc 3900 0: adc 3901 3902/a[^]b]c/ 3903 adc 3904 0: adc 3905 a-c 3906 0: a-c 3907\= Expect no match 3908 a]c 3909No match 3910 3911/\ba\b/ 3912 a- 3913 0: a 3914 -a 3915 0: a 3916 -a- 3917 0: a 3918 3919/\by\b/ 3920\= Expect no match 3921 xy 3922No match 3923 yz 3924No match 3925 xyz 3926No match 3927 3928/\Ba\B/ 3929\= Expect no match 3930 a- 3931No match 3932 -a 3933No match 3934 -a- 3935No match 3936 3937/\By\b/ 3938 xy 3939 0: y 3940 3941/\by\B/ 3942 yz 3943 0: y 3944 3945/\By\B/ 3946 xyz 3947 0: y 3948 3949/\w/ 3950 a 3951 0: a 3952 3953/\W/ 3954 - 3955 0: - 3956\= Expect no match 3957 a 3958No match 3959 3960/a\sb/ 3961 a b 3962 0: a b 3963 3964/a\Sb/ 3965 a-b 3966 0: a-b 3967\= Expect no match 3968 a b 3969No match 3970 3971/\d/ 3972 1 3973 0: 1 3974 3975/\D/ 3976 - 3977 0: - 3978\= Expect no match 3979 1 3980No match 3981 3982/[\w]/ 3983 a 3984 0: a 3985 3986/[\W]/ 3987 - 3988 0: - 3989\= Expect no match 3990 a 3991No match 3992 3993/a[\s]b/ 3994 a b 3995 0: a b 3996 3997/a[\S]b/ 3998 a-b 3999 0: a-b 4000\= Expect no match 4001 a b 4002No match 4003 4004/[\d]/ 4005 1 4006 0: 1 4007 4008/[\D]/ 4009 - 4010 0: - 4011\= Expect no match 4012 1 4013No match 4014 4015/ab|cd/ 4016 abc 4017 0: ab 4018 abcd 4019 0: ab 4020 4021/()ef/ 4022 def 4023 0: ef 4024 1: 4025 4026/$b/ 4027 4028/a\(b/ 4029 a(b 4030 0: a(b 4031 4032/a\(*b/ 4033 ab 4034 0: ab 4035 a((b 4036 0: a((b 4037 4038/a\\b/ 4039 a\\b 4040 0: a\b 4041 4042/((a))/ 4043 abc 4044 0: a 4045 1: a 4046 2: a 4047 4048/(a)b(c)/ 4049 abc 4050 0: abc 4051 1: a 4052 2: c 4053 4054/a+b+c/ 4055 aabbabc 4056 0: abc 4057 4058/a{1,}b{1,}c/ 4059 aabbabc 4060 0: abc 4061 4062/a.+?c/ 4063 abcabc 4064 0: abc 4065 4066/(a+|b)*/ 4067 ab 4068 0: ab 4069 1: b 4070 4071/(a+|b){0,}/ 4072 ab 4073 0: ab 4074 1: b 4075 4076/(a+|b)+/ 4077 ab 4078 0: ab 4079 1: b 4080 4081/(a+|b){1,}/ 4082 ab 4083 0: ab 4084 1: b 4085 4086/(a+|b)?/ 4087 ab 4088 0: a 4089 1: a 4090 4091/(a+|b){0,1}/ 4092 ab 4093 0: a 4094 1: a 4095 4096/[^ab]*/ 4097 cde 4098 0: cde 4099 4100/abc/ 4101\= Expect no match 4102 b 4103No match 4104 4105/a*/ 4106 \ 4107 0: 4108 4109/([abc])*d/ 4110 abbbcd 4111 0: abbbcd 4112 1: c 4113 4114/([abc])*bcd/ 4115 abcd 4116 0: abcd 4117 1: a 4118 4119/a|b|c|d|e/ 4120 e 4121 0: e 4122 4123/(a|b|c|d|e)f/ 4124 ef 4125 0: ef 4126 1: e 4127 4128/abcd*efg/ 4129 abcdefg 4130 0: abcdefg 4131 4132/ab*/ 4133 xabyabbbz 4134 0: ab 4135 xayabbbz 4136 0: a 4137 4138/(ab|cd)e/ 4139 abcde 4140 0: cde 4141 1: cd 4142 4143/[abhgefdc]ij/ 4144 hij 4145 0: hij 4146 4147/^(ab|cd)e/ 4148 4149/(abc|)ef/ 4150 abcdef 4151 0: ef 4152 1: 4153 4154/(a|b)c*d/ 4155 abcd 4156 0: bcd 4157 1: b 4158 4159/(ab|ab*)bc/ 4160 abc 4161 0: abc 4162 1: a 4163 4164/a([bc]*)c*/ 4165 abc 4166 0: abc 4167 1: bc 4168 4169/a([bc]*)(c*d)/ 4170 abcd 4171 0: abcd 4172 1: bc 4173 2: d 4174 4175/a([bc]+)(c*d)/ 4176 abcd 4177 0: abcd 4178 1: bc 4179 2: d 4180 4181/a([bc]*)(c+d)/ 4182 abcd 4183 0: abcd 4184 1: b 4185 2: cd 4186 4187/a[bcd]*dcdcde/ 4188 adcdcde 4189 0: adcdcde 4190 4191/a[bcd]+dcdcde/ 4192\= Expect no match 4193 abcde 4194No match 4195 adcdcde 4196No match 4197 4198/(ab|a)b*c/ 4199 abc 4200 0: abc 4201 1: ab 4202 4203/((a)(b)c)(d)/ 4204 abcd 4205 0: abcd 4206 1: abc 4207 2: a 4208 3: b 4209 4: d 4210 4211/[a-zA-Z_][a-zA-Z0-9_]*/ 4212 alpha 4213 0: alpha 4214 4215/^a(bc+|b[eh])g|.h$/ 4216 abh 4217 0: bh 4218 4219/(bc+d$|ef*g.|h?i(j|k))/ 4220 effgz 4221 0: effgz 4222 1: effgz 4223 ij 4224 0: ij 4225 1: ij 4226 2: j 4227 reffgz 4228 0: effgz 4229 1: effgz 4230\= Expect no match 4231 effg 4232No match 4233 bcdd 4234No match 4235 4236/((((((((((a))))))))))/ 4237 a 4238 0: a 4239 1: a 4240 2: a 4241 3: a 4242 4: a 4243 5: a 4244 6: a 4245 7: a 4246 8: a 4247 9: a 424810: a 4249 4250/((((((((((a))))))))))\10/ 4251 aa 4252 0: aa 4253 1: a 4254 2: a 4255 3: a 4256 4: a 4257 5: a 4258 6: a 4259 7: a 4260 8: a 4261 9: a 426210: a 4263 4264/(((((((((a)))))))))/ 4265 a 4266 0: a 4267 1: a 4268 2: a 4269 3: a 4270 4: a 4271 5: a 4272 6: a 4273 7: a 4274 8: a 4275 9: a 4276 4277/multiple words of text/ 4278\= Expect no match 4279 aa 4280No match 4281 uh-uh 4282No match 4283 4284/multiple words/ 4285 multiple words, yeah 4286 0: multiple words 4287 4288/(.*)c(.*)/ 4289 abcde 4290 0: abcde 4291 1: ab 4292 2: de 4293 4294/\((.*), (.*)\)/ 4295 (a, b) 4296 0: (a, b) 4297 1: a 4298 2: b 4299 4300/[k]/ 4301 4302/abcd/ 4303 abcd 4304 0: abcd 4305 4306/a(bc)d/ 4307 abcd 4308 0: abcd 4309 1: bc 4310 4311/a[-]?c/ 4312 ac 4313 0: ac 4314 4315/(abc)\1/ 4316 abcabc 4317 0: abcabc 4318 1: abc 4319 4320/([a-c]*)\1/ 4321 abcabc 4322 0: abcabc 4323 1: abc 4324 4325/(a)|\1/ 4326 a 4327 0: a 4328 1: a 4329 ab 4330 0: a 4331 1: a 4332\= Expect no match 4333 x 4334No match 4335 4336/(([a-c])b*?\2)*/ 4337 ababbbcbc 4338 0: ababb 4339 1: bb 4340 2: b 4341 4342/(([a-c])b*?\2){3}/ 4343 ababbbcbc 4344 0: ababbbcbc 4345 1: cbc 4346 2: c 4347 4348/((\3|b)\2(a)x)+/ 4349 aaaxabaxbaaxbbax 4350 0: bbax 4351 1: bbax 4352 2: b 4353 3: a 4354 4355/((\3|b)\2(a)){2,}/ 4356 bbaababbabaaaaabbaaaabba 4357 0: bbaaaabba 4358 1: bba 4359 2: b 4360 3: a 4361 4362/abc/i 4363 ABC 4364 0: ABC 4365 XABCY 4366 0: ABC 4367 ABABC 4368 0: ABC 4369\= Expect no match 4370 aaxabxbaxbbx 4371No match 4372 XBC 4373No match 4374 AXC 4375No match 4376 ABX 4377No match 4378 4379/ab*c/i 4380 ABC 4381 0: ABC 4382 4383/ab*bc/i 4384 ABC 4385 0: ABC 4386 ABBC 4387 0: ABBC 4388 4389/ab*?bc/i 4390 ABBBBC 4391 0: ABBBBC 4392 4393/ab{0,}?bc/i 4394 ABBBBC 4395 0: ABBBBC 4396 4397/ab+?bc/i 4398 ABBC 4399 0: ABBC 4400 4401/ab+bc/i 4402\= Expect no match 4403 ABC 4404No match 4405 ABQ 4406No match 4407 4408/ab{1,}bc/i 4409 4410/ab+bc/i 4411 ABBBBC 4412 0: ABBBBC 4413 4414/ab{1,}?bc/i 4415 ABBBBC 4416 0: ABBBBC 4417 4418/ab{1,3}?bc/i 4419 ABBBBC 4420 0: ABBBBC 4421 4422/ab{3,4}?bc/i 4423 ABBBBC 4424 0: ABBBBC 4425 4426/ab{4,5}?bc/i 4427\= Expect no match 4428 ABQ 4429No match 4430 ABBBBC 4431No match 4432 4433/ab??bc/i 4434 ABBC 4435 0: ABBC 4436 ABC 4437 0: ABC 4438 4439/ab{0,1}?bc/i 4440 ABC 4441 0: ABC 4442 4443/ab??bc/i 4444 4445/ab??c/i 4446 ABC 4447 0: ABC 4448 4449/ab{0,1}?c/i 4450 ABC 4451 0: ABC 4452 4453/^abc$/i 4454 ABC 4455 0: ABC 4456\= Expect no match 4457 ABBBBC 4458No match 4459 ABCC 4460No match 4461 4462/^abc/i 4463 ABCC 4464 0: ABC 4465 4466/^abc$/i 4467 4468/abc$/i 4469 AABC 4470 0: ABC 4471 4472/^/i 4473 ABC 4474 0: 4475 4476/$/i 4477 ABC 4478 0: 4479 4480/a.c/i 4481 ABC 4482 0: ABC 4483 AXC 4484 0: AXC 4485 4486/a.*?c/i 4487 AXYZC 4488 0: AXYZC 4489 4490/a.*c/i 4491 AABC 4492 0: AABC 4493\= Expect no match 4494 AXYZD 4495No match 4496 4497/a[bc]d/i 4498 ABD 4499 0: ABD 4500 4501/a[b-d]e/i 4502 ACE 4503 0: ACE 4504\= Expect no match 4505 ABC 4506No match 4507 ABD 4508No match 4509 4510/a[b-d]/i 4511 AAC 4512 0: AC 4513 4514/a[-b]/i 4515 A- 4516 0: A- 4517 4518/a[b-]/i 4519 A- 4520 0: A- 4521 4522/a]/i 4523 A] 4524 0: A] 4525 4526/a[]]b/i 4527 A]B 4528 0: A]B 4529 4530/a[^bc]d/i 4531 AED 4532 0: AED 4533 4534/a[^-b]c/i 4535 ADC 4536 0: ADC 4537\= Expect no match 4538 ABD 4539No match 4540 A-C 4541No match 4542 4543/a[^]b]c/i 4544 ADC 4545 0: ADC 4546 4547/ab|cd/i 4548 ABC 4549 0: AB 4550 ABCD 4551 0: AB 4552 4553/()ef/i 4554 DEF 4555 0: EF 4556 1: 4557 4558/$b/i 4559\= Expect no match 4560 A]C 4561No match 4562 B 4563No match 4564 4565/a\(b/i 4566 A(B 4567 0: A(B 4568 4569/a\(*b/i 4570 AB 4571 0: AB 4572 A((B 4573 0: A((B 4574 4575/a\\b/i 4576 A\\b 4577 0: A\b 4578 a\\B 4579 0: a\B 4580 4581/((a))/i 4582 ABC 4583 0: A 4584 1: A 4585 2: A 4586 4587/(a)b(c)/i 4588 ABC 4589 0: ABC 4590 1: A 4591 2: C 4592 4593/a+b+c/i 4594 AABBABC 4595 0: ABC 4596 4597/a{1,}b{1,}c/i 4598 AABBABC 4599 0: ABC 4600 4601/a.+?c/i 4602 ABCABC 4603 0: ABC 4604 4605/a.*?c/i 4606 ABCABC 4607 0: ABC 4608 4609/a.{0,5}?c/i 4610 ABCABC 4611 0: ABC 4612 4613/(a+|b)*/i 4614 AB 4615 0: AB 4616 1: B 4617 4618/(a+|b){0,}/i 4619 AB 4620 0: AB 4621 1: B 4622 4623/(a+|b)+/i 4624 AB 4625 0: AB 4626 1: B 4627 4628/(a+|b){1,}/i 4629 AB 4630 0: AB 4631 1: B 4632 4633/(a+|b)?/i 4634 AB 4635 0: A 4636 1: A 4637 4638/(a+|b){0,1}/i 4639 AB 4640 0: A 4641 1: A 4642 4643/(a+|b){0,1}?/i 4644 AB 4645 0: 4646 4647/[^ab]*/i 4648 CDE 4649 0: CDE 4650 4651/([abc])*d/i 4652 ABBBCD 4653 0: ABBBCD 4654 1: C 4655 4656/([abc])*bcd/i 4657 ABCD 4658 0: ABCD 4659 1: A 4660 4661/a|b|c|d|e/i 4662 E 4663 0: E 4664 4665/(a|b|c|d|e)f/i 4666 EF 4667 0: EF 4668 1: E 4669 4670/abcd*efg/i 4671 ABCDEFG 4672 0: ABCDEFG 4673 4674/ab*/i 4675 XABYABBBZ 4676 0: AB 4677 XAYABBBZ 4678 0: A 4679 4680/(ab|cd)e/i 4681 ABCDE 4682 0: CDE 4683 1: CD 4684 4685/[abhgefdc]ij/i 4686 HIJ 4687 0: HIJ 4688 4689/^(ab|cd)e/i 4690\= Expect no match 4691 ABCDE 4692No match 4693 4694/(abc|)ef/i 4695 ABCDEF 4696 0: EF 4697 1: 4698 4699/(a|b)c*d/i 4700 ABCD 4701 0: BCD 4702 1: B 4703 4704/(ab|ab*)bc/i 4705 ABC 4706 0: ABC 4707 1: A 4708 4709/a([bc]*)c*/i 4710 ABC 4711 0: ABC 4712 1: BC 4713 4714/a([bc]*)(c*d)/i 4715 ABCD 4716 0: ABCD 4717 1: BC 4718 2: D 4719 4720/a([bc]+)(c*d)/i 4721 ABCD 4722 0: ABCD 4723 1: BC 4724 2: D 4725 4726/a([bc]*)(c+d)/i 4727 ABCD 4728 0: ABCD 4729 1: B 4730 2: CD 4731 4732/a[bcd]*dcdcde/i 4733 ADCDCDE 4734 0: ADCDCDE 4735 4736/a[bcd]+dcdcde/i 4737 4738/(ab|a)b*c/i 4739 ABC 4740 0: ABC 4741 1: AB 4742 4743/((a)(b)c)(d)/i 4744 ABCD 4745 0: ABCD 4746 1: ABC 4747 2: A 4748 3: B 4749 4: D 4750 4751/[a-zA-Z_][a-zA-Z0-9_]*/i 4752 ALPHA 4753 0: ALPHA 4754 4755/^a(bc+|b[eh])g|.h$/i 4756 ABH 4757 0: BH 4758 4759/(bc+d$|ef*g.|h?i(j|k))/i 4760 EFFGZ 4761 0: EFFGZ 4762 1: EFFGZ 4763 IJ 4764 0: IJ 4765 1: IJ 4766 2: J 4767 REFFGZ 4768 0: EFFGZ 4769 1: EFFGZ 4770\= Expect no match 4771 ADCDCDE 4772No match 4773 EFFG 4774No match 4775 BCDD 4776No match 4777 4778/((((((((((a))))))))))/i 4779 A 4780 0: A 4781 1: A 4782 2: A 4783 3: A 4784 4: A 4785 5: A 4786 6: A 4787 7: A 4788 8: A 4789 9: A 479010: A 4791 4792/((((((((((a))))))))))\10/i 4793 AA 4794 0: AA 4795 1: A 4796 2: A 4797 3: A 4798 4: A 4799 5: A 4800 6: A 4801 7: A 4802 8: A 4803 9: A 480410: A 4805 4806/(((((((((a)))))))))/i 4807 A 4808 0: A 4809 1: A 4810 2: A 4811 3: A 4812 4: A 4813 5: A 4814 6: A 4815 7: A 4816 8: A 4817 9: A 4818 4819/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i 4820 A 4821 0: A 4822 1: A 4823 4824/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i 4825 C 4826 0: C 4827 1: C 4828 4829/multiple words of text/i 4830\= Expect no match 4831 AA 4832No match 4833 UH-UH 4834No match 4835 4836/multiple words/i 4837 MULTIPLE WORDS, YEAH 4838 0: MULTIPLE WORDS 4839 4840/(.*)c(.*)/i 4841 ABCDE 4842 0: ABCDE 4843 1: AB 4844 2: DE 4845 4846/\((.*), (.*)\)/i 4847 (A, B) 4848 0: (A, B) 4849 1: A 4850 2: B 4851 4852/[k]/i 4853 4854/abcd/i 4855 ABCD 4856 0: ABCD 4857 4858/a(bc)d/i 4859 ABCD 4860 0: ABCD 4861 1: BC 4862 4863/a[-]?c/i 4864 AC 4865 0: AC 4866 4867/(abc)\1/i 4868 ABCABC 4869 0: ABCABC 4870 1: ABC 4871 4872/([a-c]*)\1/i 4873 ABCABC 4874 0: ABCABC 4875 1: ABC 4876 4877/a(?!b)./ 4878 abad 4879 0: ad 4880 4881/a(?=d)./ 4882 abad 4883 0: ad 4884 4885/a(?=c|d)./ 4886 abad 4887 0: ad 4888 4889/a(?:b|c|d)(.)/ 4890 ace 4891 0: ace 4892 1: e 4893 4894/a(?:b|c|d)*(.)/ 4895 ace 4896 0: ace 4897 1: e 4898 4899/a(?:b|c|d)+?(.)/ 4900 ace 4901 0: ace 4902 1: e 4903 acdbcdbe 4904 0: acd 4905 1: d 4906 4907/a(?:b|c|d)+(.)/ 4908 acdbcdbe 4909 0: acdbcdbe 4910 1: e 4911 4912/a(?:b|c|d){2}(.)/ 4913 acdbcdbe 4914 0: acdb 4915 1: b 4916 4917/a(?:b|c|d){4,5}(.)/ 4918 acdbcdbe 4919 0: acdbcdb 4920 1: b 4921 4922/a(?:b|c|d){4,5}?(.)/ 4923 acdbcdbe 4924 0: acdbcd 4925 1: d 4926 4927/a(?:b|c|d){6,7}(.)/ 4928 acdbcdbe 4929 0: acdbcdbe 4930 1: e 4931 4932/a(?:b|c|d){6,7}?(.)/ 4933 acdbcdbe 4934 0: acdbcdbe 4935 1: e 4936 4937/a(?:b|c|d){5,6}(.)/ 4938 acdbcdbe 4939 0: acdbcdbe 4940 1: e 4941 4942/a(?:b|c|d){5,6}?(.)/ 4943 acdbcdbe 4944 0: acdbcdb 4945 1: b 4946 4947/a(?:b|c|d){5,7}(.)/ 4948 acdbcdbe 4949 0: acdbcdbe 4950 1: e 4951 4952/a(?:b|c|d){5,7}?(.)/ 4953 acdbcdbe 4954 0: acdbcdb 4955 1: b 4956 4957/a(?:b|(c|e){1,2}?|d)+?(.)/ 4958 ace 4959 0: ace 4960 1: c 4961 2: e 4962 4963/^(.+)?B/ 4964 AB 4965 0: AB 4966 1: A 4967 4968/^([^a-z])|(\^)$/ 4969 . 4970 0: . 4971 1: . 4972 4973/^[<>]&/ 4974 <&OUT 4975 0: <& 4976 4977/^(a\1?){4}$/ 4978 aaaaaaaaaa 4979 0: aaaaaaaaaa 4980 1: aaaa 4981\= Expect no match 4982 AB 4983No match 4984 aaaaaaaaa 4985No match 4986 aaaaaaaaaaa 4987No match 4988 4989/^(a(?(1)\1)){4}$/ 4990 aaaaaaaaaa 4991 0: aaaaaaaaaa 4992 1: aaaa 4993\= Expect no match 4994 aaaaaaaaa 4995No match 4996 aaaaaaaaaaa 4997No match 4998 4999/(?<=a)b/ 5000 ab 5001 0: b 5002\= Expect no match 5003 cb 5004No match 5005 b 5006No match 5007 5008/(?<!c)b/ 5009 ab 5010 0: b 5011 b 5012 0: b 5013 b 5014 0: b 5015 5016/(?:..)*a/ 5017 aba 5018 0: aba 5019 5020/(?:..)*?a/ 5021 aba 5022 0: a 5023 5024/^(?:b|a(?=(.)))*\1/ 5025 abc 5026 0: ab 5027 1: b 5028 5029/^(){3,5}/ 5030 abc 5031 0: 5032 1: 5033 5034/^(a+)*ax/ 5035 aax 5036 0: aax 5037 1: a 5038 5039/^((a|b)+)*ax/ 5040 aax 5041 0: aax 5042 1: a 5043 2: a 5044 5045/^((a|bc)+)*ax/ 5046 aax 5047 0: aax 5048 1: a 5049 2: a 5050 5051/(a|x)*ab/ 5052 cab 5053 0: ab 5054 5055/(a)*ab/ 5056 cab 5057 0: ab 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 Ab 5070 0: Ab 5071 5072/((?i)a)b/ 5073 Ab 5074 0: Ab 5075 1: A 5076 5077/(?:(?i)a)b/ 5078\= Expect no match 5079 cb 5080No match 5081 aB 5082No match 5083 5084/((?i)a)b/ 5085 5086/(?i:a)b/ 5087 ab 5088 0: ab 5089 5090/((?i:a))b/ 5091 ab 5092 0: ab 5093 1: a 5094 5095/(?i:a)b/ 5096 Ab 5097 0: Ab 5098 5099/((?i:a))b/ 5100 Ab 5101 0: Ab 5102 1: A 5103 5104/(?i:a)b/ 5105\= Expect no match 5106 aB 5107No match 5108 aB 5109No match 5110 5111/((?i:a))b/ 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 aB 5124 0: aB 5125 5126/((?-i)a)b/i 5127 aB 5128 0: aB 5129 1: a 5130 5131/(?:(?-i)a)b/i 5132 aB 5133 0: aB 5134\= Expect no match 5135 Ab 5136No match 5137 AB 5138No match 5139 5140/(?-i:a)b/i 5141 ab 5142 0: ab 5143 5144/((?-i:a))b/i 5145 ab 5146 0: ab 5147 1: a 5148 5149/(?-i:a)b/i 5150 aB 5151 0: aB 5152 5153/((?-i:a))b/i 5154 aB 5155 0: aB 5156 1: a 5157 5158/(?-i:a)b/i 5159\= Expect no match 5160 AB 5161No match 5162 Ab 5163No match 5164 5165/((?-i:a))b/i 5166 5167/(?-i:a)b/i 5168 aB 5169 0: aB 5170 5171/((?-i:a))b/i 5172 aB 5173 0: aB 5174 1: a 5175 5176/(?-i:a)b/i 5177\= Expect no match 5178 Ab 5179No match 5180 AB 5181No match 5182 5183/((?-i:a))b/i 5184 5185/((?-i:a.))b/i 5186\= Expect no match 5187 AB 5188No match 5189 a\nB 5190No match 5191 5192/((?s-i:a.))b/i 5193 a\nB 5194 0: a\x0aB 5195 1: a\x0a 5196 5197/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/ 5198 cabbbb 5199 0: cabbbb 5200 5201/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/ 5202 caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 5203 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 5204 5205/(ab)\d\1/i 5206 Ab4ab 5207 0: Ab4ab 5208 1: Ab 5209 ab4Ab 5210 0: ab4Ab 5211 1: ab 5212 5213/foo\w*\d{4}baz/ 5214 foobar1234baz 5215 0: foobar1234baz 5216 5217/x(~~)*(?:(?:F)?)?/ 5218 x~~ 5219 0: x~~ 5220 1: ~~ 5221 5222/^a(?#xxx){3}c/ 5223 aaac 5224 0: aaac 5225 5226/^a (?#xxx) (?#yyy) {3}c/x 5227 aaac 5228 0: aaac 5229 5230/(?<![cd])b/ 5231\= Expect no match 5232 B\nB 5233No match 5234 dbcb 5235No match 5236 5237/(?<![cd])[ab]/ 5238 dbaacb 5239 0: a 5240 5241/(?<!(c|d))b/ 5242 5243/(?<!(c|d))[ab]/ 5244 dbaacb 5245 0: a 5246 5247/(?<!cd)[ab]/ 5248 cdaccb 5249 0: b 5250 5251/^(?:a?b?)*$/ 5252 \ 5253 0: 5254 a 5255 0: a 5256 ab 5257 0: ab 5258 aaa 5259 0: aaa 5260\= Expect no match 5261 dbcb 5262No match 5263 a-- 5264No match 5265 aa-- 5266No match 5267 5268/((?s)^a(.))((?m)^b$)/ 5269 a\nb\nc\n 5270 0: a\x0ab 5271 1: a\x0a 5272 2: \x0a 5273 3: b 5274 5275/((?m)^b$)/ 5276 a\nb\nc\n 5277 0: b 5278 1: b 5279 5280/(?m)^b/ 5281 a\nb\n 5282 0: b 5283 5284/(?m)^(b)/ 5285 a\nb\n 5286 0: b 5287 1: b 5288 5289/((?m)^b)/ 5290 a\nb\n 5291 0: b 5292 1: b 5293 5294/\n((?m)^b)/ 5295 a\nb\n 5296 0: \x0ab 5297 1: b 5298 5299/((?s).)c(?!.)/ 5300 a\nb\nc\n 5301 0: \x0ac 5302 1: \x0a 5303 a\nb\nc\n 5304 0: \x0ac 5305 1: \x0a 5306 5307/((?s)b.)c(?!.)/ 5308 a\nb\nc\n 5309 0: b\x0ac 5310 1: b\x0a 5311 a\nb\nc\n 5312 0: b\x0ac 5313 1: b\x0a 5314 5315/^b/ 5316 5317/()^b/ 5318\= Expect no match 5319 a\nb\nc\n 5320No match 5321 a\nb\nc\n 5322No match 5323 5324/((?m)^b)/ 5325 a\nb\nc\n 5326 0: b 5327 1: b 5328 5329/(x)?(?(1)a|b)/ 5330\= Expect no match 5331 a 5332No match 5333 a 5334No match 5335 5336/(x)?(?(1)b|a)/ 5337 a 5338 0: a 5339 5340/()?(?(1)b|a)/ 5341 a 5342 0: a 5343 5344/()(?(1)b|a)/ 5345 5346/()?(?(1)a|b)/ 5347 a 5348 0: a 5349 1: 5350 5351/^(\()?blah(?(1)(\)))$/ 5352 (blah) 5353 0: (blah) 5354 1: ( 5355 2: ) 5356 blah 5357 0: blah 5358\= Expect no match 5359 a 5360No match 5361 blah) 5362No match 5363 (blah 5364No match 5365 5366/^(\(+)?blah(?(1)(\)))$/ 5367 (blah) 5368 0: (blah) 5369 1: ( 5370 2: ) 5371 blah 5372 0: blah 5373\= Expect no match 5374 blah) 5375No match 5376 (blah 5377No match 5378 5379/(?(?!a)a|b)/ 5380 5381/(?(?!a)b|a)/ 5382 a 5383 0: a 5384 5385/(?(?=a)b|a)/ 5386\= Expect no match 5387 a 5388No match 5389 a 5390No match 5391 5392/(?(?=a)a|b)/ 5393 a 5394 0: a 5395 5396/(?=(a+?))(\1ab)/ 5397 aaab 5398 0: aab 5399 1: a 5400 2: aab 5401 5402/^(?=(a+?))\1ab/ 5403 5404/(\w+:)+/ 5405 one: 5406 0: one: 5407 1: one: 5408 5409/$(?<=^(a))/ 5410 a 5411 0: 5412 1: a 5413 5414/(?=(a+?))(\1ab)/ 5415 aaab 5416 0: aab 5417 1: a 5418 2: aab 5419 5420/^(?=(a+?))\1ab/ 5421\= Expect no match 5422 aaab 5423No match 5424 aaab 5425No match 5426 5427/([\w:]+::)?(\w+)$/ 5428 abcd 5429 0: abcd 5430 1: <unset> 5431 2: abcd 5432 xy:z:::abcd 5433 0: xy:z:::abcd 5434 1: xy:z::: 5435 2: abcd 5436 5437/^[^bcd]*(c+)/ 5438 aexycd 5439 0: aexyc 5440 1: c 5441 5442/(a*)b+/ 5443 caab 5444 0: aab 5445 1: aa 5446 5447/([\w:]+::)?(\w+)$/ 5448 abcd 5449 0: abcd 5450 1: <unset> 5451 2: abcd 5452 xy:z:::abcd 5453 0: xy:z:::abcd 5454 1: xy:z::: 5455 2: abcd 5456\= Expect no match 5457 abcd: 5458No match 5459 abcd: 5460No match 5461 5462/^[^bcd]*(c+)/ 5463 aexycd 5464 0: aexyc 5465 1: c 5466 5467/(>a+)ab/ 5468 5469/(?>a+)b/ 5470 aaab 5471 0: aaab 5472 5473/([[:]+)/ 5474 a:[b]: 5475 0: :[ 5476 1: :[ 5477 5478/([[=]+)/ 5479 a=[b]= 5480 0: =[ 5481 1: =[ 5482 5483/([[.]+)/ 5484 a.[b]. 5485 0: .[ 5486 1: .[ 5487 5488/((?>a+)b)/ 5489 aaab 5490 0: aaab 5491 1: aaab 5492 5493/(?>(a+))b/ 5494 aaab 5495 0: aaab 5496 1: aaa 5497 5498/((?>[^()]+)|\([^()]*\))+/ 5499 ((abc(ade)ufh()()x 5500 0: abc(ade)ufh()()x 5501 1: x 5502 5503/a\Z/ 5504\= Expect no match 5505 aaab 5506No match 5507 a\nb\n 5508No match 5509 5510/b\Z/ 5511 a\nb\n 5512 0: b 5513 5514/b\z/ 5515 5516/b\Z/ 5517 a\nb 5518 0: b 5519 5520/b\z/ 5521 a\nb 5522 0: b 5523 5524/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/ 5525 a 5526 0: a 5527 1: 5528 abc 5529 0: abc 5530 1: 5531 a-b 5532 0: a-b 5533 1: 5534 0-9 5535 0: 0-9 5536 1: 5537 a.b 5538 0: a.b 5539 1: 5540 5.6.7 5541 0: 5.6.7 5542 1: 5543 the.quick.brown.fox 5544 0: the.quick.brown.fox 5545 1: 5546 a100.b200.300c 5547 0: a100.b200.300c 5548 1: 5549 12-ab.1245 5550 0: 12-ab.1245 5551 1: 5552\= Expect no match 5553 \ 5554No match 5555 .a 5556No match 5557 -a 5558No match 5559 a- 5560No match 5561 a. 5562No match 5563 a_b 5564No match 5565 a.- 5566No match 5567 a.. 5568No match 5569 ab..bc 5570No match 5571 the.quick.brown.fox- 5572No match 5573 the.quick.brown.fox. 5574No match 5575 the.quick.brown.fox_ 5576No match 5577 the.quick.brown.fox+ 5578No match 5579 5580/(?>.*)(?<=(abcd|wxyz))/ 5581 alphabetabcd 5582 0: alphabetabcd 5583 1: abcd 5584 endingwxyz 5585 0: endingwxyz 5586 1: wxyz 5587\= Expect no match 5588 a rather long string that doesn't end with one of them 5589No match 5590 5591/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/ 5592 word cat dog elephant mussel cow horse canary baboon snake shark otherword 5593 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword 5594\= Expect no match 5595 word cat dog elephant mussel cow horse canary baboon snake shark 5596No match 5597 5598/word (?>[a-zA-Z0-9]+ ){0,30}otherword/ 5599\= Expect no match 5600 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 5601No match 5602 5603/(?<=\d{3}(?!999))foo/ 5604 999foo 5605 0: foo 5606 123999foo 5607 0: foo 5608\= Expect no match 5609 123abcfoo 5610No match 5611 5612/(?<=(?!...999)\d{3})foo/ 5613 999foo 5614 0: foo 5615 123999foo 5616 0: foo 5617\= Expect no match 5618 123abcfoo 5619No match 5620 5621/(?<=\d{3}(?!999)...)foo/ 5622 123abcfoo 5623 0: foo 5624 123456foo 5625 0: foo 5626\= Expect no match 5627 123999foo 5628No match 5629 5630/(?<=\d{3}...)(?<!999)foo/ 5631 123abcfoo 5632 0: foo 5633 123456foo 5634 0: foo 5635\= Expect no match 5636 123999foo 5637No match 5638 5639/<a[\s]+href[\s]*=[\s]* # find <a href= 5640 ([\"\'])? # find single or double quote 5641 (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching 5642 # quote, otherwise match up to next space 5643/isx 5644 <a href=abcd xyz 5645 0: <a href=abcd 5646 1: <unset> 5647 2: <unset> 5648 3: abcd 5649 <a href=\"abcd xyz pqr\" cats 5650 0: <a href="abcd xyz pqr" 5651 1: " 5652 2: abcd xyz pqr 5653 <a href=\'abcd xyz pqr\' cats 5654 0: <a href='abcd xyz pqr' 5655 1: ' 5656 2: abcd xyz pqr 5657 5658/<a\s+href\s*=\s* # find <a href= 5659 (["'])? # find single or double quote 5660 (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching 5661 # quote, otherwise match up to next space 5662/isx 5663 <a href=abcd xyz 5664 0: <a href=abcd 5665 1: <unset> 5666 2: <unset> 5667 3: abcd 5668 <a href=\"abcd xyz pqr\" cats 5669 0: <a href="abcd xyz pqr" 5670 1: " 5671 2: abcd xyz pqr 5672 <a href = \'abcd xyz pqr\' cats 5673 0: <a href = 'abcd xyz pqr' 5674 1: ' 5675 2: abcd xyz pqr 5676 5677/<a\s+href(?>\s*)=(?>\s*) # find <a href= 5678 (["'])? # find single or double quote 5679 (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching 5680 # quote, otherwise match up to next space 5681/isx 5682 <a href=abcd xyz 5683 0: <a href=abcd 5684 1: <unset> 5685 2: <unset> 5686 3: abcd 5687 <a href=\"abcd xyz pqr\" cats 5688 0: <a href="abcd xyz pqr" 5689 1: " 5690 2: abcd xyz pqr 5691 <a href = \'abcd xyz pqr\' cats 5692 0: <a href = 'abcd xyz pqr' 5693 1: ' 5694 2: abcd xyz pqr 5695 5696/(Z()|A)*/ 5697 ZABCDEFG 5698 0: ZA 5699 1: A 5700 2: 5701 5702/(Z(())|A)*/ 5703 ZABCDEFG 5704 0: ZA 5705 1: A 5706 2: 5707 3: 5708 5709/((?>Z)+|A)*/ 5710 ZABCDEFG 5711 0: ZA 5712 1: A 5713 5714/((?>)+|A)*/ 5715 ZABCDEFG 5716 0: 5717 1: 5718 5719/a*/g 5720 abbab 5721 0: a 5722 0: 5723 0: 5724 0: a 5725 0: 5726 0: 5727 5728/[[:space:]]+/ 5729 > \x09\x0a\x0c\x0d\x0b< 5730 0: \x09\x0a\x0c\x0d\x0b 5731 5732/[[:blank:]]+/ 5733 > \x09\x0a\x0c\x0d\x0b< 5734 0: \x09 5735 5736/[\s]+/ 5737 > \x09\x0a\x0c\x0d\x0b< 5738 0: \x09\x0a\x0c\x0d\x0b 5739 5740/\s+/ 5741 > \x09\x0a\x0c\x0d\x0b< 5742 0: \x09\x0a\x0c\x0d\x0b 5743 5744/ab/x 5745 ab 5746 0: ab 5747 5748/(?!\A)x/m 5749 a\nxb\n 5750 0: x 5751 5752/(?!^)x/m 5753\= Expect no match 5754 a\nxb\n 5755No match 5756 5757/abc\Qabc\Eabc/ 5758 abcabcabc 5759 0: abcabcabc 5760 5761/abc\Q(*+|\Eabc/ 5762 abc(*+|abc 5763 0: abc(*+|abc 5764 5765/ abc\Q abc\Eabc/x 5766 abc abcabc 5767 0: abc abcabc 5768\= Expect no match 5769 abcabcabc 5770No match 5771 5772/abc#comment 5773 \Q#not comment 5774 literal\E/x 5775 abc#not comment\n literal 5776 0: abc#not comment\x0a literal 5777 5778/abc#comment 5779 \Q#not comment 5780 literal/x 5781 abc#not comment\n literal 5782 0: abc#not comment\x0a literal 5783 5784/abc#comment 5785 \Q#not comment 5786 literal\E #more comment 5787 /x 5788 abc#not comment\n literal 5789 0: abc#not comment\x0a literal 5790 5791/abc#comment 5792 \Q#not comment 5793 literal\E #more comment/x 5794 abc#not comment\n literal 5795 0: abc#not comment\x0a literal 5796 5797/\Qabc\$xyz\E/ 5798 abc\\\$xyz 5799 0: abc\$xyz 5800 5801/\Qabc\E\$\Qxyz\E/ 5802 abc\$xyz 5803 0: abc$xyz 5804 5805/\Gabc/ 5806 abc 5807 0: abc 5808\= Expect no match 5809 xyzabc 5810No match 5811 5812/\Gabc./g 5813 abc1abc2xyzabc3 5814 0: abc1 5815 0: abc2 5816 5817/abc./g 5818 abc1abc2xyzabc3 5819 0: abc1 5820 0: abc2 5821 0: abc3 5822 5823/a(?x: b c )d/ 5824 XabcdY 5825 0: abcd 5826\= Expect no match 5827 Xa b c d Y 5828No match 5829 5830/((?x)x y z | a b c)/ 5831 XabcY 5832 0: abc 5833 1: abc 5834 AxyzB 5835 0: xyz 5836 1: xyz 5837 5838/(?i)AB(?-i)C/ 5839 XabCY 5840 0: abC 5841\= Expect no match 5842 XabcY 5843No match 5844 5845/((?i)AB(?-i)C|D)E/ 5846 abCE 5847 0: abCE 5848 1: abC 5849 DE 5850 0: DE 5851 1: D 5852\= Expect no match 5853 abcE 5854No match 5855 abCe 5856No match 5857 dE 5858No match 5859 De 5860No match 5861 5862/(.*)\d+\1/ 5863 abc123abc 5864 0: abc123abc 5865 1: abc 5866 abc123bc 5867 0: bc123bc 5868 1: bc 5869 5870/(.*)\d+\1/s 5871 abc123abc 5872 0: abc123abc 5873 1: abc 5874 abc123bc 5875 0: bc123bc 5876 1: bc 5877 5878/((.*))\d+\1/ 5879 abc123abc 5880 0: abc123abc 5881 1: abc 5882 2: abc 5883 abc123bc 5884 0: bc123bc 5885 1: bc 5886 2: bc 5887 5888# This tests for an IPv6 address in the form where it can have up to 5889# eight components, one and only one of which is empty. This must be 5890# an internal component. 5891 5892/^(?!:) # colon disallowed at start 5893 (?: # start of item 5894 (?: [0-9a-f]{1,4} | # 1-4 hex digits or 5895 (?(1)0 | () ) ) # if null previously matched, fail; else null 5896 : # followed by colon 5897 ){1,7} # end item; 1-7 of them required 5898 [0-9a-f]{1,4} $ # final hex number at end of string 5899 (?(1)|.) # check that there was an empty component 5900 /ix 5901 a123::a123 5902 0: a123::a123 5903 1: 5904 a123:b342::abcd 5905 0: a123:b342::abcd 5906 1: 5907 a123:b342::324e:abcd 5908 0: a123:b342::324e:abcd 5909 1: 5910 a123:ddde:b342::324e:abcd 5911 0: a123:ddde:b342::324e:abcd 5912 1: 5913 a123:ddde:b342::324e:dcba:abcd 5914 0: a123:ddde:b342::324e:dcba:abcd 5915 1: 5916 a123:ddde:9999:b342::324e:dcba:abcd 5917 0: a123:ddde:9999:b342::324e:dcba:abcd 5918 1: 5919\= Expect no match 5920 1:2:3:4:5:6:7:8 5921No match 5922 a123:bce:ddde:9999:b342::324e:dcba:abcd 5923No match 5924 a123::9999:b342::324e:dcba:abcd 5925No match 5926 abcde:2:3:4:5:6:7:8 5927No match 5928 ::1 5929No match 5930 abcd:fee0:123:: 5931No match 5932 :1 5933No match 5934 1: 5935No match 5936 5937/[z\Qa-d]\E]/ 5938 z 5939 0: z 5940 a 5941 0: a 5942 - 5943 0: - 5944 d 5945 0: d 5946 ] 5947 0: ] 5948\= Expect no match 5949 b 5950No match 5951 5952/(a+)*b/ 5953\= Expect no match 5954 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 5955No match 5956 5957/(?i)reg(?:ul(?:[a�]|ae)r|ex)/ 5958 REGular 5959 0: REGular 5960 regulaer 5961 0: regulaer 5962 Regex 5963 0: Regex 5964 regul�r 5965 0: regul\xe4r 5966 5967/����[�-��-�]+/ 5968 ����� 5969 0: \xc5\xe6\xe5\xe4\xe0 5970 ����� 5971 0: \xc5\xe6\xe5\xe4\xff 5972 ����� 5973 0: \xc5\xe6\xe5\xe4\xc0 5974 ����� 5975 0: \xc5\xe6\xe5\xe4\xdf 5976 5977/(?<=Z)X./ 5978 \x84XAZXB 5979 0: XB 5980 5981/ab cd (?x) de fg/ 5982 ab cd defg 5983 0: ab cd defg 5984 5985/ab cd(?x) de fg/ 5986 ab cddefg 5987 0: ab cddefg 5988\= Expect no match 5989 abcddefg 5990No match 5991 5992/(?<![^f]oo)(bar)/ 5993 foobarX 5994 0: bar 5995 1: bar 5996\= Expect no match 5997 boobarX 5998No match 5999 6000/(?<![^f])X/ 6001 offX 6002 0: X 6003\= Expect no match 6004 onyX 6005No match 6006 6007/(?<=[^f])X/ 6008 onyX 6009 0: X 6010\= Expect no match 6011 offX 6012No match 6013 6014/^/gm 6015 a\nb\nc\n 6016 0: 6017 0: 6018 0: 6019 \ 6020 0: 6021 6022/(?<=C\n)^/gm 6023 A\nC\nC\n 6024 0: 6025 6026/(?:(?(1)a|b)(X))+/ 6027 bXaX 6028 0: bXaX 6029 1: X 6030 6031/(?:(?(1)\1a|b)(X|Y))+/ 6032 bXXaYYaY 6033 0: bXXaYYaY 6034 1: Y 6035 bXYaXXaX 6036 0: bX 6037 1: X 6038 6039/()()()()()()()()()(?:(?(10)\10a|b)(X|Y))+/ 6040 bXXaYYaY 6041 0: bX 6042 1: 6043 2: 6044 3: 6045 4: 6046 5: 6047 6: 6048 7: 6049 8: 6050 9: 605110: X 6052 6053/[[,abc,]+]/ 6054 abc] 6055 0: abc] 6056 a,b] 6057 0: a,b] 6058 [a,b,c] 6059 0: [a,b,c] 6060 6061/(?-x: )/x 6062 A\x20B 6063 0: 6064 6065/(?x)(?-x: \s*#\s*)/ 6066 A # B 6067 0: # 6068\= Expect no match 6069 # 6070No match 6071 A s#s B 6072No match 6073 6074/(?x-is)(?:(?-ixs) \s*#\s*) include/ 6075 A #include 6076 0: #include 6077\= Expect no match 6078 A#include 6079No match 6080 A #Include 6081No match 6082 6083/a*b*\w/ 6084 aaabbbb 6085 0: aaabbbb 6086 aaaa 6087 0: aaaa 6088 a 6089 0: a 6090 6091/a*b?\w/ 6092 aaabbbb 6093 0: aaabb 6094 aaaa 6095 0: aaaa 6096 a 6097 0: a 6098 6099/a*b{0,4}\w/ 6100 aaabbbb 6101 0: aaabbbb 6102 aaaa 6103 0: aaaa 6104 a 6105 0: a 6106 6107/a*b{0,}\w/ 6108 aaabbbb 6109 0: aaabbbb 6110 aaaa 6111 0: aaaa 6112 a 6113 0: a 6114 6115/a*\d*\w/ 6116 0a 6117 0: 0a 6118 a 6119 0: a 6120 6121/a*b *\w/x 6122 a 6123 0: a 6124 6125/a*b#comment 6126 *\w/x 6127 a 6128 0: a 6129 6130/a* b *\w/x 6131 a 6132 0: a 6133 6134/^\w+=.*(\\\n.*)*/ 6135 abc=xyz\\\npqr 6136 0: abc=xyz\ 6137 6138/(?=(\w+))\1:/ 6139 abcd: 6140 0: abcd: 6141 1: abcd 6142 6143/^(?=(\w+))\1:/ 6144 abcd: 6145 0: abcd: 6146 1: abcd 6147 6148/^\Eabc/ 6149 abc 6150 0: abc 6151 6152/^[\Eabc]/ 6153 a 6154 0: a 6155\= Expect no match 6156 E 6157No match 6158 6159/^[a-\Ec]/ 6160 b 6161 0: b 6162\= Expect no match 6163 - 6164No match 6165 E 6166No match 6167 6168/^[a\E\E-\Ec]/ 6169 b 6170 0: b 6171\= Expect no match 6172 - 6173No match 6174 E 6175No match 6176 6177/^[\E\Qa\E-\Qz\E]+/ 6178 b 6179 0: b 6180\= Expect no match 6181 - 6182No match 6183 6184/^[a\Q]bc\E]/ 6185 a 6186 0: a 6187 ] 6188 0: ] 6189 c 6190 0: c 6191 6192/^[a-\Q\E]/ 6193 a 6194 0: a 6195 - 6196 0: - 6197 6198/^(a()*)*/ 6199 aaaa 6200 0: aaaa 6201 1: a 6202 2: 6203 6204/^(?:a(?:(?:))*)*/ 6205 aaaa 6206 0: aaaa 6207 6208/^(a()+)+/ 6209 aaaa 6210 0: aaaa 6211 1: a 6212 2: 6213 6214/^(?:a(?:(?:))+)+/ 6215 aaaa 6216 0: aaaa 6217 6218/(a){0,3}(?(1)b|(c|))*D/ 6219 abbD 6220 0: abbD 6221 1: a 6222 ccccD 6223 0: ccccD 6224 1: <unset> 6225 2: 6226 D 6227 0: D 6228 1: <unset> 6229 2: 6230 6231/(a|)*\d/ 6232 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6233 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6234 1: 6235\= Expect no match 6236 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 6237No match 6238 6239/(?>a|)*\d/ 6240 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6241 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6242\= Expect no match 6243 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 6244No match 6245 6246/(?:a|)*\d/ 6247 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6248 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 6249\= Expect no match 6250 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 6251No match 6252 6253/\Z/g 6254 abc\n 6255 0: 6256 0: 6257 6258/^(?s)(?>.*)(?<!\n)/ 6259 abc 6260 0: abc 6261\= Expect no match 6262 abc\n 6263No match 6264 6265/^(?![^\n]*\n\z)/ 6266 abc 6267 0: 6268\= Expect no match 6269 abc\n 6270No match 6271 6272/\z(?<!\n)/ 6273 abc 6274 0: 6275\= Expect no match 6276 abc\n 6277No match 6278 6279/(.*(.)?)*/ 6280 abcd 6281 0: abcd 6282 1: 6283 6284/( (A | (?(1)0|) )* )/x 6285 abcd 6286 0: 6287 1: 6288 2: 6289 6290/( ( (?(1)0|) )* )/x 6291 abcd 6292 0: 6293 1: 6294 2: 6295 6296/( (?(1)0|)* )/x 6297 abcd 6298 0: 6299 1: 6300 6301/[[:abcd:xyz]]/ 6302 a] 6303 0: a] 6304 :] 6305 0: :] 6306 6307/[abc[:x\]pqr]/ 6308 a 6309 0: a 6310 [ 6311 0: [ 6312 : 6313 0: : 6314 ] 6315 0: ] 6316 p 6317 0: p 6318 6319/.*[op][xyz]/ 6320\= Expect no match 6321 fooabcfoo 6322No match 6323 6324/(?(?=.*b)b|^)/ 6325 adc 6326 0: 6327 abc 6328 0: b 6329 6330/(?(?=^.*b)b|^)/ 6331 adc 6332 0: 6333\= Expect no match 6334 abc 6335No match 6336 6337/(?(?=.*b)b|^)*/ 6338 adc 6339 0: 6340 abc 6341 0: 6342 6343/(?(?=.*b)b|^)+/ 6344 adc 6345 0: 6346 abc 6347 0: b 6348 6349/(?(?=b).*b|^d)/ 6350 abc 6351 0: b 6352 6353/(?(?=.*b).*b|^d)/ 6354 abc 6355 0: ab 6356 6357/^%((?(?=[a])[^%])|b)*%$/ 6358 %ab% 6359 0: %ab% 6360 1: 6361 6362/(?i)a(?-i)b|c/ 6363 XabX 6364 0: ab 6365 XAbX 6366 0: Ab 6367 CcC 6368 0: c 6369\= Expect no match 6370 XABX 6371No match 6372 6373/[\x00-\xff\s]+/ 6374 \x0a\x0b\x0c\x0d 6375 0: \x0a\x0b\x0c\x0d 6376 6377/(abc)\1/i 6378\= Expect no match 6379 abc 6380No match 6381 6382/(abc)\1/ 6383\= Expect no match 6384 abc 6385No match 6386 6387/[^a]*/i 6388 12abc 6389 0: 12 6390 12ABC 6391 0: 12 6392 6393/[^a]*+/i 6394 12abc 6395 0: 12 6396 12ABC 6397 0: 12 6398 6399/[^a]*?X/i 6400\= Expect no match 6401 12abc 6402No match 6403 12ABC 6404No match 6405 6406/[^a]+?X/i 6407\= Expect no match 6408 12abc 6409No match 6410 12ABC 6411No match 6412 6413/[^a]?X/i 6414 12aXbcX 6415 0: X 6416 12AXBCX 6417 0: X 6418 BCX 6419 0: CX 6420 6421/[^a]??X/i 6422 12aXbcX 6423 0: X 6424 12AXBCX 6425 0: X 6426 BCX 6427 0: CX 6428 6429/[^a]?+X/i 6430 12aXbcX 6431 0: cX 6432 12AXBCX 6433 0: CX 6434 BCX 6435 0: CX 6436 6437/[^a]{2,3}/i 6438 abcdef 6439 0: bcd 6440 ABCDEF 6441 0: BCD 6442 6443/[^a]{2,3}?/i 6444 abcdef 6445 0: bc 6446 ABCDEF 6447 0: BC 6448 6449/[^a]{2,3}+/i 6450 abcdef 6451 0: bcd 6452 ABCDEF 6453 0: BCD 6454 6455/((a|)+)+Z/ 6456 Z 6457 0: Z 6458 1: 6459 2: 6460 6461/(a)b|(a)c/ 6462 ac 6463 0: ac 6464 1: <unset> 6465 2: a 6466 6467/(?>(a))b|(a)c/ 6468 ac 6469 0: ac 6470 1: <unset> 6471 2: a 6472 6473/(?=(a))ab|(a)c/ 6474 ac 6475 0: ac 6476 1: <unset> 6477 2: a 6478 6479/((?>(a))b|(a)c)/ 6480 ac 6481 0: ac 6482 1: ac 6483 2: <unset> 6484 3: a 6485 6486/((?>(a))b|(a)c)++/ 6487 ac 6488 0: ac 6489 1: ac 6490 2: <unset> 6491 3: a 6492 6493/(?:(?>(a))b|(a)c)++/ 6494 ac 6495 0: ac 6496 1: <unset> 6497 2: a 6498 6499/(?=(?>(a))b|(a)c)(..)/ 6500 ac 6501 0: ac 6502 1: <unset> 6503 2: a 6504 3: ac 6505 6506/(?>(?>(a))b|(a)c)/ 6507 ac 6508 0: ac 6509 1: <unset> 6510 2: a 6511 6512/(?:(?>([ab])))+a=/aftertext 6513 =ba= 6514 0: ba= 6515 0+ 6516 1: b 6517 6518/(?>([ab]))+a=/aftertext 6519 =ba= 6520 0: ba= 6521 0+ 6522 1: b 6523 6524/((?>(a+)b)+(aabab))/ 6525 aaaabaaabaabab 6526 0: aaaabaaabaabab 6527 1: aaaabaaabaabab 6528 2: aaa 6529 3: aabab 6530 6531/(?>a+|ab)+?c/ 6532\= Expect no match 6533 aabc 6534No match 6535 6536/(?>a+|ab)+c/ 6537\= Expect no match 6538 aabc 6539No match 6540 6541/(?:a+|ab)+c/ 6542 aabc 6543 0: aabc 6544 6545/(?(?=(a))a)/ 6546 a 6547 0: a 6548 1: a 6549 6550/(?(?=(a))a)(b)/ 6551 ab 6552 0: ab 6553 1: a 6554 2: b 6555 6556/^(?:a|ab)++c/ 6557\= Expect no match 6558 aaaabc 6559No match 6560 6561/^(?>a|ab)++c/ 6562\= Expect no match 6563 aaaabc 6564No match 6565 6566/^(?:a|ab)+c/ 6567 aaaabc 6568 0: aaaabc 6569 6570/(?=abc){3}abc/aftertext 6571 abcabcabc 6572 0: abc 6573 0+ abcabc 6574\= Expect no match 6575 xyz 6576No match 6577 6578/(?=abc)+abc/aftertext 6579 abcabcabc 6580 0: abc 6581 0+ abcabc 6582\= Expect no match 6583 xyz 6584No match 6585 6586/(?=abc)++abc/aftertext 6587 abcabcabc 6588 0: abc 6589 0+ abcabc 6590\= Expect no match 6591 xyz 6592No match 6593 6594/(?=abc){0}xyz/ 6595 xyz 6596 0: xyz 6597 6598/(?=abc){1}xyz/ 6599\= Expect no match 6600 xyz 6601No match 6602 6603/(?=(a))?./ 6604 ab 6605 0: a 6606 1: a 6607 bc 6608 0: b 6609 6610/(?=(a))??./ 6611 ab 6612 0: a 6613 bc 6614 0: b 6615 6616/^(?=(?1))?[az]([abc])d/ 6617 abd 6618 0: abd 6619 1: b 6620 zcdxx 6621 0: zcd 6622 1: c 6623 6624/^(?!a){0}\w+/ 6625 aaaaa 6626 0: aaaaa 6627 6628/(?<=(abc))?xyz/ 6629 abcxyz 6630 0: xyz 6631 1: abc 6632 pqrxyz 6633 0: xyz 6634 6635/^[\g<a>]+/ 6636 ggg<<<aaa>>> 6637 0: ggg<<<aaa>>> 6638\= Expect no match 6639 \\ga 6640No match 6641 6642/^[\ga]+/ 6643 gggagagaxyz 6644 0: gggagaga 6645 6646/^[:a[:digit:]]+/ 6647 aaaa444:::Z 6648 0: aaaa444::: 6649 6650/^[:a[:digit:]:b]+/ 6651 aaaa444:::bbbZ 6652 0: aaaa444:::bbb 6653 6654/[:a]xxx[b:]/ 6655 :xxx: 6656 0: :xxx: 6657 6658/(?<=a{2})b/i 6659 xaabc 6660 0: b 6661\= Expect no match 6662 xabc 6663No match 6664 6665/(?<!a{2})b/i 6666 xabc 6667 0: b 6668\= Expect no match 6669 xaabc 6670No match 6671 6672/(?<=a\h)c/ 6673 xa c 6674 0: c 6675 6676/(?<=[^a]{2})b/ 6677 axxbc 6678 0: b 6679 aAAbc 6680 0: b 6681\= Expect no match 6682 xaabc 6683No match 6684 6685/(?<=[^a]{2})b/i 6686 axxbc 6687 0: b 6688\= Expect no match 6689 aAAbc 6690No match 6691 xaabc 6692No match 6693 6694/(?<=a\H)c/ 6695 abc 6696 0: c 6697 6698/(?<=a\V)c/ 6699 abc 6700 0: c 6701 6702/(?<=a\v)c/ 6703 a\nc 6704 0: c 6705 6706/(?(?=c)c|d)++Y/ 6707 XcccddYX 6708 0: cccddY 6709 6710/(?(?=c)c|d)*+Y/ 6711 XcccddYX 6712 0: cccddY 6713 6714/^(a{2,3}){2,}+a/ 6715 aaaaaaa 6716 0: aaaaaaa 6717 1: aaa 6718\= Expect no match 6719 aaaaaa 6720No match 6721 aaaaaaaaa 6722No match 6723 6724/^(a{2,3})++a/ 6725\= Expect no match 6726 aaaaaa 6727No match 6728 6729/^(a{2,3})*+a/ 6730\= Expect no match 6731 aaaaaa 6732No match 6733 6734/\H\h\V\v/ 6735 X X\x0a 6736 0: X X\x0a 6737 X\x09X\x0b 6738 0: X\x09X\x0b 6739\= Expect no match 6740 \xa0 X\x0a 6741No match 6742 6743/\H*\h+\V?\v{3,4}/ 6744 \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a 6745 0: \x09 \xa0X\x0a\x0b\x0c\x0d 6746 \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a 6747 0: \x09 \xa0\x0a\x0b\x0c\x0d 6748 \x09\x20\xa0\x0a\x0b\x0c 6749 0: \x09 \xa0\x0a\x0b\x0c 6750\= Expect no match 6751 \x09\x20\xa0\x0a\x0b 6752No match 6753 6754/\H{3,4}/ 6755 XY ABCDE 6756 0: ABCD 6757 XY PQR ST 6758 0: PQR 6759 6760/.\h{3,4}./ 6761 XY AB PQRS 6762 0: B P 6763 6764/\h*X\h?\H+Y\H?Z/ 6765 >XNNNYZ 6766 0: XNNNYZ 6767 > X NYQZ 6768 0: X NYQZ 6769\= Expect no match 6770 >XYZ 6771No match 6772 > X NY Z 6773No match 6774 6775/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/ 6776 >XY\x0aZ\x0aA\x0bNN\x0c 6777 0: XY\x0aZ\x0aA\x0bNN\x0c 6778 >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c 6779 0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c 6780 6781/(foo)\Kbar/ 6782 foobar 6783 0: bar 6784 1: foo 6785 6786/(foo)(\Kbar|baz)/ 6787 foobar 6788 0: bar 6789 1: foo 6790 2: bar 6791 foobaz 6792 0: foobaz 6793 1: foo 6794 2: baz 6795 6796/(foo\Kbar)baz/ 6797 foobarbaz 6798 0: barbaz 6799 1: foobar 6800 6801/abc\K|def\K/g,aftertext 6802 Xabcdefghi 6803 0: 6804 0+ defghi 6805 0: 6806 0+ ghi 6807 6808/ab\Kc|de\Kf/g,aftertext 6809 Xabcdefghi 6810 0: c 6811 0+ defghi 6812 0: f 6813 0+ ghi 6814 6815/(?=C)/g,aftertext 6816 ABCDECBA 6817 0: 6818 0+ CDECBA 6819 0: 6820 0+ CBA 6821 6822/^abc\K/aftertext 6823 abcdef 6824 0: 6825 0+ def 6826\= Expect no match 6827 defabcxyz 6828No match 6829 6830/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-2}Z/ 6831 ababababbbabZXXXX 6832 0: ababababbbabZ 6833 1: ab 6834 2: b 6835 6836/(?<A>tom|bon)-\g{A}/ 6837 tom-tom 6838 0: tom-tom 6839 1: tom 6840 bon-bon 6841 0: bon-bon 6842 1: bon 6843 6844/(^(a|b\g{-1}))/ 6845\= Expect no match 6846 bacxxx 6847No match 6848 6849/(?|(abc)|(xyz))\1/ 6850 abcabc 6851 0: abcabc 6852 1: abc 6853 xyzxyz 6854 0: xyzxyz 6855 1: xyz 6856\= Expect no match 6857 abcxyz 6858No match 6859 xyzabc 6860No match 6861 6862/(?|(abc)|(xyz))(?1)/ 6863 abcabc 6864 0: abcabc 6865 1: abc 6866 xyzabc 6867 0: xyzabc 6868 1: xyz 6869\= Expect no match 6870 xyzxyz 6871No match 6872 6873/^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/ 6874 XYabcdY 6875 0: XYabcdY 6876 1: a 6877 2: b 6878 3: c 6879 4: d 6880 5: Y 6881 6882/^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/ 6883 XYabcdY 6884 0: XYabcdY 6885 1: a 6886 2: b 6887 3: <unset> 6888 4: <unset> 6889 5: c 6890 6: d 6891 7: Y 6892 6893/^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/ 6894 XYabcdY 6895 0: XYabcdY 6896 1: a 6897 2: b 6898 3: <unset> 6899 4: <unset> 6900 5: c 6901 6: d 6902 7: Y 6903 6904/(?'abc'\w+):\k<abc>{2}/ 6905 a:aaxyz 6906 0: a:aa 6907 1: a 6908 ab:ababxyz 6909 0: ab:abab 6910 1: ab 6911\= Expect no match 6912 a:axyz 6913No match 6914 ab:abxyz 6915No match 6916 6917/(?'abc'\w+):\g{abc}{2}/ 6918 a:aaxyz 6919 0: a:aa 6920 1: a 6921 ab:ababxyz 6922 0: ab:abab 6923 1: ab 6924\= Expect no match 6925 a:axyz 6926No match 6927 ab:abxyz 6928No match 6929 6930/^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x 6931 abd 6932 0: abd 6933 1: a 6934 ce 6935 0: ce 6936 6937/^(a.)\g-1Z/ 6938 aXaXZ 6939 0: aXaXZ 6940 1: aX 6941 6942/^(a.)\g{-1}Z/ 6943 aXaXZ 6944 0: aXaXZ 6945 1: aX 6946 6947/^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x 6948 abcd 6949 0: ab 6950 6951/(?<all>(?:(?:a(?&all))|(b))(c?))/ 6952 aabc 6953 0: aabc 6954 1: aabc 6955 2: <unset> 6956 3: 6957 6958/(a(b)|(c))(?1)/ 6959 abc 6960 0: abc 6961 1: ab 6962 2: b 6963 cab 6964 0: cab 6965 1: c 6966 2: <unset> 6967 3: c 6968 6969/(?1)(a(b)|(c))/ 6970 abc 6971 0: abc 6972 1: c 6973 2: <unset> 6974 3: c 6975 cab 6976 0: cab 6977 1: ab 6978 2: b 6979 6980/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT)) 6981 (?(DEFINE) 6982 (?<NAME_PAT>[a-z]+) 6983 (?<ADDRESS_PAT>\d+) 6984 )/x 6985 metcalfe 33 6986 0: metcalfe 33 6987 1: metcalfe 6988 2: 33 6989 6990/(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/ 6991 1.2.3.4 6992 0: 1.2.3.4 6993 1: <unset> 6994 2: .4 6995 131.111.10.206 6996 0: 131.111.10.206 6997 1: <unset> 6998 2: .206 6999 10.0.0.0 7000 0: 10.0.0.0 7001 1: <unset> 7002 2: .0 7003\= Expect no match 7004 10.6 7005No match 7006 455.3.4.5 7007No match 7008 7009/\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/ 7010 1.2.3.4 7011 0: 1.2.3.4 7012 1: .4 7013 131.111.10.206 7014 0: 131.111.10.206 7015 1: .206 7016 10.0.0.0 7017 0: 10.0.0.0 7018 1: .0 7019\= Expect no match 7020 10.6 7021No match 7022 455.3.4.5 7023No match 7024 7025/^(\w++|\s++)*$/ 7026 now is the time for all good men to come to the aid of the party 7027 0: now is the time for all good men to come to the aid of the party 7028 1: party 7029\= Expect no match 7030 this is not a line with only words and spaces! 7031No match 7032 7033/(\d++)(\w)/ 7034 12345a 7035 0: 12345a 7036 1: 12345 7037 2: a 7038\= Expect no match 7039 12345+ 7040No match 7041 7042/a++b/ 7043 aaab 7044 0: aaab 7045 7046/(a++b)/ 7047 aaab 7048 0: aaab 7049 1: aaab 7050 7051/(a++)b/ 7052 aaab 7053 0: aaab 7054 1: aaa 7055 7056/([^()]++|\([^()]*\))+/ 7057 ((abc(ade)ufh()()x 7058 0: abc(ade)ufh()()x 7059 1: x 7060 7061/\(([^()]++|\([^()]+\))+\)/ 7062 (abc) 7063 0: (abc) 7064 1: abc 7065 (abc(def)xyz) 7066 0: (abc(def)xyz) 7067 1: xyz 7068\= Expect no match 7069 ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 7070No match 7071 7072/^([^()]|\((?1)*\))*$/ 7073 abc 7074 0: abc 7075 1: c 7076 a(b)c 7077 0: a(b)c 7078 1: c 7079 a(b(c))d 7080 0: a(b(c))d 7081 1: d 7082\= Expect no match) 7083 a(b(c)d 7084No match 7085 7086/^>abc>([^()]|\((?1)*\))*<xyz<$/ 7087 >abc>123<xyz< 7088 0: >abc>123<xyz< 7089 1: 3 7090 >abc>1(2)3<xyz< 7091 0: >abc>1(2)3<xyz< 7092 1: 3 7093 >abc>(1(2)3)<xyz< 7094 0: >abc>(1(2)3)<xyz< 7095 1: (1(2)3) 7096 7097/^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i 7098 1221 7099 0: 1221 7100 1: 1221 7101 2: 1 7102 Satanoscillatemymetallicsonatas 7103 0: Satanoscillatemymetallicsonatas 7104 1: <unset> 7105 2: <unset> 7106 3: Satanoscillatemymetallicsonatas 7107 4: S 7108 AmanaplanacanalPanama 7109 0: AmanaplanacanalPanama 7110 1: <unset> 7111 2: <unset> 7112 3: AmanaplanacanalPanama 7113 4: A 7114 AblewasIereIsawElba 7115 0: AblewasIereIsawElba 7116 1: <unset> 7117 2: <unset> 7118 3: AblewasIereIsawElba 7119 4: A 7120\= Expect no match 7121 Thequickbrownfox 7122No match 7123 7124/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/ 7125 12 7126 0: 12 7127 1: 12 7128 (((2+2)*-3)-7) 7129 0: (((2+2)*-3)-7) 7130 1: (((2+2)*-3)-7) 7131 2: - 7132 -12 7133 0: -12 7134 1: -12 7135\= Expect no match 7136 ((2+2)*-3)-7) 7137No match 7138 7139/^(x(y|(?1){2})z)/ 7140 xyz 7141 0: xyz 7142 1: xyz 7143 2: y 7144 xxyzxyzz 7145 0: xxyzxyzz 7146 1: xxyzxyzz 7147 2: xyzxyz 7148\= Expect no match 7149 xxyzz 7150No match 7151 xxyzxyzxyzz 7152No match 7153 7154/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x 7155 <> 7156 0: <> 7157 1: <> 7158 2: <> 7159 <abcd> 7160 0: <abcd> 7161 1: <abcd> 7162 2: <abcd> 7163 <abc <123> hij> 7164 0: <abc <123> hij> 7165 1: <abc <123> hij> 7166 2: <abc <123> hij> 7167 <abc <def> hij> 7168 0: <def> 7169 1: <def> 7170 2: <def> 7171 <abc<>def> 7172 0: <abc<>def> 7173 1: <abc<>def> 7174 2: <abc<>def> 7175 <abc<> 7176 0: <> 7177 1: <> 7178 2: <> 7179\= Expect no match 7180 <abc 7181No match 7182 7183/^a+(*FAIL)/ 7184\= Expect no match 7185 aaaaaa 7186No match 7187 7188/a+b?c+(*FAIL)/ 7189\= Expect no match 7190 aaabccc 7191No match 7192 7193/a+b?(*PRUNE)c+(*FAIL)/ 7194\= Expect no match 7195 aaabccc 7196No match 7197 7198/a+b?(*COMMIT)c+(*FAIL)/ 7199\= Expect no match 7200 aaabccc 7201No match 7202 7203/a+b?(*SKIP)c+(*FAIL)/ 7204\= Expect no match 7205 aaabcccaaabccc 7206No match 7207 7208/^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/ 7209 aaaxxxxxx 7210 0: aaaxxxxxx 7211 aaa++++++ 7212 0: aaa 7213 bbbxxxxx 7214 0: bbbxxxxx 7215 bbb+++++ 7216 0: bbb 7217 cccxxxx 7218 0: cccxxxx 7219 ccc++++ 7220 0: ccc 7221 dddddddd 7222 0: ddd 7223 7224/^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/ 7225 aaaxxxxxx 7226 0: aaaxxxxxx 7227 1: aaaxxxxxx 7228 aaa++++++ 7229 0: aaa 7230 1: aaa 7231 bbbxxxxx 7232 0: bbbxxxxx 7233 1: bbbxxxxx 7234 bbb+++++ 7235 0: bbb 7236 1: bbb 7237 cccxxxx 7238 0: cccxxxx 7239 1: cccxxxx 7240 ccc++++ 7241 0: ccc 7242 1: ccc 7243 dddddddd 7244 0: ddd 7245 1: ddd 7246 7247/a+b?(*THEN)c+(*FAIL)/ 7248\= Expect no match 7249 aaabccc 7250No match 7251 7252/(A (A|B(*ACCEPT)|C) D)(E)/x 7253 AB 7254 0: AB 7255 1: AB 7256 2: B 7257 ABX 7258 0: AB 7259 1: AB 7260 2: B 7261 AADE 7262 0: AADE 7263 1: AAD 7264 2: A 7265 3: E 7266 ACDE 7267 0: ACDE 7268 1: ACD 7269 2: C 7270 3: E 7271\= Expect no match 7272 AD 7273No match 7274 7275/^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i 7276 1221 7277 0: 1221 7278 1: 1221 7279 2: 1 7280 Satan, oscillate my metallic sonatas! 7281 0: Satan, oscillate my metallic sonatas! 7282 1: <unset> 7283 2: <unset> 7284 3: Satan, oscillate my metallic sonatas 7285 4: S 7286 A man, a plan, a canal: Panama! 7287 0: A man, a plan, a canal: Panama! 7288 1: <unset> 7289 2: <unset> 7290 3: A man, a plan, a canal: Panama 7291 4: A 7292 Able was I ere I saw Elba. 7293 0: Able was I ere I saw Elba. 7294 1: <unset> 7295 2: <unset> 7296 3: Able was I ere I saw Elba 7297 4: A 7298\= Expect no match 7299 The quick brown fox 7300No match 7301 7302/^((.)(?1)\2|.)$/ 7303 a 7304 0: a 7305 1: a 7306 aba 7307 0: aba 7308 1: aba 7309 2: a 7310 aabaa 7311 0: aabaa 7312 1: aabaa 7313 2: a 7314 abcdcba 7315 0: abcdcba 7316 1: abcdcba 7317 2: a 7318 pqaabaaqp 7319 0: pqaabaaqp 7320 1: pqaabaaqp 7321 2: p 7322 ablewasiereisawelba 7323 0: ablewasiereisawelba 7324 1: ablewasiereisawelba 7325 2: a 7326\= Expect no match 7327 rhubarb 7328No match 7329 the quick brown fox 7330No match 7331 7332/(a)(?<=b(?1))/ 7333 baz 7334 0: a 7335 1: a 7336\= Expect no match 7337 caz 7338No match 7339 7340/(?<=b(?1))(a)/ 7341 zbaaz 7342 0: a 7343 1: a 7344\= Expect no match 7345 aaa 7346No match 7347 7348/(?<X>a)(?<=b(?&X))/ 7349 baz 7350 0: a 7351 1: a 7352 7353/^(?|(abc)|(def))\1/ 7354 abcabc 7355 0: abcabc 7356 1: abc 7357 defdef 7358 0: defdef 7359 1: def 7360\= Expect no match 7361 abcdef 7362No match 7363 defabc 7364No match 7365 7366/^(?|(abc)|(def))(?1)/ 7367 abcabc 7368 0: abcabc 7369 1: abc 7370 defabc 7371 0: defabc 7372 1: def 7373\= Expect no match 7374 defdef 7375No match 7376 abcdef 7377No match 7378 7379/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/x,dupnames 7380 a\"aaaaa 7381 0: a"aaaaa 7382 1: " 7383 2: <unset> 7384 3: " 7385 b\"aaaaa 7386 0: b"aaaaa 7387 1: <unset> 7388 2: <unset> 7389 3: <unset> 7390 4: " 7391 5: <unset> 7392 6: " 7393\= Expect no match 7394 b\"11111 7395No match 7396 7397/(?:(?1)|B)(A(*F)|C)/ 7398 ABCD 7399 0: BC 7400 1: C 7401 CCD 7402 0: CC 7403 1: C 7404\= Expect no match 7405 CAD 7406No match 7407 7408/^(?:(?1)|B)(A(*F)|C)/ 7409 CCD 7410 0: CC 7411 1: C 7412 BCD 7413 0: BC 7414 1: C 7415\= Expect no match 7416 ABCD 7417No match 7418 CAD 7419No match 7420 BAD 7421No match 7422 7423/(?:(?1)|B)(A(*ACCEPT)XX|C)D/ 7424 AAD 7425 0: AA 7426 1: A 7427 ACD 7428 0: ACD 7429 1: C 7430 BAD 7431 0: BA 7432 1: A 7433 BCD 7434 0: BCD 7435 1: C 7436 BAX 7437 0: BA 7438 1: A 7439\= Expect no match 7440 ACX 7441No match 7442 ABC 7443No match 7444 7445/(?(DEFINE)(A))B(?1)C/ 7446 BAC 7447 0: BAC 7448 7449/(?(DEFINE)((A)\2))B(?1)C/ 7450 BAAC 7451 0: BAAC 7452 7453/(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x 7454 (ab(cd)ef) 7455 0: (ab(cd)ef) 7456 1: (ab(cd)ef) 7457 2: ef 7458 7459/^(?=a(*SKIP)b|ac)/ 7460\= Expect no match 7461 ac 7462No match 7463 7464/^(?=a(*PRUNE)b)/ 7465 ab 7466 0: 7467\= Expect no match 7468 ac 7469No match 7470 7471/^(?=a(*ACCEPT)b)/ 7472 ac 7473 0: 7474 7475/(?>a\Kb)/ 7476 ab 7477 0: b 7478 7479/((?>a\Kb))/ 7480 ab 7481 0: b 7482 1: ab 7483 7484/(a\Kb)/ 7485 ab 7486 0: b 7487 1: ab 7488 7489/^a\Kcz|ac/ 7490 ac 7491 0: ac 7492 7493/(?>a\Kbz|ab)/ 7494 ab 7495 0: ab 7496 7497/^(?&t)(?(DEFINE)(?<t>a\Kb))$/ 7498 ab 7499 0: b 7500 7501/^([^()]|\((?1)*\))*$/ 7502 a(b)c 7503 0: a(b)c 7504 1: c 7505 a(b(c)d)e 7506 0: a(b(c)d)e 7507 1: e 7508 7509/(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/ 7510 0 7511 0: 0 7512 1: 0 7513 00 7514 0: 00 7515 1: 00 7516 2: 0 7517 0000 7518 0: 0000 7519 1: 0000 7520 2: 0 7521 7522/(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/ 7523 0 7524 0: 0 7525 1: 0 7526 2: 0 7527 00 7528 0: 0 7529 1: 0 7530 2: 0 7531 0000 7532 0: 0 7533 1: 0 7534 2: 0 7535 7536# This one does fail, as expected, in Perl. It needs the complex item at the 7537# end of the pattern. A single letter instead of (B|D) makes it not fail, which 7538# I think is a Perl bug. 7539 7540/A(*COMMIT)(B|D)/ 7541\= Expect no match 7542 ACABX 7543No match 7544 7545# Check the use of names for failure 7546 7547/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/mark 7548\= Expect no match 7549 AC 7550No match, mark = A 7551 CB 7552No match, mark = B 7553 7554/(*MARK:A)(*SKIP:B)(C|X)/mark 7555 C 7556 0: C 7557 1: C 7558MK: A 7559\= Expect no match 7560 D 7561No match, mark = A 7562 7563/^(A(*THEN:A)B|C(*THEN:B)D)/mark 7564\= Expect no match 7565 CB 7566No match, mark = B 7567 7568/^(?:A(*THEN:A)B|C(*THEN:B)D)/mark 7569\= Expect no match 7570 CB 7571No match, mark = B 7572 7573/^(?>A(*THEN:A)B|C(*THEN:B)D)/mark 7574\= Expect no match 7575 CB 7576No match, mark = B 7577 7578# This should succeed, as the skip causes bump to offset 1 (the mark). Note 7579# that we have to have something complicated such as (B|Z) at the end because, 7580# for Perl, a simple character somehow causes an unwanted optimization to mess 7581# with the handling of backtracking verbs. 7582 7583/A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/x,mark 7584 AAAC 7585 0: AC 7586 7587# Test skipping over a non-matching mark. 7588 7589/A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/x,mark 7590 AAAC 7591 0: AC 7592 7593# Check shorthand for MARK. 7594 7595/A(*:A)A+(*SKIP:A)(B|Z) | AC/x,mark 7596 AAAC 7597 0: AC 7598 7599/(*:A)A+(*SKIP:A)(B|Z)/mark 7600\= Expect no match 7601 AAAC 7602No match, mark = A 7603 7604# This should succeed, as a non-existent skip name disables the skip. 7605 7606/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/x,mark 7607 AAAC 7608 0: AC 7609 7610/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/x,mark 7611 AAAC 7612 0: AC 7613MK: B 7614 7615# COMMIT at the start of a pattern should act like an anchor. Again, however, 7616# we need the complication for Perl. 7617 7618/(*COMMIT)(A|P)(B|P)(C|P)/ 7619 ABCDEFG 7620 0: ABC 7621 1: A 7622 2: B 7623 3: C 7624\= Expect no match 7625 DEFGABC 7626No match 7627 7628# COMMIT inside an atomic group can't stop backtracking over the group. 7629 7630/(\w+)(?>b(*COMMIT))\w{2}/ 7631 abbb 7632 0: abbb 7633 1: a 7634 7635/(\w+)b(*COMMIT)\w{2}/ 7636\= Expect no match 7637 abbb 7638No match 7639 7640# Check opening parens in comment when seeking forward reference. 7641 7642/(?&t)(?#()(?(DEFINE)(?<t>a))/ 7643 bac 7644 0: a 7645 7646# COMMIT should override THEN. 7647 7648/(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?/ 7649\= Expect no match 7650 yes 7651No match 7652 7653/(?>(*COMMIT)(yes|no)(*THEN)(*F))?/ 7654\= Expect no match 7655 yes 7656No match 7657 7658/b?(*SKIP)c/ 7659 bc 7660 0: bc 7661 abc 7662 0: bc 7663 7664/(*SKIP)bc/ 7665\= Expect no match 7666 a 7667No match 7668 7669/(*SKIP)b/ 7670\= Expect no match 7671 a 7672No match 7673 7674/(?P<abn>(?P=abn)xxx|)+/ 7675 xxx 7676 0: 7677 1: 7678 7679/(?i:([^b]))(?1)/ 7680 aa 7681 0: aa 7682 1: a 7683 aA 7684 0: aA 7685 1: a 7686\= Expect no match 7687 ab 7688No match 7689 aB 7690No match 7691 Ba 7692No match 7693 ba 7694No match 7695 7696/^(?&t)*+(?(DEFINE)(?<t>a))\w$/ 7697 aaaaaaX 7698 0: aaaaaaX 7699\= Expect no match 7700 aaaaaa 7701No match 7702 7703/^(?&t)*(?(DEFINE)(?<t>a))\w$/ 7704 aaaaaaX 7705 0: aaaaaaX 7706 aaaaaa 7707 0: aaaaaa 7708 7709/^(a)*+(\w)/ 7710 aaaaX 7711 0: aaaaX 7712 1: a 7713 2: X 7714 YZ 7715 0: Y 7716 1: <unset> 7717 2: Y 7718\= Expect no match 7719 aaaa 7720No match 7721 7722/^(?:a)*+(\w)/ 7723 aaaaX 7724 0: aaaaX 7725 1: X 7726 YZ 7727 0: Y 7728 1: Y 7729\= Expect no match 7730 aaaa 7731No match 7732 7733/^(a)++(\w)/ 7734 aaaaX 7735 0: aaaaX 7736 1: a 7737 2: X 7738\= Expect no match 7739 aaaa 7740No match 7741 YZ 7742No match 7743 7744/^(?:a)++(\w)/ 7745 aaaaX 7746 0: aaaaX 7747 1: X 7748\= Expect no match 7749 aaaa 7750No match 7751 YZ 7752No match 7753 7754/^(a)?+(\w)/ 7755 aaaaX 7756 0: aa 7757 1: a 7758 2: a 7759 YZ 7760 0: Y 7761 1: <unset> 7762 2: Y 7763 7764/^(?:a)?+(\w)/ 7765 aaaaX 7766 0: aa 7767 1: a 7768 YZ 7769 0: Y 7770 1: Y 7771 7772/^(a){2,}+(\w)/ 7773 aaaaX 7774 0: aaaaX 7775 1: a 7776 2: X 7777\= Expect no match 7778 aaa 7779No match 7780 YZ 7781No match 7782 7783/^(?:a){2,}+(\w)/ 7784 aaaaX 7785 0: aaaaX 7786 1: X 7787\= Expect no match 7788 aaa 7789No match 7790 YZ 7791No match 7792 7793/(a|)*(?1)b/ 7794 b 7795 0: b 7796 1: 7797 ab 7798 0: ab 7799 1: 7800 aab 7801 0: aab 7802 1: 7803 7804/(a)++(?1)b/ 7805\= Expect no match 7806 ab 7807No match 7808 aab 7809No match 7810 7811/(a)*+(?1)b/ 7812\= Expect no match 7813 ab 7814No match 7815 aab 7816No match 7817 7818/(?1)(?:(b)){0}/ 7819 b 7820 0: b 7821 7822/(foo ( \( ((?:(?> [^()]+ )|(?2))*) \) ) )/x 7823 foo(bar(baz)+baz(bop)) 7824 0: foo(bar(baz)+baz(bop)) 7825 1: foo(bar(baz)+baz(bop)) 7826 2: (bar(baz)+baz(bop)) 7827 3: bar(baz)+baz(bop) 7828 7829/(A (A|B(*ACCEPT)|C) D)(E)/x 7830 AB 7831 0: AB 7832 1: AB 7833 2: B 7834 7835/\A.*?(a|bc)/ 7836 ba 7837 0: ba 7838 1: a 7839 7840/\A.*?(?:a|bc)++/ 7841 ba 7842 0: ba 7843 7844/\A.*?(a|bc)++/ 7845 ba 7846 0: ba 7847 1: a 7848 7849/\A.*?(?:a|bc|d)/ 7850 ba 7851 0: ba 7852 7853/(?:(b))++/ 7854 beetle 7855 0: b 7856 1: b 7857 7858/(?(?=(a(*ACCEPT)z))a)/ 7859 a 7860 0: a 7861 1: a 7862 7863/^(a)(?1)+ab/ 7864 aaaab 7865 0: aaaab 7866 1: a 7867 7868/^(a)(?1)++ab/ 7869\= Expect no match 7870 aaaab 7871No match 7872 7873/^(?=a(*:M))aZ/mark 7874 aZbc 7875 0: aZ 7876MK: M 7877 7878/^(?!(*:M)b)aZ/mark 7879 aZbc 7880 0: aZ 7881 7882/(?(DEFINE)(a))?b(?1)/ 7883 backgammon 7884 0: ba 7885 7886/^\N+/ 7887 abc\ndef 7888 0: abc 7889 7890/^\N{1,}/ 7891 abc\ndef 7892 0: abc 7893 7894/(?(R)a+|(?R)b)/ 7895 aaaabcde 7896 0: aaaab 7897 7898/(?(R)a+|((?R))b)/ 7899 aaaabcde 7900 0: aaaab 7901 1: aaaa 7902 7903/((?(R)a+|(?1)b))/ 7904 aaaabcde 7905 0: aaaab 7906 1: aaaab 7907 7908/((?(R1)a+|(?1)b))/ 7909 aaaabcde 7910 0: aaaab 7911 1: aaaab 7912 7913/((?(R)a|(?1)))*/ 7914 aaa 7915 0: aaa 7916 1: a 7917 7918/((?(R)a|(?1)))+/ 7919 aaa 7920 0: aaa 7921 1: a 7922 7923/a(*:any 7924name)/mark 7925 abc 7926 0: a 7927MK: any \x0aname 7928 7929/(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/ 7930 a 7931 0: a 7932 ba 7933 0: a 7934 bba 7935 0: a 7936 7937# Checking revised (*THEN) handling. 7938 7939# Capture 7940 7941/^.*? (a(*THEN)b) c/x 7942\= Expect no match 7943 aabc 7944No match 7945 7946/^.*? (a(*THEN)b|(*F)) c/x 7947 aabc 7948 0: aabc 7949 1: ab 7950 7951/^.*? ( (a(*THEN)b) | (*F) ) c/x 7952 aabc 7953 0: aabc 7954 1: ab 7955 2: ab 7956 7957/^.*? ( (a(*THEN)b) ) c/x 7958\= Expect no match 7959 aabc 7960No match 7961 7962# Non-capture 7963 7964/^.*? (?:a(*THEN)b) c/x 7965\= Expect no match 7966 aabc 7967No match 7968 7969/^.*? (?:a(*THEN)b|(*F)) c/x 7970 aabc 7971 0: aabc 7972 7973/^.*? (?: (?:a(*THEN)b) | (*F) ) c/x 7974 aabc 7975 0: aabc 7976 7977/^.*? (?: (?:a(*THEN)b) ) c/x 7978\= Expect no match 7979 aabc 7980No match 7981 7982# Atomic 7983 7984/^.*? (?>a(*THEN)b) c/x 7985\= Expect no match 7986 aabc 7987No match 7988 7989/^.*? (?>a(*THEN)b|(*F)) c/x 7990 aabc 7991 0: aabc 7992 7993/^.*? (?> (?>a(*THEN)b) | (*F) ) c/x 7994 aabc 7995 0: aabc 7996 7997/^.*? (?> (?>a(*THEN)b) ) c/x 7998\= Expect no match 7999 aabc 8000No match 8001 8002# Possessive capture 8003 8004/^.*? (a(*THEN)b)++ c/x 8005\= Expect no match 8006 aabc 8007No match 8008 8009/^.*? (a(*THEN)b|(*F))++ c/x 8010 aabc 8011 0: aabc 8012 1: ab 8013 8014/^.*? ( (a(*THEN)b)++ | (*F) )++ c/x 8015 aabc 8016 0: aabc 8017 1: ab 8018 2: ab 8019 8020/^.*? ( (a(*THEN)b)++ )++ c/x 8021\= Expect no match 8022 aabc 8023No match 8024 8025# Possessive non-capture 8026 8027/^.*? (?:a(*THEN)b)++ c/x 8028\= Expect no match 8029 aabc 8030No match 8031 8032/^.*? (?:a(*THEN)b|(*F))++ c/x 8033 aabc 8034 0: aabc 8035 8036/^.*? (?: (?:a(*THEN)b)++ | (*F) )++ c/x 8037 aabc 8038 0: aabc 8039 8040/^.*? (?: (?:a(*THEN)b)++ )++ c/x 8041\= Expect no match 8042 aabc 8043No match 8044 8045# Condition assertion 8046 8047/^(?(?=a(*THEN)b)ab|ac)/ 8048 ac 8049 0: ac 8050 8051# Condition 8052 8053/^.*?(?(?=a)a|b(*THEN)c)/ 8054\= Expect no match 8055 ba 8056No match 8057 8058/^.*?(?:(?(?=a)a|b(*THEN)c)|d)/ 8059 ba 8060 0: ba 8061 8062/^.*?(?(?=a)a(*THEN)b|c)/ 8063\= Expect no match 8064 ac 8065No match 8066 8067# Assertion 8068 8069/^.*(?=a(*THEN)b)/ 8070 aabc 8071 0: a 8072 8073# -------------------------- 8074 8075/(?>a(*:m))/imsx,mark 8076 a 8077 0: a 8078MK: m 8079 8080/(?>(a)(*:m))/imsx,mark 8081 a 8082 0: a 8083 1: a 8084MK: m 8085 8086/(?<=a(*ACCEPT)b)c/ 8087 xacd 8088 0: c 8089 8090/(?<=(a(*ACCEPT)b))c/ 8091 xacd 8092 0: c 8093 1: a 8094 8095/(?<=(a(*COMMIT)b))c/ 8096 xabcd 8097 0: c 8098 1: ab 8099\= Expect no match 8100 xacd 8101No match 8102 8103/(?<!a(*FAIL)b)c/ 8104 xcd 8105 0: c 8106 acd 8107 0: c 8108 8109/(?<=a(*:N)b)c/mark 8110 xabcd 8111 0: c 8112MK: N 8113 8114/(?<=a(*PRUNE)b)c/ 8115 xabcd 8116 0: c 8117 8118/(?<=a(*SKIP)b)c/ 8119 xabcd 8120 0: c 8121 8122/(?<=a(*THEN)b)c/ 8123 xabcd 8124 0: c 8125 8126/(a)(?2){2}(.)/ 8127 abcd 8128 0: abcd 8129 1: a 8130 2: d 8131 8132/(*MARK:A)(*PRUNE:B)(C|X)/mark 8133 C 8134 0: C 8135 1: C 8136MK: B 8137\= Expect no match 8138 D 8139No match, mark = B 8140 8141/(*MARK:A)(*PRUNE:B)(C|X)/mark 8142 C 8143 0: C 8144 1: C 8145MK: B 8146\= Expect no match 8147 D 8148No match, mark = B 8149 8150/(*MARK:A)(*THEN:B)(C|X)/mark 8151 C 8152 0: C 8153 1: C 8154MK: B 8155\= Expect no match 8156 D 8157No match, mark = B 8158 8159/(*MARK:A)(*THEN:B)(C|X)/mark,no_start_optimize 8160 C 8161 0: C 8162 1: C 8163MK: B 8164\= Expect no match 8165 D 8166No match, mark = B 8167 8168/(*MARK:A)(*THEN:B)(C|X)/mark 8169 C 8170 0: C 8171 1: C 8172MK: B 8173\= Expect no match 8174 D 8175No match, mark = B 8176 8177# This should fail, as the skip causes a bump to offset 3 (the skip). 8178 8179/A(*MARK:A)A+(*SKIP)(B|Z) | AC/x,mark 8180\= Expect no match 8181 AAAC 8182No match, mark = A 8183 8184# Same 8185 8186/A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/x,mark 8187\= Expect no match 8188 AAAC 8189No match, mark = B 8190 8191/A(*:A)A+(*SKIP)(B|Z) | AC/x,mark 8192\= Expect no match 8193 AAAC 8194No match, mark = A 8195 8196# This should fail, as a null name is the same as no name. 8197 8198/A(*MARK:A)A+(*SKIP:)(B|Z) | AC/x,mark 8199\= Expect no match 8200 AAAC 8201No match, mark = A 8202 8203# A check on what happens after hitting a mark and them bumping along to 8204# something that does not even start. Perl reports tags after the failures 8205# here, though it does not when the individual letters are made into something 8206# more complicated. 8207 8208/A(*:A)B|XX(*:B)Y/mark 8209 AABC 8210 0: AB 8211MK: A 8212 XXYZ 8213 0: XXY 8214MK: B 8215\= Expect no match 8216 XAQQ 8217No match, mark = A 8218 XAQQXZZ 8219No match, mark = A 8220 AXQQQ 8221No match, mark = A 8222 AXXQQQ 8223No match, mark = B 8224 8225/^(A(*THEN:A)B|C(*THEN:B)D)/mark 8226 AB 8227 0: AB 8228 1: AB 8229MK: A 8230 CD 8231 0: CD 8232 1: CD 8233MK: B 8234\= Expect no match 8235 AC 8236No match, mark = A 8237 CB 8238No match, mark = B 8239 8240/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/mark 8241 AB 8242 0: AB 8243 1: AB 8244MK: A 8245 CD 8246 0: CD 8247 1: CD 8248MK: B 8249\= Expect no match 8250 AC 8251No match, mark = A 8252 CB 8253No match, mark = B 8254 8255# An empty name does not pass back an empty string. It is the same as if no 8256# name were given. 8257 8258/^(A(*PRUNE:)B|C(*PRUNE:B)D)/mark 8259 AB 8260 0: AB 8261 1: AB 8262 CD 8263 0: CD 8264 1: CD 8265MK: B 8266 8267# PRUNE goes to next bumpalong; COMMIT does not. 8268 8269/A(*PRUNE:A)B/mark 8270 ACAB 8271 0: AB 8272MK: A 8273 8274# Mark names can be duplicated. 8275 8276/A(*:A)B|X(*:A)Y/mark 8277 AABC 8278 0: AB 8279MK: A 8280 XXYZ 8281 0: XY 8282MK: A 8283 8284/b(*:m)f|a(*:n)w/mark 8285 aw 8286 0: aw 8287MK: n 8288\= Expect no match 8289 abc 8290No match, mark = m 8291 8292/b(*:m)f|aw/mark 8293 abaw 8294 0: aw 8295\= Expect no match 8296 abc 8297No match, mark = m 8298 abax 8299No match, mark = m 8300 8301/A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/x,mark 8302 AAAC 8303 0: AAC 8304 8305/(?=a(*MARK:A)b)..x/mark 8306 abxy 8307 0: abx 8308MK: A 8309\= Expect no match 8310 abpq 8311No match 8312 8313/(?=a(*MARK:A)b)..(*:Y)x/mark 8314 abxy 8315 0: abx 8316MK: Y 8317\= Expect no match 8318 abpq 8319No match 8320 8321/(?=a(*PRUNE:A)b)..x/mark 8322 abxy 8323 0: abx 8324MK: A 8325\= Expect no match 8326 abpq 8327No match 8328 8329/(?=a(*PRUNE:A)b)..(*:Y)x/mark 8330 abxy 8331 0: abx 8332MK: Y 8333\= Expect no match 8334 abpq 8335No match 8336 8337/(?=a(*THEN:A)b)..x/mark 8338 abxy 8339 0: abx 8340MK: A 8341\= Expect no match 8342 abpq 8343No match 8344 8345/(?=a(*THEN:A)b)..(*:Y)x/mark 8346 abxy 8347 0: abx 8348MK: Y 8349\= Expect no match 8350 abpq 8351No match 8352 8353/(another)?(\1?)test/ 8354 hello world test 8355 0: test 8356 1: <unset> 8357 2: 8358 8359/(another)?(\1+)test/ 8360\= Expect no match 8361 hello world test 8362No match 8363 8364/(a(*COMMIT)b){0}a(?1)|aac/ 8365 aac 8366 0: aac 8367 8368/((?:a?)*)*c/ 8369 aac 8370 0: aac 8371 1: 8372 8373/((?>a?)*)*c/ 8374 aac 8375 0: aac 8376 1: 8377 8378/(?>.*?a)(?<=ba)/ 8379 aba 8380 0: ba 8381 8382/(?:.*?a)(?<=ba)/ 8383 aba 8384 0: aba 8385 8386/(?>.*?a)b/s 8387 aab 8388 0: ab 8389 8390/(?>.*?a)b/ 8391 aab 8392 0: ab 8393 8394/(?>^a)b/s 8395\= Expect no match 8396 aab 8397No match 8398 8399/(?>.*?)(?<=(abcd)|(wxyz))/ 8400 alphabetabcd 8401 0: 8402 1: abcd 8403 endingwxyz 8404 0: 8405 1: <unset> 8406 2: wxyz 8407 8408/(?>.*)(?<=(abcd)|(wxyz))/ 8409 alphabetabcd 8410 0: alphabetabcd 8411 1: abcd 8412 endingwxyz 8413 0: endingwxyz 8414 1: <unset> 8415 2: wxyz 8416 8417/(?>.*)foo/ 8418\= Expect no match 8419 abcdfooxyz 8420No match 8421 8422/(?>.*?)foo/ 8423 abcdfooxyz 8424 0: foo 8425 8426/(?:(a(*PRUNE)b)){0}(?:(?1)|ac)/ 8427 ac 8428 0: ac 8429 8430/(?:(a(*SKIP)b)){0}(?:(?1)|ac)/ 8431 ac 8432 0: ac 8433 8434/(?<=(*SKIP)ac)a/ 8435\= Expect no match 8436 aa 8437No match 8438 8439/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/x,mark 8440 AAAC 8441 0: AC 8442 8443/a(*SKIP:m)x|ac(*:n)(*SKIP:n)d|ac/mark 8444 acacd 8445 0: acd 8446MK: n 8447 8448/A(*SKIP:m)x|A(*SKIP:n)x|AB/mark 8449 AB 8450 0: AB 8451 8452/((*SKIP:r)d){0}a(*SKIP:m)x|ac(*:n)|ac/mark 8453 acacd 8454 0: ac 8455MK: n 8456 8457# Tests that try to figure out how Perl works. My hypothesis is that the first 8458# verb that is backtracked onto is the one that acts. This seems to be the case 8459# almost all the time, but there is one exception that is perhaps a bug. 8460 8461# This matches "aaaac"; each PRUNE advances one character until the subject no 8462# longer starts with 5 'a's. 8463 8464/aaaaa(*PRUNE)b|a+c/ 8465 aaaaaac 8466 0: aaaac 8467 8468# Putting SKIP in front of PRUNE makes no difference, as it is never 8469# backtracked onto, whether or not it has a label. 8470 8471/aaaaa(*SKIP)(*PRUNE)b|a+c/ 8472 aaaaaac 8473 0: aaaac 8474 8475/aaaaa(*SKIP:N)(*PRUNE)b|a+c/ 8476 aaaaaac 8477 0: aaaac 8478 8479/aaaa(*:N)a(*SKIP:N)(*PRUNE)b|a+c/ 8480 aaaaaac 8481 0: aaaac 8482 8483# Putting THEN in front makes no difference. 8484 8485/aaaaa(*THEN)(*PRUNE)b|a+c/ 8486 aaaaaac 8487 0: aaaac 8488 8489# However, putting COMMIT in front of the prune changes it to "no match". I 8490# think this is inconsistent and possibly a bug. For the moment, running this 8491# test is moved out of the Perl-compatible file. 8492 8493/aaaaa(*COMMIT)(*PRUNE)b|a+c/ 8494 8495# OK, lets play the same game again using SKIP instead of PRUNE. 8496 8497# This matches "ac" because SKIP forces the next match to start on the 8498# sixth "a". 8499 8500/aaaaa(*SKIP)b|a+c/ 8501 aaaaaac 8502 0: ac 8503 8504# Putting PRUNE in front makes no difference. 8505 8506/aaaaa(*PRUNE)(*SKIP)b|a+c/ 8507 aaaaaac 8508 0: ac 8509 8510# Putting THEN in front makes no difference. 8511 8512/aaaaa(*THEN)(*SKIP)b|a+c/ 8513 aaaaaac 8514 0: ac 8515 8516# In this case, neither does COMMIT. This still matches "ac". 8517 8518/aaaaa(*COMMIT)(*SKIP)b|a+c/ 8519 aaaaaac 8520 0: ac 8521 8522# This gives "no match", as expected. 8523 8524/aaaaa(*COMMIT)b|a+c/ 8525\= Expect no match 8526 aaaaaac 8527No match 8528 8529# ---- Tests using THEN ---- 8530 8531# This matches "aaaaaac", as expected. 8532 8533/aaaaa(*THEN)b|a+c/ 8534 aaaaaac 8535 0: aaaaaac 8536 8537# Putting SKIP in front makes no difference. 8538 8539/aaaaa(*SKIP)(*THEN)b|a+c/ 8540 aaaaaac 8541 0: aaaaaac 8542 8543# Putting PRUNE in front makes no difference. 8544 8545/aaaaa(*PRUNE)(*THEN)b|a+c/ 8546 aaaaaac 8547 0: aaaaaac 8548 8549# Putting COMMIT in front makes no difference. 8550 8551/aaaaa(*COMMIT)(*THEN)b|a+c/ 8552 aaaaaac 8553 0: aaaaaac 8554 8555# End of "priority" tests 8556 8557/aaaaa(*:m)(*PRUNE:m)(*SKIP:m)m|a+/ 8558 aaaaaa 8559 0: a 8560 8561/aaaaa(*:m)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/ 8562 aaaaaa 8563 0: a 8564 8565/aaaaa(*:n)(*PRUNE:m)(*SKIP:m)m|a+/ 8566 aaaaaa 8567 0: aaaa 8568 8569/aaaaa(*:n)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/ 8570 aaaaaa 8571 0: a 8572 8573/a(*MARK:A)aa(*PRUNE:A)a(*SKIP:A)b|a+c/ 8574 aaaac 8575 0: aac 8576 8577/a(*MARK:A)aa(*MARK:A)a(*SKIP:A)b|a+c/ 8578 aaaac 8579 0: ac 8580 8581/aaa(*PRUNE:A)a(*SKIP:A)b|a+c/ 8582 aaaac 8583 0: aac 8584 8585/aaa(*MARK:A)a(*SKIP:A)b|a+c/ 8586 aaaac 8587 0: ac 8588 8589/a(*:m)a(*COMMIT)(*SKIP:m)b|a+c/mark 8590 aaaaaac 8591 0: ac 8592 8593/.?(a|b(*THEN)c)/ 8594 ba 8595 0: ba 8596 1: a 8597 8598/(a(*COMMIT)b)c|abd/ 8599 abc 8600 0: abc 8601 1: ab 8602\= Expect no match 8603 abd 8604No match 8605 8606/(?=a(*COMMIT)b)abc|abd/ 8607 abc 8608 0: abc 8609 abd 8610 0: abd 8611 8612/(?>a(*COMMIT)b)c|abd/ 8613 abc 8614 0: abc 8615 abd 8616 0: abd 8617 8618/a(?=b(*COMMIT)c)[^d]|abd/ 8619 abc 8620 0: ab 8621\= Expect no match 8622 abd 8623No match 8624 8625/a(?=bc).|abd/ 8626 abd 8627 0: abd 8628 abc 8629 0: ab 8630 8631/a(?>b(*COMMIT)c)d|abd/ 8632\= Expect no match 8633 abceabd 8634No match 8635 8636/a(?>bc)d|abd/ 8637 abceabd 8638 0: abd 8639 8640/(?>a(*COMMIT)b)c|abd/ 8641 abd 8642 0: abd 8643 8644/(?>a(*COMMIT)c)d|abd/ 8645\= Expect no match 8646 abd 8647No match 8648 8649/((?=a(*COMMIT)b)ab|ac){0}(?:(?1)|a(c))/ 8650 ac 8651 0: ac 8652 1: <unset> 8653 2: c 8654 8655# These tests were formerly in test 2, but changes in PCRE and Perl have 8656# made them compatible. 8657 8658/^(a)?(?(1)a|b)+$/ 8659\= Expect no match 8660 a 8661No match 8662 8663/A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/x,mark 8664\= Expect no match 8665 AAAC 8666No match, mark = A 8667 8668/^((abc|abcx)(*THEN)y|abcd)/ 8669 abcd 8670 0: abcd 8671 1: abcd 8672\= Expect no match 8673 abcxy 8674No match 8675 8676/^((yes|no)(*THEN)(*F))?/ 8677\= Expect no match 8678 yes 8679No match 8680 8681/(A (.*) C? (*THEN) | A D) (*FAIL)/x 8682\= Expect no match 8683 AbcdCBefgBhiBqz 8684No match 8685 8686/(A (.*) C? (*THEN) | A D) z/x 8687\= Expect no match 8688 AbcdCBefgBhiBqz 8689No match 8690 8691/(A (.*) C? (*THEN) | A D) \s* (*FAIL)/x 8692\= Expect no match 8693 AbcdCBefgBhiBqz 8694No match 8695 8696/(A (.*) C? (*THEN) | A D) \s* z/x 8697\= Expect no match 8698 AbcdCBefgBhiBqz 8699No match 8700 8701/(A (.*) (?:C|) (*THEN) | A D) (*FAIL)/x 8702\= Expect no match 8703 AbcdCBefgBhiBqz 8704No match 8705 8706/(A (.*) (?:C|) (*THEN) | A D) z/x 8707\= Expect no match 8708 AbcdCBefgBhiBqz 8709No match 8710 8711/(A (.*) C{0,6} (*THEN) | A D) (*FAIL)/x 8712\= Expect no match 8713 AbcdCBefgBhiBqz 8714No match 8715 8716/(A (.*) C{0,6} (*THEN) | A D) z/x 8717\= Expect no match 8718 AbcdCBefgBhiBqz 8719No match 8720 8721/(A (.*) (CE){0,6} (*THEN) | A D) (*FAIL)/x 8722\= Expect no match 8723 AbcdCEBefgBhiBqz 8724No match 8725 8726/(A (.*) (CE){0,6} (*THEN) | A D) z/x 8727\= Expect no match 8728 AbcdCEBefgBhiBqz 8729No match 8730 8731/(A (.*) (CE*){0,6} (*THEN) | A D) (*FAIL)/x 8732\= Expect no match 8733 AbcdCBefgBhiBqz 8734No match 8735 8736/(A (.*) (CE*){0,6} (*THEN) | A D) z/x 8737\= Expect no match 8738 AbcdCBefgBhiBqz 8739No match 8740 8741/(?=a(*COMMIT)b|ac)ac|ac/ 8742\= Expect no match 8743 ac 8744No match 8745 8746/(?=a(*COMMIT)b|(ac)) ac | (a)c/x 8747\= Expect no match 8748 ac 8749No match 8750 8751# ---- 8752 8753/(?(?!b(*THEN)a)bn|bnn)/ 8754 bnn 8755 0: bn 8756 8757/(?!b(*SKIP)a)bn|bnn/ 8758 bnn 8759 0: bn 8760 8761/(?(?!b(*SKIP)a)bn|bnn)/ 8762 bnn 8763 0: bn 8764 8765/(?!b(*PRUNE)a)bn|bnn/ 8766 bnn 8767 0: bn 8768 8769/(?(?!b(*PRUNE)a)bn|bnn)/ 8770 bnn 8771 0: bn 8772 8773/(?!b(*COMMIT)a)bn|bnn/ 8774 bnn 8775 0: bn 8776 8777/(?(?!b(*COMMIT)a)bn|bnn)/ 8778 bnn 8779 0: bn 8780 8781/(?=b(*SKIP)a)bn|bnn/ 8782\= Expect no match 8783 bnn 8784No match 8785 8786/(?=b(*THEN)a)bn|bnn/ 8787 bnn 8788 0: bnn 8789 8790/^(?!a(*SKIP)b)/ 8791 ac 8792 0: 8793 8794/^(?!a(*SKIP)b)../ 8795 acd 8796 0: ac 8797 8798/(?!a(*SKIP)b)../ 8799 acd 8800 0: ac 8801 8802/^(?(?!a(*SKIP)b))/ 8803 ac 8804 0: 8805 8806/^(?!a(*PRUNE)b)../ 8807 acd 8808 0: ac 8809 8810/(?!a(*PRUNE)b)../ 8811 acd 8812 0: ac 8813 8814/(?!a(*COMMIT)b)ac|cd/ 8815 ac 8816 0: ac 8817 8818/\A.*?(?:a|bc)/ 8819 ba 8820 0: ba 8821 8822/^(A(*THEN)B|C(*THEN)D)/ 8823 CD 8824 0: CD 8825 1: CD 8826 8827/(*:m(m)(?&y)(?(DEFINE)(?<y>b))/mark 8828 abc 8829 0: b 8830MK: m(m 8831 8832/(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/mark 8833 abc 8834 0: b 8835MK: m(m 8836 8837/(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/mark 8838 abc 8839 0: b 8840 8841/(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/mark 8842 abc 8843 0: b 8844MK: m(m 8845 8846/^\d*\w{4}/ 8847 1234 8848 0: 1234 8849\= Expect no match 8850 123 8851No match 8852 8853/^[^b]*\w{4}/ 8854 aaaa 8855 0: aaaa 8856\= Expect no match 8857 aaa 8858No match 8859 8860/^[^b]*\w{4}/i 8861 aaaa 8862 0: aaaa 8863\= Expect no match 8864 aaa 8865No match 8866 8867/^a*\w{4}/ 8868 aaaa 8869 0: aaaa 8870\= Expect no match 8871 aaa 8872No match 8873 8874/^a*\w{4}/i 8875 aaaa 8876 0: aaaa 8877\= Expect no match 8878 aaa 8879No match 8880 8881/(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames 8882 foofoo 8883 0: foofoo 8884 1: foo 8885 barbar 8886 0: barbar 8887 1: <unset> 8888 2: bar 8889 8890/(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames 8891 AfooA 8892 0: AfooA 8893 1: A 8894 2: foo 8895 AbarA 8896 0: AbarA 8897 1: A 8898 2: <unset> 8899 3: bar 8900\= Expect no match 8901 Afoofoo 8902No match 8903 Abarbar 8904No match 8905 8906/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ 8907 1 IN SOA non-sp1 non-sp2( 8908 0: 1 IN SOA non-sp1 non-sp2( 8909 1: 1 8910 2: non-sp1 8911 3: non-sp2 8912 8913/^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?('A')x) (?(<B>)y)$/x,dupnames 8914 Ax 8915 0: Ax 8916 1: A 8917 BAxy 8918 0: BAxy 8919 1: <unset> 8920 2: B 8921 3: A 8922 8923/^A\xZ/ 8924 A\0Z 8925 0: A\x00Z 8926 8927/^A\o{123}B/ 8928 A\123B 8929 0: ASB 8930 8931/ ^ a + + b $ /x 8932 aaaab 8933 0: aaaab 8934 8935/ ^ a + #comment 8936 + b $ /x 8937 aaaab 8938 0: aaaab 8939 8940/ ^ a + #comment 8941 #comment 8942 + b $ /x 8943 aaaab 8944 0: aaaab 8945 8946/ ^ (?> a + ) b $ /x 8947 aaaab 8948 0: aaaab 8949 8950/ ^ ( a + ) + + \w $ /x 8951 aaaab 8952 0: aaaab 8953 1: aaaa 8954 8955/(?:a\Kb)*+/aftertext 8956 ababc 8957 0: b 8958 0+ c 8959 8960/(?>a\Kb)*/aftertext 8961 ababc 8962 0: b 8963 0+ c 8964 8965/(?:a\Kb)*/aftertext 8966 ababc 8967 0: b 8968 0+ c 8969 8970/(a\Kb)*+/aftertext 8971 ababc 8972 0: b 8973 0+ c 8974 1: ab 8975 8976/(a\Kb)*/aftertext 8977 ababc 8978 0: b 8979 0+ c 8980 1: ab 8981 8982/(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/ 8983\= Expect no match 8984 acb 8985No match 8986 8987/\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++/ 8988 NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 8989 0: NON QUOTED "QUOT""ED" AFTER 8990 8991/\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++/ 8992 NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 8993 0: NON QUOTED "QUOT""ED" AFTER 8994 8995/\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++/ 8996 NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 8997 0: NON QUOTED "QUOT""ED" AFTER 8998 8999/\A([^\"1]++|[\"2]([^\"3]*+|[\"4][\"5])*+[\"6])++/ 9000 NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 9001 0: NON QUOTED "QUOT""ED" AFTER 9002 1: AFTER 9003 2: 9004 9005/^\w+(?>\s*)(?<=\w)/ 9006 test test 9007 0: tes 9008 9009/(?P<same>a)(?P<same>b)/g,dupnames 9010 abbaba 9011 0: ab 9012 1: a 9013 2: b 9014 0: ab 9015 1: a 9016 2: b 9017 9018/(?P<same>a)(?P<same>b)(?P=same)/g,dupnames 9019 abbaba 9020 0: aba 9021 1: a 9022 2: b 9023 9024/(?P=same)?(?P<same>a)(?P<same>b)/g,dupnames 9025 abbaba 9026 0: ab 9027 1: a 9028 2: b 9029 0: ab 9030 1: a 9031 2: b 9032 9033/(?:(?P=same)?(?:(?P=same)(?P<same>a)(?P=same)|(?P=same)?(?P<same>b)(?P=same)){2}(?P=same)(?P<same>c)(?P=same)){2}(?P<same>z)?/g,dupnames 9034\= Expect no match 9035 bbbaaaccccaaabbbcc 9036No match 9037 9038/(?P<Name>a)?(?P<Name2>b)?(?(<Name>)c|d)*l/ 9039 acl 9040 0: acl 9041 1: a 9042 bdl 9043 0: bdl 9044 1: <unset> 9045 2: b 9046 adl 9047 0: dl 9048 bcl 9049 0: l 9050 9051/\sabc/ 9052 \x{0b}abc 9053 0: \x0babc 9054 9055/[\Qa]\E]+/ 9056 aa]] 9057 0: aa]] 9058 9059/[\Q]a\E]+/ 9060 aa]] 9061 0: aa]] 9062 9063/A((((((((a))))))))\8B/ 9064 AaaB 9065 0: AaaB 9066 1: a 9067 2: a 9068 3: a 9069 4: a 9070 5: a 9071 6: a 9072 7: a 9073 8: a 9074 9075/A(((((((((a)))))))))\9B/ 9076 AaaB 9077 0: AaaB 9078 1: a 9079 2: a 9080 3: a 9081 4: a 9082 5: a 9083 6: a 9084 7: a 9085 8: a 9086 9: a 9087 9088/A[\8\9]B/ 9089 A8B 9090 0: A8B 9091 A9B 9092 0: A9B 9093 9094/(|ab)*?d/ 9095 abd 9096 0: abd 9097 1: ab 9098 xyd 9099 0: d 9100 9101/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/ 9102 1234abcd 9103 0: 9104 1: <unset> 9105 2: <unset> 9106 3: <unset> 9107 4: <unset> 9108 5: 9109 9110/(\2|a)(\1)/ 9111 aaa 9112 0: aa 9113 1: a 9114 2: a 9115 9116/(\2)(\1)/ 9117 9118/Z*(|d*){216}/ 9119 9120/(?1)(?#?'){8}(a)/ 9121 baaaaaaaaac 9122 0: aaaaaaaaa 9123 1: a 9124 9125/((((((((((((x))))))))))))\12/ 9126 xx 9127 0: xx 9128 1: x 9129 2: x 9130 3: x 9131 4: x 9132 5: x 9133 6: x 9134 7: x 9135 8: x 9136 9: x 913710: x 913811: x 913912: x 9140 9141/A[\8]B[\9]C/ 9142 A8B9C 9143 0: A8B9C 9144 9145/(?1)()((((((\1++))\x85)+)|))/ 9146 \x85\x85 9147 0: \x85\x85 9148 1: 9149 2: \x85\x85 9150 3: \x85\x85 9151 4: \x85\x85 9152 5: \x85 9153 6: 9154 7: 9155 9156/(?|(\k'Pm')|(?'Pm'))/ 9157 abcd 9158 0: 9159 1: 9160 9161/(?|(aaa)|(b))\g{1}/ 9162 aaaaaa 9163 0: aaaaaa 9164 1: aaa 9165 bb 9166 0: bb 9167 1: b 9168 9169/(?|(aaa)|(b))(?1)/ 9170 aaaaaa 9171 0: aaaaaa 9172 1: aaa 9173 baaa 9174 0: baaa 9175 1: b 9176\= Expect no match 9177 bb 9178No match 9179 9180/(?|(aaa)|(b))/ 9181 xaaa 9182 0: aaa 9183 1: aaa 9184 xbc 9185 0: b 9186 1: b 9187 9188/(?|(?'a'aaa)|(?'a'b))\k'a'/ 9189 aaaaaa 9190 0: aaaaaa 9191 1: aaa 9192 bb 9193 0: bb 9194 1: b 9195 9196/(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/dupnames 9197 aaaccccaaa 9198 0: aaaccccaaa 9199 1: aaa 9200 2: cccc 9201 bccccb 9202 0: bccccb 9203 1: b 9204 2: cccc 9205 9206# /x does not apply to MARK labels 9207 9208/x (*MARK:ab cd # comment 9209ef) x/x,mark 9210 axxz 9211 0: xx 9212MK: ab cd # comment\x0aef 9213 9214/(?<=a(B){0}c)X/ 9215 acX 9216 0: X 9217 9218/(?<DEFINE>b)(?(DEFINE)(a+))(?&DEFINE)/ 9219 bbbb 9220 0: bb 9221 1: b 9222\= Expect no match 9223 baaab 9224No match 9225 9226/(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\s])/ 9227 \ Fred:099 9228 0: 9229 9230/(?=.*X)X$/ 9231 \ X 9232 0: X 9233 9234/(?s)(?=.*?)b/ 9235 aabc 9236 0: b 9237 9238/(Z)(a)\2{1,2}?(?-i)\1X/i 9239 ZaAAZX 9240 0: ZaAAZX 9241 1: Z 9242 2: a 9243 9244/(?'c')XX(?'YYYYYYYYYYYYYYYYYYYYYYYCl')/ 9245 9246/[s[:digit:]\E-H]+/ 9247 s09-H 9248 0: s09-H 9249 9250/[s[:digit:]\Q\E-H]+/ 9251 s09-H 9252 0: s09-H 9253 9254/a+(?:|b)a/ 9255 aaaa 9256 0: aaaa 9257 9258/X?(R||){3335}/ 9259 9260/(?1)(A(*COMMIT)|B)D/ 9261 ABD 9262 0: ABD 9263 1: B 9264 XABD 9265 0: ABD 9266 1: B 9267 BAD 9268 0: BAD 9269 1: A 9270 ABXABD 9271 0: ABD 9272 1: B 9273\= Expect no match 9274 ABX 9275No match 9276 9277/(?(DEFINE)(?<m> 1? (?=(?<cond>2)?) 1 2 (?('cond')|3))) 9278 \A 9279 () 9280 (?&m) 9281 \Z/x 9282 123 9283 0: 123 9284 1: <unset> 9285 2: <unset> 9286 3: 9287 9288/^(?: 9289(?: A| (1? (?=(?<cond>2)?) (1) 2 (?('cond')|3)) ) 9290(Z) 9291)+$/x 9292 AZ123Z 9293 0: AZ123Z 9294 1: 123 9295 2: <unset> 9296 3: 1 9297 4: Z 9298\= Expect no match 9299 AZ12Z 9300No match 9301 9302/^ (?(DEFINE) ( (?!(a)\2b)..) ) ()(?1) /x 9303 acb 9304 0: ac 9305 1: <unset> 9306 2: <unset> 9307 3: 9308\= Expect no match 9309 aab 9310No match 9311 9312/(?>ab|abab){1,5}?M/ 9313 abababababababababababM 9314 0: abababababM 9315 9316/(?>ab|abab){2}?M/ 9317 abababM 9318 0: ababM 9319 9320/((?(?=(a))a)+k)/ 9321 bbak 9322 0: ak 9323 1: ak 9324 2: a 9325 9326/((?(?=(a))a|)+k)/ 9327 bbak 9328 0: ak 9329 1: ak 9330 2: a 9331 9332/(?(?!(b))a|b)+k/ 9333 ababbalbbadabak 9334 0: abak 9335 1: b 9336 9337/(?!(b))c|b/ 9338 Ab 9339 0: b 9340 Ac 9341 0: c 9342 9343/(?=(b))b|c/ 9344 Ab 9345 0: b 9346 1: b 9347 Ac 9348 0: c 9349 9350/^(.|(.)(?1)\2)$/ 9351 a 9352 0: a 9353 1: a 9354 aba 9355 0: aba 9356 1: aba 9357 2: a 9358 abcba 9359 0: abcba 9360 1: abcba 9361 2: a 9362 ababa 9363 0: ababa 9364 1: ababa 9365 2: a 9366 abcdcba 9367 0: abcdcba 9368 1: abcdcba 9369 2: a 9370 9371/^((.)(?1)\2|.?)$/ 9372 a 9373 0: a 9374 1: a 9375 aba 9376 0: aba 9377 1: aba 9378 2: a 9379 abba 9380 0: abba 9381 1: abba 9382 2: a 9383 abcba 9384 0: abcba 9385 1: abcba 9386 2: a 9387 ababa 9388 0: ababa 9389 1: ababa 9390 2: a 9391 abccba 9392 0: abccba 9393 1: abccba 9394 2: a 9395 abcdcba 9396 0: abcdcba 9397 1: abcdcba 9398 2: a 9399 abcddcba 9400 0: abcddcba 9401 1: abcddcba 9402 2: a 9403 9404/^(.)(\1|a(?2))/ 9405 bab 9406 0: bab 9407 1: b 9408 2: ab 9409 9410/^(.|(.)(?1)?\2)$/ 9411 abcba 9412 0: abcba 9413 1: abcba 9414 2: a 9415 9416/^(?(?=(a))abc|def)/ 9417 abc 9418 0: abc 9419 1: a 9420 9421/^(?(?!(a))def|abc)/ 9422 abc 9423 0: abc 9424 1: a 9425 9426/^(?(?=(a)(*ACCEPT))abc|def)/ 9427 abc 9428 0: abc 9429 1: a 9430 9431/^(?(?!(a)(*ACCEPT))def|abc)/ 9432 abc 9433 0: abc 9434 1: a 9435 9436/^(?1)\d{3}(a)/ 9437 a123a 9438 0: a123a 9439 1: a 9440 9441# This pattern uses a lot of named subpatterns in order to match email 9442# addresses in various formats. It's a heavy test for named subpatterns. In the 9443# <atext> group, slash is coded as \x{2f} so that this pattern can also be 9444# processed by perltest.sh, which does not cater for an escaped delimiter 9445# within the pattern. $ within the pattern must also be escaped. All $ and @ 9446# characters in subject strings are escaped so that Perl doesn't interpret them 9447# as variable insertions and " characters must also be escaped for Perl. 9448 9449# This set of subpatterns is more or less a direct transliteration of the BNF 9450# definitions in RFC2822, without any of the obsolete features. The addition of 9451# a possessive + to the definition of <phrase> reduced the match limit in PCRE2 9452# from over 5 million to just under 400, and eliminated a very noticeable delay 9453# when this file was passed to perltest.sh. 9454 9455/(?ix)(?(DEFINE) 9456(?<addr_spec> (?&local_part) \@ (?&domain) ) 9457(?<angle_addr> (?&CFWS)?+ < (?&addr_spec) > (?&CFWS)?+ ) 9458(?<atext> [a-z\d!#\$%&'*+-\x{2f}=?^_`{|}~] ) 9459(?<atom> (?&CFWS)?+ (?&atext)+ (?&CFWS)?+ ) 9460(?<ccontent> (?&ctext) | (?"ed_pair) | (?&comment) ) 9461(?<ctext> [^\x{9}\x{10}\x{13}\x{7f}-\x{ff}\ ()\\] ) 9462(?<comment> \( (?: (?&FWS)?+ (?&ccontent) )*+ (?&FWS)?+ \) ) 9463(?<CFWS> (?: (?&FWS)?+ (?&comment) )* (?# NOT possessive) 9464 (?: (?&FWS)?+ (?&comment) | (?&FWS) ) ) 9465(?<dcontent> (?&dtext) | (?"ed_pair) ) 9466(?<display_name> (?&phrase) ) 9467(?<domain> (?&dot_atom) | (?&domain_literal) ) 9468(?<domain_literal> (?&CFWS)?+ \[ (?: (?&FWS)?+ (?&dcontent) )* (?&FWS)?+ \] 9469 (?&CFWS)?+ ) 9470(?<dot_atom> (?&CFWS)?+ (?&dot_atom_text) (?&CFWS)?+ ) 9471(?<dot_atom_text> (?&atext)++ (?: \. (?&atext)++)*+ ) 9472(?<dtext> [^\x{9}\x{10}\x{13}\x{7f}-\x{ff}\ \[\]\\] ) 9473(?<FWS> (?: [\t\ ]*+ \n)?+ [\t\ ]++ ) 9474(?<local_part> (?&dot_atom) | (?"ed_string) ) 9475(?<mailbox> (?&name_addr) | (?&addr_spec) ) 9476(?<name_addr> (?&display_name)? (?&angle_addr) ) 9477(?<phrase> (?&word)++ ) 9478(?<qcontent> (?&qtext) | (?"ed_pair) ) 9479(?<quoted_pair> " (?&text) ) 9480(?<quoted_string> (?&CFWS)?+ " (?: (?&FWS)?+ (?&qcontent))* (?&FWS)?+ " 9481 (?&CFWS)?+ ) 9482(?<qtext> [^\x{9}\x{10}\x{13}\x{7f}-\x{ff}\ "\\] ) 9483(?<text> [^\r\n] ) 9484(?<word> (?&atom) | (?"ed_string) ) 9485) # End DEFINE 9486^(?&mailbox)$/ 9487 Alan Other <user\@dom.ain> 9488 0: Alan Other <[email protected]> 9489 <user\@dom.ain> 9490 0: <[email protected]> 9491 user\@dom.ain 9492 0: [email protected] 9493 user\@[] 9494 0: user@[] 9495 user\@[domain literal] 9496 0: user@[domain literal] 9497 user\@[domain literal with \"[square brackets\"] inside] 9498 0: user@[domain literal with "[square brackets"] inside] 9499 \"A. Other\" <user.1234\@dom.ain> (a comment) 9500 0: "A. Other" <[email protected]> (a comment) 9501 A. Other <user.1234\@dom.ain> (a comment) 9502 0: A. Other <[email protected]> (a comment) 9503 \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay 9504 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay 9505\= Expect no match 9506 A missing angle <user\@some.where 9507No match 9508 The quick brown fox 9509No match 9510 9511# -------------------------------------------------------------------------- 9512 9513# This pattern uses named groups to match default PCRE2 patterns. It's another 9514# heavy test for named subpatterns. Once again, code slash as \x{2f} and escape 9515# $ even in classes so that this works with pcre2test. 9516 9517/(?sx)(?(DEFINE) 9518 9519(?<assertion> (?&simple_assertion) | (?&lookaround) ) 9520 9521(?<atomic_group> \( \? > (?®ex) \) ) 9522 9523(?<back_reference> \\ \d+ | 9524 \\g (?: [+-]?\d+ | \{ (?: [+-]?\d+ | (?&groupname) ) \} ) | 9525 \\k <(?&groupname)> | 9526 \\k '(?&groupname)' | 9527 \\k \{ (?&groupname) \} | 9528 \( \? P= (?&groupname) \) ) 9529 9530(?<branch> (?:(?&assertion) | 9531 (?&callout) | 9532 (?&comment) | 9533 (?&option_setting) | 9534 (?&qualified_item) | 9535 (?"ed_string) | 9536 (?"ed_string_empty) | 9537 (?&special_escape) | 9538 (?&verb) 9539 )* ) 9540 9541(?<callout> \(\?C (?: \d+ | 9542 (?: (?<D>["'`^%\#\$]) 9543 (?: \k'D'\k'D' | (?!\k'D') . )* \k'D' | 9544 \{ (?: \}\} | [^}]*+ )* \} ) 9545 )? \) ) 9546 9547(?<capturing_group> \( (?: \? P? < (?&groupname) > | \? ' (?&groupname) ' )? 9548 (?®ex) \) ) 9549 9550(?<character_class> \[ \^?+ (?: \] (?&class_item)* | (?&class_item)+ ) \] ) 9551 9552(?<character_type> (?! \\N\{\w+\} ) \\ [dDsSwWhHvVRN] ) 9553 9554(?<class_item> (?: \[ : (?: 9555 alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print| 9556 punct|space|upper|word|xdigit 9557 ) : \] | 9558 (?"ed_string) | 9559 (?"ed_string_empty) | 9560 (?&escaped_character) | 9561 (?&character_type) | 9562 [^]] ) ) 9563 9564(?<comment> \(\?\# [^)]* \) | (?"ed_string_empty) | \\E ) 9565 9566(?<condition> (?: \( [+-]? \d+ \) | 9567 \( < (?&groupname) > \) | 9568 \( ' (?&groupname) ' \) | 9569 \( R \d* \) | 9570 \( R & (?&groupname) \) | 9571 \( (?&groupname) \) | 9572 \( DEFINE \) | 9573 \( VERSION >?=\d+(?:\.\d\d?)? \) | 9574 (?&callout)?+ (?&comment)* (?&lookaround) ) ) 9575 9576(?<conditional_group> \(\? (?&condition) (?&branch) (?: \| (?&branch) )? \) ) 9577 9578(?<delimited_regex> (?<delimiter> [-\x{2f}!"'`=_:;,%&@~]) (?®ex) 9579 \k'delimiter' .* ) 9580 9581(?<escaped_character> \\ (?: 0[0-7]{1,2} | [0-7]{1,3} | o\{ [0-7]+ \} | 9582 x \{ (*COMMIT) [[:xdigit:]]* \} | x [[:xdigit:]]{0,2} | 9583 [aefnrt] | c[[:print:]] | 9584 [^[:alnum:]] ) ) 9585 9586(?<group> (?&capturing_group) | (?&non_capturing_group) | 9587 (?&resetting_group) | (?&atomic_group) | 9588 (?&conditional_group) ) 9589 9590(?<groupname> [a-zA-Z_]\w* ) 9591 9592(?<literal_character> (?! (?&range_qualifier) ) [^[()|*+?.\$\\] ) 9593 9594(?<lookaround> \(\? (?: = | ! | <= | <! ) (?®ex) \) ) 9595 9596(?<non_capturing_group> \(\? [iJmnsUx-]* : (?®ex) \) ) 9597 9598(?<option_setting> \(\? [iJmnsUx-]* \) ) 9599 9600(?<qualified_item> (?:\. | 9601 (?&lookaround) | 9602 (?&back_reference) | 9603 (?&character_class) | 9604 (?&character_type) | 9605 (?&escaped_character) | 9606 (?&group) | 9607 (?&subroutine_call) | 9608 (?&literal_character) | 9609 (?"ed_string) 9610 ) (?&comment)? (?&qualifier)? ) 9611 9612(?<qualifier> (?: [?*+] | (?&range_qualifier) ) [+?]? ) 9613 9614(?<quoted_string> (?: \\Q (?: (?!\\E | \k'delimiter') . )++ (?: \\E | ) ) ) 9615 9616(?<quoted_string_empty> \\Q\\E ) 9617 9618(?<range_qualifier> \{ (?: \d+ (?: , \d* )? | , \d+ ) \} ) 9619 9620(?<regex> (?&start_item)* (?&branch) (?: \| (?&branch) )* ) 9621 9622(?<resetting_group> \( \? \| (?®ex) \) ) 9623 9624(?<simple_assertion> \^ | \$ | \\A | \\b | \\B | \\G | \\z | \\Z ) 9625 9626(?<special_escape> \\K ) 9627 9628(?<start_item> \( \* (?: 9629 ANY | 9630 ANYCRLF | 9631 BSR_ANYCRLF | 9632 BSR_UNICODE | 9633 CR | 9634 CRLF | 9635 LF | 9636 LIMIT_MATCH=\d+ | 9637 LIMIT_DEPTH=\d+ | 9638 LIMIT_HEAP=\d+ | 9639 NOTEMPTY | 9640 NOTEMPTY_ATSTART | 9641 NO_AUTO_POSSESS | 9642 NO_DOTSTAR_ANCHOR | 9643 NO_JIT | 9644 NO_START_OPT | 9645 NUL | 9646 UTF | 9647 UCP ) \) ) 9648 9649(?<subroutine_call> (?: \(\?R\) | \(\?[+-]?\d+\) | 9650 \(\? (?: & | P> ) (?&groupname) \) | 9651 \\g < (?&groupname) > | 9652 \\g ' (?&groupname) ' | 9653 \\g < [+-]? \d+ > | 9654 \\g ' [+-]? \d+ ) ) 9655 9656(?<verb> \(\* (?: ACCEPT | FAIL | F | COMMIT | 9657 (?:MARK)?:(?&verbname) | 9658 (?:PRUNE|SKIP|THEN) (?: : (?&verbname)? )? ) \) ) 9659 9660(?<verbname> [^)]+ ) 9661 9662) # End DEFINE 9663# Kick it all off... 9664^(?&delimited_regex)$/subject_literal,jitstack=256 9665 /^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/ 9666 0: /^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/ 9667 /(cat(a(ract|tonic)|erpillar)) \1()2(3)/ 9668 0: /(cat(a(ract|tonic)|erpillar)) \1()2(3)/ 9669 /^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]/ 9670 0: /^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]/ 9671 /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/ 9672 0: /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/ 9673 /<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 9674 0: /<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 9675 /^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) / 9676 0: /^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) / 9677 /(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/ 9678 0: /(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/ 9679 /\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/ 9680 0: /\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/ 9681 /^(\w++|\s++)*$/ 9682 0: /^(\w++|\s++)*$/ 9683 /a+b?(*THEN)c+(*FAIL)/ 9684 0: /a+b?(*THEN)c+(*FAIL)/ 9685 /(A (A|B(*ACCEPT)|C) D)(E)/x 9686 0: /(A (A|B(*ACCEPT)|C) D)(E)/x 9687 /^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i 9688 0: /^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i 9689 /A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/B 9690 0: /A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/B 9691 /(?C`a``b`)(?C'a''b')(?C"a""b")(?C^a^^b^)(?C%a%%b%)(?C#a##b#)(?C$a$$b$)(?C{a}}b})/B,callout_info 9692 0: /(?C`a``b`)(?C'a''b')(?C"a""b")(?C^a^^b^)(?C%a%%b%)(?C#a##b#)(?C$a$$b$)(?C{a}}b})/B,callout_info 9693 /(?sx)(?(DEFINE)(?<assertion> (?&simple_assertion) | (?&lookaround) )(?<atomic_group> \( \? > (?®ex) \) )(?<back_reference> \\ \d+ | \\g (?: [+-]?\d+ | \{ (?: [+-]?\d+ | (?&groupname) ) \} ) | \\k <(?&groupname)> | \\k '(?&groupname)' | \\k \{ (?&groupname) \} | \( \? P= (?&groupname) \) )(?<branch> (?:(?&assertion) | (?&callout) | (?&comment) | (?&option_setting) | (?&qualified_item) | (?"ed_string) | (?"ed_string_empty) | (?&special_escape) | (?&verb) )* )(?<callout> \(\?C (?: \d+ | (?: (?<D>["'`^%\#\$]) (?: \k'D'\k'D' | (?!\k'D') . )* \k'D' | \{ (?: \}\} | [^}]*+ )* \} ) )? \) )(?<capturing_group> \( (?: \? P? < (?&groupname) > | \? ' (?&groupname) ' )? (?®ex) \) )(?<character_class> \[ \^?+ (?: \] (?&class_item)* | (?&class_item)+ ) \] )(?<character_type> (?! \\N\{\w+\} ) \\ [dDsSwWhHvVRN] )(?<class_item> (?: \[ : (?: alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print| punct|space|upper|word|xdigit ) : \] | (?"ed_string) | (?"ed_string_empty) | (?&escaped_character) | (?&character_type) | [^]] ) )(?<comment> \(\?\# [^)]* \) | (?"ed_string_empty) | \\E )(?<condition> (?: \( [+-]? \d+ \) | \( < (?&groupname) > \) | \( ' (?&groupname) ' \) | \( R \d* \) | \( R & (?&groupname) \) | \( (?&groupname) \) | \( DEFINE \) | \( VERSION >?=\d+(?:\.\d\d?)? \) | (?&callout)?+ (?&comment)* (?&lookaround) ) )(?<conditional_group> \(\? (?&condition) (?&branch) (?: \| (?&branch) )? \) )(?<delimited_regex> (?<delimiter> [-\x{2f}!"'`=_:;,%&@~]) (?®ex) \k'delimiter' .* )(?<escaped_character> \\ (?: 0[0-7]{1,2} | [0-7]{1,3} | o\{ [0-7]+ \} | x \{ (*COMMIT) [[:xdigit:]]* \} | x [[:xdigit:]]{0,2} | [aefnrt] | c[[:print:]] | [^[:alnum:]] ) )(?<group> (?&capturing_group) | (?&non_capturing_group) | (?&resetting_group) | (?&atomic_group) | (?&conditional_group) )(?<groupname> [a-zA-Z_]\w* )(?<literal_character> (?! (?&range_qualifier) ) [^[()|*+?.\$\\] )(?<lookaround> \(\? (?: = | ! | <= | <! ) (?®ex) \) )(?<non_capturing_group> \(\? [iJmnsUx-]* : (?®ex) \) )(?<option_setting> \(\? [iJmnsUx-]* \) )(?<qualified_item> (?:\. | (?&lookaround) | (?&back_reference) | (?&character_class) | (?&character_type) | (?&escaped_character) | (?&group) | (?&subroutine_call) | (?&literal_character) | (?"ed_string) ) (?&comment)? (?&qualifier)? )(?<qualifier> (?: [?*+] | (?&range_qualifier) ) [+?]? )(?<quoted_string> (?: \\Q (?: (?!\\E | \k'delimiter') . )++ (?: \\E | ) ) ) (?<quoted_string_empty> \\Q\\E ) (?<range_qualifier> \{ (?: \d+ (?: , \d* )? | , \d+ ) \} )(?<regex> (?&start_item)* (?&branch) (?: \| (?&branch) )* )(?<resetting_group> \( \? \| (?®ex) \) )(?<simple_assertion> \^ | \$ | \\A | \\b | \\B | \\G | \\z | \\Z )(?<special_escape> \\K )(?<start_item> \( \* (?: ANY | ANYCRLF | BSR_ANYCRLF | BSR_UNICODE | CR | CRLF | LF | LIMIT_MATCH=\d+ | LIMIT_DEPTH=\d+ | LIMIT_HEAP=\d+ | NOTEMPTY | NOTEMPTY_ATSTART | NO_AUTO_POSSESS | NO_DOTSTAR_ANCHOR | NO_JIT | NO_START_OPT | NUL | UTF | UCP ) \) )(?<subroutine_call> (?: \(\?R\) | \(\?[+-]?\d+\) | \(\? (?: & | P> ) (?&groupname) \) | \\g < (?&groupname) > | \\g ' (?&groupname) ' | \\g < [+-]? \d+ > | \\g ' [+-]? \d+ ) )(?<verb> \(\* (?: ACCEPT | FAIL | F | COMMIT | (?:MARK)?:(?&verbname) | (?:PRUNE|SKIP|THEN) (?: : (?&verbname)? )? ) \) )(?<verbname> [^)]+ ))^(?&delimited_regex)$/ 9694 0: /(?sx)(?(DEFINE)(?<assertion> (?&simple_assertion) | (?&lookaround) )(?<atomic_group> \( \? > (?®ex) \) )(?<back_reference> \\ \d+ | \\g (?: [+-]?\d+ | \{ (?: [+-]?\d+ | (?&groupname) ) \} ) | \\k <(?&groupname)> | \\k '(?&groupname)' | \\k \{ (?&groupname) \} | \( \? P= (?&groupname) \) )(?<branch> (?:(?&assertion) | (?&callout) | (?&comment) | (?&option_setting) | (?&qualified_item) | (?"ed_string) | (?"ed_string_empty) | (?&special_escape) | (?&verb) )* )(?<callout> \(\?C (?: \d+ | (?: (?<D>["'`^%\#\$]) (?: \k'D'\k'D' | (?!\k'D') . )* \k'D' | \{ (?: \}\} | [^}]*+ )* \} ) )? \) )(?<capturing_group> \( (?: \? P? < (?&groupname) > | \? ' (?&groupname) ' )? (?®ex) \) )(?<character_class> \[ \^?+ (?: \] (?&class_item)* | (?&class_item)+ ) \] )(?<character_type> (?! \\N\{\w+\} ) \\ [dDsSwWhHvVRN] )(?<class_item> (?: \[ : (?: alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print| punct|space|upper|word|xdigit ) : \] | (?"ed_string) | (?"ed_string_empty) | (?&escaped_character) | (?&character_type) | [^]] ) )(?<comment> \(\?\# [^)]* \) | (?"ed_string_empty) | \\E )(?<condition> (?: \( [+-]? \d+ \) | \( < (?&groupname) > \) | \( ' (?&groupname) ' \) | \( R \d* \) | \( R & (?&groupname) \) | \( (?&groupname) \) | \( DEFINE \) | \( VERSION >?=\d+(?:\.\d\d?)? \) | (?&callout)?+ (?&comment)* (?&lookaround) ) )(?<conditional_group> \(\? (?&condition) (?&branch) (?: \| (?&branch) )? \) )(?<delimited_regex> (?<delimiter> [-\x{2f}!"'`=_:;,%&@~]) (?®ex) \k'delimiter' .* )(?<escaped_character> \\ (?: 0[0-7]{1,2} | [0-7]{1,3} | o\{ [0-7]+ \} | x \{ (*COMMIT) [[:xdigit:]]* \} | x [[:xdigit:]]{0,2} | [aefnrt] | c[[:print:]] | [^[:alnum:]] ) )(?<group> (?&capturing_group) | (?&non_capturing_group) | (?&resetting_group) | (?&atomic_group) | (?&conditional_group) )(?<groupname> [a-zA-Z_]\w* )(?<literal_character> (?! (?&range_qualifier) ) [^[()|*+?.\$\\] )(?<lookaround> \(\? (?: = | ! | <= | <! ) (?®ex) \) )(?<non_capturing_group> \(\? [iJmnsUx-]* : (?®ex) \) )(?<option_setting> \(\? [iJmnsUx-]* \) )(?<qualified_item> (?:\. | (?&lookaround) | (?&back_reference) | (?&character_class) | (?&character_type) | (?&escaped_character) | (?&group) | (?&subroutine_call) | (?&literal_character) | (?"ed_string) ) (?&comment)? (?&qualifier)? )(?<qualifier> (?: [?*+] | (?&range_qualifier) ) [+?]? )(?<quoted_string> (?: \\Q (?: (?!\\E | \k'delimiter') . )++ (?: \\E | ) ) ) (?<quoted_string_empty> \\Q\\E ) (?<range_qualifier> \{ (?: \d+ (?: , \d* )? | , \d+ ) \} )(?<regex> (?&start_item)* (?&branch) (?: \| (?&branch) )* )(?<resetting_group> \( \? \| (?®ex) \) )(?<simple_assertion> \^ | \$ | \\A | \\b | \\B | \\G | \\z | \\Z )(?<special_escape> \\K )(?<start_item> \( \* (?: ANY | ANYCRLF | BSR_ANYCRLF | BSR_UNICODE | CR | CRLF | LF | LIMIT_MATCH=\d+ | LIMIT_DEPTH=\d+ | LIMIT_HEAP=\d+ | NOTEMPTY | NOTEMPTY_ATSTART | NO_AUTO_POSSESS | NO_DOTSTAR_ANCHOR | NO_JIT | NO_START_OPT | NUL | UTF | UCP ) \) )(?<subroutine_call> (?: \(\?R\) | \(\?[+-]?\d+\) | \(\? (?: & | P> ) (?&groupname) \) | \\g < (?&groupname) > | \\g ' (?&groupname) ' | \\g < [+-]? \d+ > | \\g ' [+-]? \d+ ) )(?<verb> \(\* (?: ACCEPT | FAIL | F | COMMIT | (?:MARK)?:(?&verbname) | (?:PRUNE|SKIP|THEN) (?: : (?&verbname)? )? ) \) )(?<verbname> [^)]+ ))^(?&delimited_regex)$/ 9695\= Expect no match 9696 /((?(?C'')\QX\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/ 9697No match 9698 /(?:(?(2y)a|b)(X))+/ 9699No match 9700 /a(*MARK)b/ 9701No match 9702 /a(*CR)b/ 9703No match 9704 /(?P<abn>(?P=abn)(?<badstufxxx)/ 9705No match 9706 9707# -------------------------------------------------------------------------- 9708 9709/<(?x:[a b])>/xx 9710 < > 9711 0: < > 9712 9713/<(?:[a b])>/xx 9714 < > 9715No match 9716 9717/<(?xxx:[a b])>/ 9718 < > 9719No match 9720 9721/<(?-x:[a b])>/xx 9722 < > 9723 0: < > 9724 9725/[[:digit:]-]+/ 9726 12-24 9727 0: 12-24 9728 9729/((?<=((*ACCEPT)) )\1?\b) / 9730\= Expect no match 9731 ((?<=((*ACCEPT)) )\\1?\\b)\x20 9732No match 9733 9734/((?<=((*ACCEPT))X)\1?Y)\1/ 9735 XYYZ 9736 0: YY 9737 1: Y 9738 2: 9739 9740/((?<=((*ACCEPT))X)\1?Y(*ACCEPT))\1/ 9741 XYYZ 9742 0: Y 9743 1: Y 9744 2: 9745 9746/(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/ 9747 aa 9748 0: aa 9749 a 9750 0: a 9751 9752/^(a?)b(?1)a/ 9753 abaa 9754 0: abaa 9755 1: a 9756 aba 9757 0: aba 9758 1: a 9759 baa 9760 0: baa 9761 1: 9762 ba 9763 0: ba 9764 1: 9765 9766/^(a?)+b(?1)a/ 9767 abaa 9768 0: abaa 9769 1: 9770 aba 9771 0: aba 9772 1: 9773 baa 9774 0: baa 9775 1: 9776 ba 9777 0: ba 9778 1: 9779 9780/^(a?)++b(?1)a/ 9781 abaa 9782 0: abaa 9783 1: 9784 aba 9785 0: aba 9786 1: 9787 baa 9788 0: baa 9789 1: 9790 ba 9791 0: ba 9792 1: 9793 9794/^(a?)+b/ 9795 b 9796 0: b 9797 1: 9798 ab 9799 0: ab 9800 1: 9801 aaab 9802 0: aaab 9803 1: 9804 9805/(?=a+)a(a+)++b/ 9806 aab 9807 0: aab 9808 1: a 9809 9810/(?<=\G.)/g,aftertext 9811 abc 9812 0: 9813 0+ bc 9814 0: 9815 0+ c 9816 0: 9817 0+ 9818 9819/(?<=(?=.)?)/ 9820 9821/(?<=(?=.)?+)/ 9822 9823/(?<=(?=.)*)/ 9824 9825/(?<=(?=.){4,5})/ 9826 9827/(?<=(?=.){4,5}x)/ 9828 9829/a(?=.(*:X))(*SKIP:X)(*F)|(.)/ 9830 abc 9831 0: a 9832 1: a 9833 9834/a(?>(*:X))(*SKIP:X)(*F)|(.)/ 9835 abc 9836 0: a 9837 1: a 9838 9839/a(?:(*:X))(*SKIP:X)(*F)|(.)/ 9840 abc 9841 0: b 9842 1: b 9843 9844#pattern no_start_optimize 9845 9846/(?>a(*:1))(?>b(*:1))(*SKIP:1)x|.*/ 9847 abc 9848 0: abc 9849 9850/(?>a(*:1))(?>b)(*SKIP:1)x|.*/ 9851 abc 9852 0: abc 9853 9854#subject mark 9855 9856/a(*ACCEPT:X)b/ 9857 abc 9858 0: a 9859MK: X 9860 9861/(?=a(*ACCEPT:QQ)bc)axyz/ 9862 axyz 9863 0: axyz 9864MK: QQ 9865 9866/(?(DEFINE)(a(*ACCEPT:X)))(?1)b/ 9867 abc 9868 0: ab 9869MK: X 9870 9871/a(*F:X)b/ 9872 abc 9873No match, mark = X 9874 9875/(?(DEFINE)(a(*F:X)))(?1)b/ 9876 abc 9877No match, mark = X 9878 9879/a(*COMMIT:X)b/ 9880 abc 9881 0: ab 9882MK: X 9883 9884/(?(DEFINE)(a(*COMMIT:X)))(?1)b/ 9885 abc 9886 0: ab 9887MK: X 9888 9889/a+(*:Z)b(*COMMIT:X)(*SKIP:Z)c|.*/ 9890 aaaabd 9891 0: bd 9892 9893/a+(*:Z)b(*COMMIT:X)(*SKIP:X)c|.*/ 9894 aaaabd 9895No match, mark = X 9896 9897/a(*COMMIT:X)b/ 9898 axabc 9899No match, mark = X 9900 9901#pattern -no_start_optimize 9902#subject -mark 9903 9904/(.COMMIT)(*COMMIT::::::::::interal error:::)/ 9905 9906/(*COMMIT:��)/ 9907 9908/(*COMMIT:]w)/ 9909 9910/(?i)A(?^)B(?^x:C D)(?^i)e f/ 9911 aBCDE F 9912 0: aBCDE F 9913\= Expect no match 9914 aBCDEF 9915No match 9916 AbCDe f 9917No match 9918 9919/(*pla:foo).{6}/ 9920 abcfoobarxyz 9921 0: foobar 9922\= Expect no match 9923 abcfooba 9924No match 9925 9926/(*positive_lookahead:foo).{6}/ 9927 abcfoobarxyz 9928 0: foobar 9929 9930/(?(*pla:foo).{6}|a..)/ 9931 foobarbaz 9932 0: foobar 9933 abcfoobar 9934 0: abc 9935 9936/(?(*positive_lookahead:foo).{6}|a..)/ 9937 foobarbaz 9938 0: foobar 9939 abcfoobar 9940 0: abc 9941 9942/(*plb:foo)bar/ 9943 abcfoobar 9944 0: bar 9945\= Expect no match 9946 abcbarfoo 9947No match 9948 9949/(*positive_lookbehind:foo)bar/ 9950 abcfoobar 9951 0: bar 9952\= Expect no match 9953 abcbarfoo 9954No match 9955 9956/(?(*plb:foo)bar|baz)/ 9957 abcfoobar 9958 0: bar 9959 bazfoobar 9960 0: baz 9961 abcbazfoobar 9962 0: baz 9963 foobazfoobar 9964 0: bar 9965 9966/(?(*positive_lookbehind:foo)bar|baz)/ 9967 abcfoobar 9968 0: bar 9969 bazfoobar 9970 0: baz 9971 abcbazfoobar 9972 0: baz 9973 foobazfoobar 9974 0: bar 9975 9976/(*nlb:foo)bar/ 9977 abcbarfoo 9978 0: bar 9979\= Expect no match 9980 abcfoobar 9981No match 9982 9983/(*negative_lookbehind:foo)bar/ 9984 abcbarfoo 9985 0: bar 9986\= Expect no match 9987 abcfoobar 9988No match 9989 9990/(?(*nlb:foo)bar|baz)/ 9991 abcfoobaz 9992 0: baz 9993 abcbarbaz 9994 0: bar 9995\= Expect no match 9996 abcfoobar 9997No match 9998 9999/(?(*negative_lookbehind:foo)bar|baz)/ 10000 abcfoobaz 10001 0: baz 10002 abcbarbaz 10003 0: bar 10004\= Expect no match 10005 abcfoobar 10006No match 10007 10008/(*atomic:a+)\w/ 10009 aaab 10010 0: aaab 10011\= Expect no match 10012 aaaa 10013No match 10014 10015/ (?<word> \w+ )* \. /xi 10016 pokus. 10017 0: pokus. 10018 1: pokus 10019 10020/(?(DEFINE) (?<word> \w+ ) ) (?&word)* \./xi 10021 pokus. 10022 0: pokus. 10023 10024/(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* ) \./xi 10025 pokus. 10026 0: pokus. 10027 1: <unset> 10028 2: pokus 10029 10030/(?&word)* (?(DEFINE) (?<word> \w+ ) ) \./xi 10031 pokus. 10032 0: pokus. 10033 10034/(?&word)* \. (?<word> \w+ )/xi 10035 pokus.hokus 10036 0: pokus.hokus 10037 1: hokus 10038 10039/a(?(?=(*:2)b).)/mark 10040 abc 10041 0: ab 10042MK: 2 10043 acb 10044 0: a 10045 10046/a(?(?!(*:2)b).)/mark 10047 acb 10048 0: ac 10049 abc 10050 0: a 10051MK: 2 10052 10053/(?:a|ab){1}+c/ 10054\= Expect no match 10055 abc 10056No match 10057 10058/(a|ab){1}+c/ 10059 abc 10060No match 10061 10062/(a+){1}+a/ 10063\= Expect no match 10064 aaaa 10065No match 10066 10067/(?(DEFINE)(a|ab))(?1){1}+c/ 10068 abc 10069No match 10070 10071/(?:a|(?=b)|.)*\z/ 10072 abc 10073 0: abc 10074 10075/(?:a|(?=b)|.)*/ 10076 abc 10077 0: a 10078 10079/(?<=a(*SKIP)x)|c/ 10080 abcd 10081No match 10082 10083/(?<=a(*SKIP)x)|d/ 10084 abcd 10085 0: d 10086 10087/(?<=(?=.(?<=x)))/aftertext 10088 abx 10089 0: 10090 0+ x 10091 10092/(?<=(?=(?<=a)))b/ 10093 ab 10094 0: b 10095 10096/^(?<A>a)(?(<A>)b)((?<=b).*)$/ 10097 abc 10098 0: abc 10099 1: a 10100 2: c 10101 10102/^(a\1?){4}$/ 10103 aaaa 10104 0: aaaa 10105 1: a 10106 aaaaaa 10107 0: aaaaaa 10108 1: aa 10109 10110/^((\1+)|\d)+133X$/ 10111 111133X 10112 0: 111133X 10113 1: 11 10114 2: 11 10115 10116/^(?>.*?([A-Z])(?!.*\1)){26}/i 10117 The quick brown fox jumps over the lazy dog. 10118 0: The quick brown fox jumps over the lazy dog 10119 1: g 10120 Jackdaws love my big sphinx of quartz. 10121 0: Jackdaws love my big sphinx of quartz 10122 1: z 10123 Pack my box with five dozen liquor jugs. 10124 0: Pack my box with five dozen liquor jugs 10125 1: s 10126\= Expect no match 10127 The quick brown fox jumps over the lazy cat. 10128No match 10129 Hackdaws love my big sphinx of quartz. 10130No match 10131 Pack my fox with five dozen liquor jugs. 10132No match 10133 10134/(?<=X(?(DEFINE)(A)))X(*F)/ 10135\= Expect no match 10136 AXYZ 10137No match 10138 10139/(?<=X(?(DEFINE)(A)))./ 10140 AXYZ 10141 0: Y 10142 10143/(?<=X(?(DEFINE)(.*))Y)./ 10144 AXYZ 10145 0: Z 10146 10147/(?<=X(?(DEFINE)(Y))(?1))./ 10148 AXYZ 10149 0: Z 10150 10151/(?(DEFINE)(?<foo>bar))(?<![-a-z0-9])word/ 10152 word 10153 0: word 10154 10155/a{1,2,3}b/ 10156 a{1,2,3}b 10157 0: a{1,2,3}b 10158 10159/\214748364/ 10160 >\x{8c}748364< 10161 0: \x8c748364 10162 10163/a{65536/ 10164 >a{65536< 10165 0: a{65536 10166 10167/a\K.(?0)*/ 10168 abac 10169 0: c 10170 10171/(a\K.(?1)*)/ 10172 abac 10173 0: c 10174 1: abac 10175 10176# -------------------------------------------------------------------------- 10177# Perl-compatible tests of variable-length lookbehinds. 10178 10179/(?<=ab?c).../g 10180 abcdefgacxyz 10181 0: def 10182 0: xyz 10183 10184/(?<=PQR|ab?c).../g 10185 abcdefgacxyzPQR123 10186 0: def 10187 0: xyz 10188 0: 123 10189 10190/(?<=ab?c|PQR).../g 10191 abcdefgacxyzPQR123 10192 0: def 10193 0: xyz 10194 0: 123 10195 10196/(?<=PQ|ab?c).../g 10197 abcdefgacxyzPQR123 10198 0: def 10199 0: xyz 10200 0: R12 10201 10202/(?<=ab?c|PQ).../g 10203 abcdefgacxyzPQR123 10204 0: def 10205 0: xyz 10206 0: R12 10207 10208/(?<=a(b?c|d?e?e)f)X./g 10209 acfX1zzzaefX2zzzadeefX3zzzX4zzz 10210 0: X1 10211 1: c 10212 0: X2 10213 1: e 10214 0: X3 10215 1: dee 10216 10217/(?<!a(b?c|d?e?e)f)X./g 10218 acfX1zzzaefX2zzzadeefX3zzzX4zzz 10219 0: X4 10220 10221/(?(?<=ab?c)d|e)/ 10222 abcdefg 10223 0: d 10224 acdefg 10225 0: d 10226 axdefg 10227 0: e 10228 10229/(?<=\d{2,3}|ABC)./ 10230 ABCD 10231 0: D 10232 10233/(?<=(\d{1,255}))X/ 10234 1234X 10235 0: X 10236 1: 1234 10237 10238/(?<=a(b?c){3}d)X/ 10239 ZXacbccdXYZ 10240 0: X 10241 1: c 10242 10243/(?<=a(b?c){0}d)X/ 10244 ZXadXYZ 10245 0: X 10246 10247/(?<=a?(b?c){0}d)X./ 10248 ZXadXYZ 10249 0: XY 10250 10251/(?<=\R)X/ 10252 \x{0a}X 10253 0: X 10254 a\x{0a}X 10255 0: X 10256 a\x{0d}\x{0a}X 10257 0: X 10258 10259# -------------------------------------------------------------------------- 10260 10261# Altered interpretation of {,n} 10262 10263/a{,3}B/ 10264 XBBB 10265 0: B 10266 XaBBB 10267 0: aB 10268 XaaBBB 10269 0: aaB 10270 XaaaBBB 10271 0: aaaB 10272 XaaaaBBB 10273 0: aaaB 10274 10275# But {,} remains not a qualifier 10276 10277/a{,}B/ 10278 Xa{,}BBB 10279 0: a{,}B 10280\= Expect no match 10281 XBBB 10282No match 10283 XaBBB 10284No match 10285 10286# Checks for non-quantifiers after refactored code 10287 10288/X{/ 10289 ZZX{}YY 10290 0: X{ 10291 10292/X{A/ 10293 ZZX{ABC} 10294 0: X{A 10295 10296/X{}/ 10297 ZZX{}YZ 10298 0: X{} 10299 10300/X{1234/ 10301 ZZX{123456 10302 0: X{1234 10303 10304/X{12ABC}/ 10305 ZZX{12ABC}Y 10306 0: X{12ABC} 10307 10308/X{1,/ 10309 ZZX{1,... 10310 0: X{1, 10311 10312/X{,9/ 10313 ZZX{,9}abc 10314 0: X{,9 10315 10316/X{,9]/ 10317 ZZX{,9].. 10318 0: X{,9] 10319 10320# -------------------------------------------------------------------------- 10321 10322/(A)(?-1)(?+1)(B)/ 10323 xxAABBzz 10324 0: AABB 10325 1: A 10326 2: B 10327 10328/(A)(\g{ -2 }B)/ 10329 XAABX 10330 0: AAB 10331 1: A 10332 2: AB 10333 10334/(A)((?-2)B)/ 10335 XAABX 10336 0: AAB 10337 1: A 10338 2: AB 10339 10340/a\c\X/ 10341 --a\x1cX-- 10342 0: a\x1cX 10343 10344/(a)\g{ 1 }/ 10345 baab 10346 0: aa 10347 1: a 10348 10349/a{ 1,2 }/ 10350 Xaaaaa 10351 0: aa 10352 10353/a{ 1 , 2 }/ 10354 Xaaaaa 10355 0: aa 10356 10357/(?'name'ab)\k{ name }(?P=name)/ 10358 XabababX 10359 0: ababab 10360 1: ab 10361 10362/A{,}B/ 10363 A{,}B 10364 0: A{,}B 10365 10366/A{ , }B/ 10367 A{ , }B 10368 0: A{ , }B 10369 10370/A{ ,3}/ 10371 AAAAAACC 10372 0: AAA 10373 10374/A{ 3, }/ 10375 BBAAAAAACC 10376 0: AAAAAA 10377 10378# This pattern validates regular expression patterns. The original that I was 10379# sent was this: 10380# /^((?:(?:[^?+*{}()[\]\\|]+|\\.|\[(?:\^?\\.|\^[^\\]|[^\\^])(?:[^\]\\]+|\\.)*\]|\((?:\?[:=!]|\?<[=!]|\?>)?(?1)??\)|\(\?(?:R|[+-]?\d+)\))(?:(?:[?+*]|\{\d+(?:,\d*)?\})[?+]?)?|\|)*)$/ 10381# This is not very readable, and also does not handle all features. I have done 10382# some work on it. 10383 10384/^ 10385(?<re> 10386# A regular expression is zero or more of these items. 10387 (?: 10388 # An item is one of these: 10389 (?: 10390 [^?+*{}()\[\]\\|]++| # Non-meta characters or unquoted . 10391 \\.| # Quoted . 10392 10393 \[ # Class, which is [ 10394 (?: # Followed by 10395 \^?\\.| # Optional ^ and any escaped character 10396 \^[^\\]| # OR ^ and not escaped character 10397 [^\\^] # OR neither ^ nor \ 10398 ) # Followed by 10399 (?:[^\]\\]+|\\.)*+ # Zero or more (not ] or \) OR escaped dot 10400 \]| # Class ends with ] 10401 10402 \( # Parenthesized group 10403 (?: # Start with optional 10404 \?[:=!]| # ? followed by : = ! 10405 \?<[=!]| # OR ?< followed by = or ! 10406 \?> # OR ?> 10407 )? 10408 (?&re)?? # Then a nested <re> 10409 \)| # End parenthesized group 10410 10411 \(\? # Other parenthesized items 10412 (?: # (? followed by 10413 R| # R 10414 [+-]?\d++ # Or optional +- and digits 10415 ) 10416 \)| # End parens 10417 10418 \(\* # Verbs 10419 (?: 10420 COMMIT| 10421 FAIL| 10422 MARK:[^)]*| 10423 (?:PRUNE|SKIP|THEN)(?::[^\)]*+)? 10424 ) 10425 \) 10426 ) # End list of items 10427 10428 # Followed by an optional quantifier 10429 10430 (?: 10431 (?: 10432 [?+*] # ?+* 10433 | # OR 10434 \{\d+ # { digits 10435 (?:,\d*)? # optionally followed by ,digits 10436 \} # then closing } 10437 | # OR 10438 \{,\d+} # {,digits} 10439 ) 10440 [?+]? # optional ungreedy or possessive 10441 )? 10442 10443 | # OR an "item" is a branch ending 10444 10445 \| 10446 10447 )* # Zero or more top-level items. 10448) # End regex group. 10449$/x 10450 [abcdef] 10451 0: [abcdef] 10452 1: [abcdef] 10453 [abc\\]def] 10454 0: [abc\]def] 10455 1: [abc\]def] 10456 a.b|abcd 10457 0: a.b|abcd 10458 1: a.b|abcd 10459 ab()d 10460 0: ab()d 10461 1: ab()d 10462 ab{1,3}d 10463 0: ab{1,3}d 10464 1: ab{1,3}d 10465 ab{,3}d 10466 0: ab{,3}d 10467 1: ab{,3}d 10468 ab(*FAIL)d(*COMMIT)(*SKIP)(*THEN:abc) 10469 0: ab(*FAIL)d(*COMMIT)(*SKIP)(*THEN:abc) 10470 1: ab(*FAIL)d(*COMMIT)(*SKIP)(*THEN:abc) 10471 ab(*MARK:xyz) 10472 0: ab(*MARK:xyz) 10473 1: ab(*MARK:xyz) 10474 (?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\\s]) 10475 0: (?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\s]) 10476 1: (?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\s]) 10477 abcd\\t\\n\\r\\f\\a\\e\\071\\x3b\\^\\\\\\?caxyz 10478 0: abcd\t\n\r\f\a\e\071\x3b\^\\\?caxyz 10479 1: abcd\t\n\r\f\a\e\071\x3b\^\\\?caxyz 10480 a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz 10481 0: a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz 10482 1: a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz 10483 \\G(?:(?=(\\1.|)(.))){1,13}?(?!.*\\2.*\\2)\\1\\K\\2 10484 0: \G(?:(?=(\1.|)(.))){1,13}?(?!.*\2.*\2)\1\K\2 10485 1: \G(?:(?=(\1.|)(.))){1,13}?(?!.*\2.*\2)\1\K\2 10486\= Expect no match 10487 ab)d 10488No match 10489 ab(d 10490No match 10491 {4,5} 10492No match 10493 a[]b 10494No match 10495 (a)(?(1)a|b|c) 10496No match 10497 10498/^..A(*SKIP)B|C/ 10499 12ADC 10500 0: C 10501 10502/(?<!a?)/ 10503 a 10504No match 10505 10506# End of testinput1 10507