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