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 /[\d-z]+/
   1866     12-34z
   1867 \= Expect no match
   1868     aaa
   1869 
   1870 /\x5c/
   1871     \\
   1872 
   1873 /\x20Z/
   1874     the Zoo
   1875 \= Expect no match
   1876     Zulu
   1877 
   1878 /ab{3cd/
   1879     ab{3cd
   1880 
   1881 /ab{3,cd/
   1882     ab{3,cd
   1883 
   1884 /ab{3,4a}cd/
   1885     ab{3,4a}cd
   1886 
   1887 /{4,5a}bc/
   1888     {4,5a}bc
   1889 
   1890 /^a.b/newline=lf
   1891     a\rb
   1892 \= Expect no match
   1893     a\nb
   1894 
   1895 /abc$/
   1896     abc
   1897     abc\n
   1898 \= Expect no match
   1899     abc\ndef
   1900 
   1901 /(abc)\123/
   1902     abc\x53
   1903 
   1904 /(abc)\223/
   1905     abc\x93
   1906 
   1907 /(abc)\323/
   1908     abc\xd3
   1909 
   1910 /(abc)\100/
   1911     abc\x40
   1912     abc\100
   1913 
   1914 /(abc)\1000/
   1915     abc\x400
   1916     abc\x40\x30
   1917     abc\1000
   1918     abc\100\x30
   1919     abc\100\060
   1920     abc\100\60
   1921 
   1922 /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
   1923     abcdefghijk\12S
   1924 
   1925 /a{0}bc/
   1926     bc
   1927 
   1928 /(a|(bc)){0,0}?xyz/
   1929     xyz
   1930 
   1931 /abc[\10]de/
   1932     abc\010de
   1933 
   1934 /abc[\1]de/
   1935     abc\1de
   1936 
   1937 /(abc)[\1]de/
   1938     abc\1de
   1939 
   1940 /(?s)a.b/
   1941     a\nb
   1942 
   1943 /^([^a])([^\b])([^c]*)([^d]{3,4})/
   1944     baNOTccccd
   1945     baNOTcccd
   1946     baNOTccd
   1947     bacccd
   1948 \= Expect no match
   1949     anything
   1950     b\bc   
   1951     baccd
   1952 
   1953 /[^a]/
   1954     Abc
   1955   
   1956 /[^a]/i
   1957     Abc 
   1958 
   1959 /[^a]+/
   1960     AAAaAbc
   1961   
   1962 /[^a]+/i
   1963     AAAaAbc 
   1964 
   1965 /[^a]+/
   1966     bbb\nccc
   1967    
   1968 /[^k]$/
   1969     abc
   1970 \= Expect no match
   1971     abk   
   1972    
   1973 /[^k]{2,3}$/
   1974     abc
   1975     kbc
   1976     kabc 
   1977 \= Expect no match
   1978     abk
   1979     akb
   1980     akk 
   1981 
   1982 /^\d{8,}\@.+[^k]$/
   1983     12345678\@a.b.c.d
   1984     123456789\@x.y.z
   1985 \= Expect no match
   1986     12345678\@x.y.uk
   1987     1234567\@a.b.c.d       
   1988 
   1989 /[^a]/
   1990     aaaabcd
   1991     aaAabcd 
   1992 
   1993 /[^a]/i
   1994     aaaabcd
   1995     aaAabcd 
   1996 
   1997 /[^az]/
   1998     aaaabcd
   1999     aaAabcd 
   2000 
   2001 /[^az]/i
   2002     aaaabcd
   2003     aaAabcd 
   2004 
   2005 /\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/
   2006  \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
   2007 
   2008 /P[^*]TAIRE[^*]{1,6}?LL/
   2009     xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
   2010 
   2011 /P[^*]TAIRE[^*]{1,}?LL/
   2012     xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
   2013 
   2014 /(\.\d\d[1-9]?)\d+/
   2015     1.230003938
   2016     1.875000282   
   2017     1.235  
   2018                   
   2019 /(\.\d\d((?=0)|\d(?=\d)))/
   2020     1.230003938      
   2021     1.875000282
   2022 \= Expect no match 
   2023     1.235 
   2024     
   2025 /a(?)b/
   2026     ab 
   2027  
   2028 /\b(foo)\s+(\w+)/i
   2029     Food is on the foo table
   2030     
   2031 /foo(.*)bar/
   2032     The food is under the bar in the barn.
   2033     
   2034 /foo(.*?)bar/
   2035     The food is under the bar in the barn.
   2036 
   2037 /(.*)(\d*)/no_auto_possess
   2038     I have 2 numbers: 53147
   2039     
   2040 /(.*)(\d+)/
   2041     I have 2 numbers: 53147
   2042  
   2043 /(.*?)(\d*)/no_auto_possess
   2044     I have 2 numbers: 53147
   2045 
   2046 /(.*?)(\d+)/
   2047     I have 2 numbers: 53147
   2048 
   2049 /(.*)(\d+)$/
   2050     I have 2 numbers: 53147
   2051 
   2052 /(.*?)(\d+)$/
   2053     I have 2 numbers: 53147
   2054 
   2055 /(.*)\b(\d+)$/
   2056     I have 2 numbers: 53147
   2057 
   2058 /(.*\D)(\d+)$/
   2059     I have 2 numbers: 53147
   2060 
   2061 /^\D*(?!123)/
   2062     ABC123
   2063      
   2064 /^(\D*)(?=\d)(?!123)/
   2065     ABC445
   2066 \= Expect no match
   2067     ABC123
   2068     
   2069 /^[W-]46]/
   2070     W46]789 
   2071     -46]789
   2072 \= Expect no match
   2073     Wall
   2074     Zebra
   2075     42
   2076     [abcd] 
   2077     ]abcd[
   2078        
   2079 /^[W-\]46]/
   2080     W46]789 
   2081     Wall
   2082     Zebra
   2083     Xylophone  
   2084     42
   2085     [abcd] 
   2086     ]abcd[
   2087     \\backslash 
   2088 \= Expect no match
   2089     -46]789
   2090     well
   2091     
   2092 /\d\d\/\d\d\/\d\d\d\d/
   2093     01/01/2000
   2094 
   2095 /word (?:[a-zA-Z0-9]+ ){0,10}otherword/
   2096   word cat dog elephant mussel cow horse canary baboon snake shark otherword
   2097 \= Expect no match
   2098   word cat dog elephant mussel cow horse canary baboon snake shark
   2099 
   2100 /word (?:[a-zA-Z0-9]+ ){0,300}otherword/
   2101 \= Expect no match
   2102   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
   2103 
   2104 /^(a){0,0}/
   2105     bcd
   2106     abc
   2107     aab     
   2108 
   2109 /^(a){0,1}/
   2110     bcd
   2111     abc
   2112     aab  
   2113 
   2114 /^(a){0,2}/
   2115     bcd
   2116     abc
   2117     aab  
   2118 
   2119 /^(a){0,3}/
   2120     bcd
   2121     abc
   2122     aab
   2123     aaa   
   2124 
   2125 /^(a){0,}/
   2126     bcd
   2127     abc
   2128     aab
   2129     aaa
   2130     aaaaaaaa    
   2131 
   2132 /^(a){1,1}/
   2133     abc
   2134     aab  
   2135 \= Expect no match
   2136     bcd
   2137 
   2138 /^(a){1,2}/
   2139     abc
   2140     aab  
   2141 \= Expect no match
   2142     bcd
   2143 
   2144 /^(a){1,3}/
   2145     abc
   2146     aab
   2147     aaa   
   2148 \= Expect no match
   2149     bcd
   2150 
   2151 /^(a){1,}/
   2152     abc
   2153     aab
   2154     aaa
   2155     aaaaaaaa    
   2156 \= Expect no match
   2157     bcd
   2158 
   2159 /.*\.gif/
   2160     borfle\nbib.gif\nno
   2161 
   2162 /.{0,}\.gif/
   2163     borfle\nbib.gif\nno
   2164 
   2165 /.*\.gif/m
   2166     borfle\nbib.gif\nno
   2167 
   2168 /.*\.gif/s
   2169     borfle\nbib.gif\nno
   2170 
   2171 /.*\.gif/ms
   2172     borfle\nbib.gif\nno
   2173     
   2174 /.*$/
   2175     borfle\nbib.gif\nno
   2176 
   2177 /.*$/m
   2178     borfle\nbib.gif\nno
   2179 
   2180 /.*$/s
   2181     borfle\nbib.gif\nno
   2182 
   2183 /.*$/ms
   2184     borfle\nbib.gif\nno
   2185     
   2186 /.*$/
   2187     borfle\nbib.gif\nno\n
   2188 
   2189 /.*$/m
   2190     borfle\nbib.gif\nno\n
   2191 
   2192 /.*$/s
   2193     borfle\nbib.gif\nno\n
   2194 
   2195 /.*$/ms
   2196     borfle\nbib.gif\nno\n
   2197     
   2198 /(.*X|^B)/
   2199     abcde\n1234Xyz
   2200     BarFoo 
   2201 \= Expect no match
   2202     abcde\nBar  
   2203 
   2204 /(.*X|^B)/m
   2205     abcde\n1234Xyz
   2206     BarFoo 
   2207     abcde\nBar  
   2208 
   2209 /(.*X|^B)/s
   2210     abcde\n1234Xyz
   2211     BarFoo 
   2212 \= Expect no match
   2213     abcde\nBar  
   2214 
   2215 /(.*X|^B)/ms
   2216     abcde\n1234Xyz
   2217     BarFoo 
   2218     abcde\nBar  
   2219 
   2220 /(?s)(.*X|^B)/
   2221     abcde\n1234Xyz
   2222     BarFoo 
   2223 \= Expect no match 
   2224     abcde\nBar  
   2225 
   2226 /(?s:.*X|^B)/
   2227     abcde\n1234Xyz
   2228     BarFoo 
   2229 \= Expect no match 
   2230     abcde\nBar  
   2231 
   2232 /^.*B/
   2233 \= Expect no match
   2234     abc\nB
   2235      
   2236 /(?s)^.*B/
   2237     abc\nB
   2238 
   2239 /(?m)^.*B/
   2240     abc\nB
   2241      
   2242 /(?ms)^.*B/
   2243     abc\nB
   2244 
   2245 /(?ms)^B/
   2246     abc\nB
   2247 
   2248 /(?s)B$/
   2249     B\n
   2250 
   2251 /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
   2252     123456654321
   2253   
   2254 /^\d\d\d\d\d\d\d\d\d\d\d\d/
   2255     123456654321 
   2256 
   2257 /^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
   2258     123456654321
   2259   
   2260 /^[abc]{12}/
   2261     abcabcabcabc
   2262     
   2263 /^[a-c]{12}/
   2264     abcabcabcabc
   2265     
   2266 /^(a|b|c){12}/
   2267     abcabcabcabc 
   2268 
   2269 /^[abcdefghijklmnopqrstuvwxy0123456789]/
   2270     n
   2271 \= Expect no match 
   2272     z 
   2273 
   2274 /abcde{0,0}/
   2275     abcd
   2276 \= Expect no match
   2277     abce  
   2278 
   2279 /ab[cd]{0,0}e/
   2280     abe
   2281 \= Expect no match
   2282     abcde 
   2283     
   2284 /ab(c){0,0}d/
   2285     abd
   2286 \= Expect no match
   2287     abcd   
   2288 
   2289 /a(b*)/
   2290     a
   2291     ab
   2292     abbbb
   2293 \= Expect no match
   2294     bbbbb    
   2295     
   2296 /ab\d{0}e/
   2297     abe
   2298 \= Expect no match
   2299     ab1e   
   2300     
   2301 /"([^\\"]+|\\.)*"/
   2302     the \"quick\" brown fox
   2303     \"the \\\"quick\\\" brown fox\" 
   2304 
   2305 /.*?/g,aftertext
   2306     abc
   2307   
   2308 /\b/g,aftertext
   2309     abc 
   2310 
   2311 /\b/g,aftertext
   2312     abc 
   2313 
   2314 //g
   2315     abc
   2316 
   2317 /<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
   2318   <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>
   2319 
   2320 /a[^a]b/
   2321     acb
   2322     a\nb
   2323     
   2324 /a.b/
   2325     acb
   2326 \= Expect no match 
   2327     a\nb   
   2328     
   2329 /a[^a]b/s
   2330     acb
   2331     a\nb  
   2332     
   2333 /a.b/s
   2334     acb
   2335     a\nb  
   2336 
   2337 /^(b+?|a){1,2}?c/
   2338     bac
   2339     bbac
   2340     bbbac
   2341     bbbbac
   2342     bbbbbac 
   2343 
   2344 /^(b+|a){1,2}?c/
   2345     bac
   2346     bbac
   2347     bbbac
   2348     bbbbac
   2349     bbbbbac 
   2350     
   2351 /(?!\A)x/m
   2352     a\bx\n  
   2353 \= Expect no match
   2354     x\nb\n
   2355     
   2356 /\x0{ab}/
   2357     \0{ab} 
   2358 
   2359 /(A|B)*?CD/
   2360     CD 
   2361     
   2362 /(A|B)*CD/
   2363     CD 
   2364 
   2365 /(?<!bar)foo/
   2366     foo
   2367     catfood
   2368     arfootle
   2369     rfoosh
   2370 \= Expect no match
   2371     barfoo
   2372     towbarfoo
   2373 
   2374 /\w{3}(?<!bar)foo/
   2375     catfood
   2376 \= Expect no match
   2377     foo
   2378     barfoo
   2379     towbarfoo
   2380 
   2381 /(?<=(foo)a)bar/
   2382     fooabar
   2383 \= Expect no match
   2384     bar
   2385     foobbar
   2386       
   2387 /\Aabc\z/m
   2388     abc
   2389 \= Expect no match
   2390     abc\n   
   2391     qqq\nabc
   2392     abc\nzzz
   2393     qqq\nabc\nzzz
   2394 
   2395 "(?>.*/)foo"
   2396 \= Expect no match
   2397     /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
   2398 
   2399 "(?>.*/)foo"
   2400     /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
   2401 
   2402 /(?>(\.\d\d[1-9]?))\d+/
   2403     1.230003938
   2404     1.875000282
   2405 \= Expect no match 
   2406     1.235 
   2407 
   2408 /^((?>\w+)|(?>\s+))*$/
   2409     now is the time for all good men to come to the aid of the party
   2410 \= Expect no match
   2411     this is not a line with only words and spaces!
   2412     
   2413 /(\d+)(\w)/
   2414     12345a
   2415     12345+ 
   2416 
   2417 /((?>\d+))(\w)/
   2418     12345a
   2419 \= Expect no match
   2420     12345+ 
   2421 
   2422 /(?>a+)b/
   2423     aaab
   2424 
   2425 /((?>a+)b)/
   2426     aaab
   2427 
   2428 /(?>(a+))b/
   2429     aaab
   2430 
   2431 /(?>b)+/
   2432     aaabbbccc
   2433 
   2434 /(?>a+|b+|c+)*c/
   2435     aaabbbbccccd
   2436     
   2437 /(a+|b+|c+)*c/
   2438     aaabbbbccccd
   2439 
   2440 /((?>[^()]+)|\([^()]*\))+/
   2441     ((abc(ade)ufh()()x
   2442     
   2443 /\(((?>[^()]+)|\([^()]+\))+\)/
   2444     (abc)
   2445     (abc(def)xyz)
   2446 \= Expect no match
   2447     ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa   
   2448 
   2449 /a(?-i)b/i
   2450     ab
   2451     Ab
   2452 \= Expect no match 
   2453     aB
   2454     AB
   2455         
   2456 /(a (?x)b c)d e/
   2457     a bcd e
   2458 \= Expect no match
   2459     a b cd e
   2460     abcd e   
   2461     a bcde 
   2462  
   2463 /(a b(?x)c d (?-x)e f)/
   2464     a bcde f
   2465 \= Expect no match
   2466     abcdef  
   2467 
   2468 /(a(?i)b)c/
   2469     abc
   2470     aBc
   2471 \= Expect no match
   2472     abC
   2473     aBC  
   2474     Abc
   2475     ABc
   2476     ABC
   2477     AbC
   2478     
   2479 /a(?i:b)c/
   2480     abc
   2481     aBc
   2482 \= Expect no match 
   2483     ABC
   2484     abC
   2485     aBC
   2486     
   2487 /a(?i:b)*c/
   2488     aBc
   2489     aBBc
   2490 \= Expect no match 
   2491     aBC
   2492     aBBC
   2493     
   2494 /a(?=b(?i)c)\w\wd/
   2495     abcd
   2496     abCd
   2497 \= Expect no match
   2498     aBCd
   2499     abcD     
   2500     
   2501 /(?s-i:more.*than).*million/i
   2502     more than million
   2503     more than MILLION
   2504     more \n than Million 
   2505 \= Expect no match
   2506     MORE THAN MILLION    
   2507     more \n than \n million 
   2508 
   2509 /(?:(?s-i)more.*than).*million/i
   2510     more than million
   2511     more than MILLION
   2512     more \n than Million 
   2513 \= Expect no match
   2514     MORE THAN MILLION    
   2515     more \n than \n million 
   2516     
   2517 /(?>a(?i)b+)+c/
   2518     abc
   2519     aBbc
   2520     aBBc 
   2521 \= Expect no match
   2522     Abc
   2523     abAb    
   2524     abbC 
   2525     
   2526 /(?=a(?i)b)\w\wc/
   2527     abc
   2528     aBc
   2529 \= Expect no match
   2530     Ab 
   2531     abC
   2532     aBC     
   2533     
   2534 /(?<=a(?i)b)(\w\w)c/
   2535     abxxc
   2536     aBxxc
   2537 \= Expect no match
   2538     Abxxc
   2539     ABxxc
   2540     abxxC      
   2541 
   2542 /^(?(?=abc)\w{3}:|\d\d)$/
   2543     abc:
   2544     12
   2545 \= Expect no match
   2546     123
   2547     xyz    
   2548 
   2549 /^(?(?!abc)\d\d|\w{3}:)$/
   2550     abc:
   2551     12
   2552 \= Expect no match
   2553     123
   2554     xyz    
   2555     
   2556 /(?(?<=foo)bar|cat)/
   2557     foobar
   2558     cat
   2559     fcat
   2560     focat   
   2561 \= Expect no match
   2562     foocat  
   2563 
   2564 /(?(?<!foo)cat|bar)/
   2565     foobar
   2566     cat
   2567     fcat
   2568     focat   
   2569 \= Expect no match
   2570     foocat  
   2571 
   2572 /(?>a*)*/
   2573     a
   2574     aa
   2575     aaaa
   2576     
   2577 /(abc|)+/
   2578     abc
   2579     abcabc
   2580     abcabcabc
   2581     xyz      
   2582 
   2583 /([a]*)*/
   2584     a
   2585     aaaaa 
   2586  
   2587 /([ab]*)*/
   2588     a
   2589     b
   2590     ababab
   2591     aaaabcde
   2592     bbbb    
   2593  
   2594 /([^a]*)*/
   2595     b
   2596     bbbb
   2597     aaa   
   2598  
   2599 /([^ab]*)*/
   2600     cccc
   2601     abab  
   2602  
   2603 /([a]*?)*/
   2604     a
   2605     aaaa 
   2606  
   2607 /([ab]*?)*/
   2608     a
   2609     b
   2610     abab
   2611     baba   
   2612  
   2613 /([^a]*?)*/
   2614     b
   2615     bbbb
   2616     aaa   
   2617  
   2618 /([^ab]*?)*/
   2619     c
   2620     cccc
   2621     baba   
   2622  
   2623 /(?>a*)*/
   2624     a
   2625     aaabcde 
   2626  
   2627 /((?>a*))*/
   2628     aaaaa
   2629     aabbaa 
   2630  
   2631 /((?>a*?))*/
   2632     aaaaa
   2633     aabbaa 
   2634 
   2635 /(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
   2636     12-sep-98
   2637     12-09-98
   2638 \= Expect no match
   2639     sep-12-98
   2640         
   2641 /(?i:saturday|sunday)/
   2642     saturday
   2643     sunday
   2644     Saturday
   2645     Sunday
   2646     SATURDAY
   2647     SUNDAY
   2648     SunDay
   2649     
   2650 /(a(?i)bc|BB)x/
   2651     abcx
   2652     aBCx
   2653     bbx
   2654     BBx
   2655 \= Expect no match
   2656     abcX
   2657     aBCX
   2658     bbX
   2659     BBX               
   2660 
   2661 /^([ab](?i)[cd]|[ef])/
   2662     ac
   2663     aC
   2664     bD
   2665     elephant
   2666     Europe 
   2667     frog
   2668     France
   2669 \= Expect no match
   2670     Africa     
   2671 
   2672 /^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
   2673     ab
   2674     aBd
   2675     xy
   2676     xY
   2677     zebra
   2678     Zambesi
   2679 \= Expect no match
   2680     aCD  
   2681     XY  
   2682 
   2683 /(?<=foo\n)^bar/m
   2684     foo\nbar
   2685 \= Expect no match
   2686     bar
   2687     baz\nbar   
   2688 
   2689 /(?<=(?<!foo)bar)baz/
   2690     barbaz
   2691     barbarbaz 
   2692     koobarbaz 
   2693 \= Expect no match
   2694     baz
   2695     foobarbaz 
   2696 
   2697 # The following tests are taken from the Perl 5.005 test suite; some of them
   2698 # are compatible with 5.004, but I'd rather not have to sort them out.
   2699 
   2700 /abc/
   2701     abc
   2702     xabcy
   2703     ababc
   2704 \= Expect no match
   2705     xbc
   2706     axc
   2707     abx
   2708 
   2709 /ab*c/
   2710     abc
   2711 
   2712 /ab*bc/
   2713     abc
   2714     abbc
   2715     abbbbc
   2716 
   2717 /.{1}/
   2718     abbbbc
   2719 
   2720 /.{3,4}/
   2721     abbbbc
   2722 
   2723 /ab{0,}bc/
   2724     abbbbc
   2725 
   2726 /ab+bc/
   2727     abbc
   2728 \= Expect no match
   2729     abc
   2730     abq
   2731 
   2732 /ab+bc/
   2733     abbbbc
   2734 
   2735 /ab{1,}bc/
   2736     abbbbc
   2737 
   2738 /ab{1,3}bc/
   2739     abbbbc
   2740 
   2741 /ab{3,4}bc/
   2742     abbbbc
   2743 
   2744 /ab{4,5}bc/
   2745 \= Expect no match
   2746     abq
   2747     abbbbc
   2748 
   2749 /ab?bc/
   2750     abbc
   2751     abc
   2752 
   2753 /ab{0,1}bc/
   2754     abc
   2755 
   2756 /ab?bc/
   2757 
   2758 /ab?c/
   2759     abc
   2760 
   2761 /ab{0,1}c/
   2762     abc
   2763 
   2764 /^abc$/
   2765     abc
   2766 \= Expect no match
   2767     abbbbc
   2768     abcc
   2769 
   2770 /^abc/
   2771     abcc
   2772 
   2773 /^abc$/
   2774 
   2775 /abc$/
   2776     aabc
   2777     aabc
   2778 \= Expect no match
   2779     aabcd
   2780 
   2781 /^/
   2782     abc
   2783 
   2784 /$/
   2785     abc
   2786 
   2787 /a.c/
   2788     abc
   2789     axc
   2790 
   2791 /a.*c/
   2792     axyzc
   2793 
   2794 /a[bc]d/
   2795     abd
   2796 \= Expect no match
   2797     axyzd
   2798     abc
   2799 
   2800 /a[b-d]e/
   2801     ace
   2802 
   2803 /a[b-d]/
   2804     aac
   2805 
   2806 /a[-b]/
   2807     a-
   2808 
   2809 /a[b-]/
   2810     a-
   2811 
   2812 /a]/
   2813     a]
   2814 
   2815 /a[]]b/
   2816     a]b
   2817 
   2818 /a[^bc]d/
   2819     aed
   2820 \= Expect no match
   2821     abd
   2822     abd
   2823 
   2824 /a[^-b]c/
   2825     adc
   2826 
   2827 /a[^]b]c/
   2828     adc
   2829     a-c
   2830 \= Expect no match
   2831     a]c
   2832 
   2833 /\ba\b/
   2834     a-
   2835     -a
   2836     -a-
   2837 
   2838 /\by\b/
   2839 \= Expect no match
   2840     xy
   2841     yz
   2842     xyz
   2843 
   2844 /\Ba\B/
   2845 \= Expect no match
   2846     a-
   2847     -a
   2848     -a-
   2849 
   2850 /\By\b/
   2851     xy
   2852 
   2853 /\by\B/
   2854     yz
   2855 
   2856 /\By\B/
   2857     xyz
   2858 
   2859 /\w/
   2860     a
   2861 
   2862 /\W/
   2863     -
   2864 \= Expect no match
   2865     a
   2866 
   2867 /a\sb/
   2868     a b
   2869 
   2870 /a\Sb/
   2871     a-b
   2872 \= Expect no match
   2873     a b
   2874 
   2875 /\d/
   2876     1
   2877 
   2878 /\D/
   2879     -
   2880 \= Expect no match
   2881     1
   2882 
   2883 /[\w]/
   2884     a
   2885 
   2886 /[\W]/
   2887     -
   2888 \= Expect no match
   2889     a
   2890 
   2891 /a[\s]b/
   2892     a b
   2893 
   2894 /a[\S]b/
   2895     a-b
   2896 \= Expect no match
   2897     a b
   2898 
   2899 /[\d]/
   2900     1
   2901 
   2902 /[\D]/
   2903     -
   2904 \= Expect no match
   2905     1
   2906 
   2907 /ab|cd/
   2908     abc
   2909     abcd
   2910 
   2911 /()ef/
   2912     def
   2913 
   2914 /$b/
   2915 
   2916 /a\(b/
   2917     a(b
   2918 
   2919 /a\(*b/
   2920     ab
   2921     a((b
   2922 
   2923 /a\\b/
   2924     a\\b
   2925 \= Expect no match
   2926     a\b
   2927 
   2928 /((a))/
   2929     abc
   2930 
   2931 /(a)b(c)/
   2932     abc
   2933 
   2934 /a+b+c/
   2935     aabbabc
   2936 
   2937 /a{1,}b{1,}c/
   2938     aabbabc
   2939 
   2940 /a.+?c/
   2941     abcabc
   2942 
   2943 /(a+|b)*/
   2944     ab
   2945 
   2946 /(a+|b){0,}/
   2947     ab
   2948 
   2949 /(a+|b)+/
   2950     ab
   2951 
   2952 /(a+|b){1,}/
   2953     ab
   2954 
   2955 /(a+|b)?/
   2956     ab
   2957 
   2958 /(a+|b){0,1}/
   2959     ab
   2960 
   2961 /[^ab]*/
   2962     cde
   2963 
   2964 /abc/
   2965 \= Expect no match
   2966     b
   2967 
   2968 /a*/
   2969 
   2970 /([abc])*d/
   2971     abbbcd
   2972 
   2973 /([abc])*bcd/
   2974     abcd
   2975 
   2976 /a|b|c|d|e/
   2977     e
   2978 
   2979 /(a|b|c|d|e)f/
   2980     ef
   2981 
   2982 /abcd*efg/
   2983     abcdefg
   2984 
   2985 /ab*/
   2986     xabyabbbz
   2987     xayabbbz
   2988 
   2989 /(ab|cd)e/
   2990     abcde
   2991 
   2992 /[abhgefdc]ij/
   2993     hij
   2994 
   2995 /^(ab|cd)e/
   2996 
   2997 /(abc|)ef/
   2998     abcdef
   2999 
   3000 /(a|b)c*d/
   3001     abcd
   3002 
   3003 /(ab|ab*)bc/
   3004     abc
   3005 
   3006 /a([bc]*)c*/
   3007     abc
   3008 
   3009 /a([bc]*)(c*d)/
   3010     abcd
   3011 
   3012 /a([bc]+)(c*d)/
   3013     abcd
   3014 
   3015 /a([bc]*)(c+d)/
   3016     abcd
   3017 
   3018 /a[bcd]*dcdcde/
   3019     adcdcde
   3020 
   3021 /a[bcd]+dcdcde/
   3022 \= Expect no match
   3023     abcde
   3024     adcdcde
   3025 
   3026 /(ab|a)b*c/
   3027     abc
   3028 
   3029 /((a)(b)c)(d)/
   3030     abcd
   3031 
   3032 /[a-zA-Z_][a-zA-Z0-9_]*/
   3033     alpha
   3034 
   3035 /^a(bc+|b[eh])g|.h$/
   3036     abh
   3037 
   3038 /(bc+d$|ef*g.|h?i(j|k))/
   3039     effgz
   3040     ij
   3041     reffgz
   3042 \= Expect no match
   3043     effg
   3044     bcdd
   3045 
   3046 /((((((((((a))))))))))/
   3047     a
   3048 
   3049 /(((((((((a)))))))))/
   3050     a
   3051 
   3052 /multiple words of text/
   3053 \= Expect no match
   3054     aa
   3055     uh-uh
   3056 
   3057 /multiple words/
   3058     multiple words, yeah
   3059 
   3060 /(.*)c(.*)/
   3061     abcde
   3062 
   3063 /\((.*), (.*)\)/
   3064     (a, b)
   3065 
   3066 /[k]/
   3067 
   3068 /abcd/
   3069     abcd
   3070 
   3071 /a(bc)d/
   3072     abcd
   3073 
   3074 /a[-]?c/
   3075     ac
   3076 
   3077 /abc/i
   3078     ABC
   3079     XABCY
   3080     ABABC
   3081 \= Expect no match
   3082     aaxabxbaxbbx
   3083     XBC
   3084     AXC
   3085     ABX
   3086 
   3087 /ab*c/i
   3088     ABC
   3089 
   3090 /ab*bc/i
   3091     ABC
   3092     ABBC
   3093 
   3094 /ab*?bc/i
   3095     ABBBBC
   3096 
   3097 /ab{0,}?bc/i
   3098     ABBBBC
   3099 
   3100 /ab+?bc/i
   3101     ABBC
   3102 
   3103 /ab+bc/i
   3104 \= Expect no match
   3105     ABC
   3106     ABQ
   3107 
   3108 /ab{1,}bc/i
   3109 
   3110 /ab+bc/i
   3111     ABBBBC
   3112 
   3113 /ab{1,}?bc/i
   3114     ABBBBC
   3115 
   3116 /ab{1,3}?bc/i
   3117     ABBBBC
   3118 
   3119 /ab{3,4}?bc/i
   3120     ABBBBC
   3121 
   3122 /ab{4,5}?bc/i
   3123 \= Expect no match
   3124     ABQ
   3125     ABBBBC
   3126 
   3127 /ab??bc/i
   3128     ABBC
   3129     ABC
   3130 
   3131 /ab{0,1}?bc/i
   3132     ABC
   3133 
   3134 /ab??bc/i
   3135 
   3136 /ab??c/i
   3137     ABC
   3138 
   3139 /ab{0,1}?c/i
   3140     ABC
   3141 
   3142 /^abc$/i
   3143     ABC
   3144 \= Expect no match
   3145     ABBBBC
   3146     ABCC
   3147 
   3148 /^abc/i
   3149     ABCC
   3150 
   3151 /^abc$/i
   3152 
   3153 /abc$/i
   3154     AABC
   3155 
   3156 /^/i
   3157     ABC
   3158 
   3159 /$/i
   3160     ABC
   3161 
   3162 /a.c/i
   3163     ABC
   3164     AXC
   3165 
   3166 /a.*?c/i
   3167     AXYZC
   3168 
   3169 /a.*c/i
   3170     AABC
   3171 \= Expect no match
   3172     AXYZD
   3173 
   3174 /a[bc]d/i
   3175     ABD
   3176 
   3177 /a[b-d]e/i
   3178     ACE
   3179 \= Expect no match
   3180     ABC
   3181     ABD
   3182 
   3183 /a[b-d]/i
   3184     AAC
   3185 
   3186 /a[-b]/i
   3187     A-
   3188 
   3189 /a[b-]/i
   3190     A-
   3191 
   3192 /a]/i
   3193     A]
   3194 
   3195 /a[]]b/i
   3196     A]B
   3197 
   3198 /a[^bc]d/i
   3199     AED
   3200 
   3201 /a[^-b]c/i
   3202     ADC
   3203 \= Expect no match
   3204     ABD
   3205     A-C
   3206 
   3207 /a[^]b]c/i
   3208     ADC
   3209 
   3210 /ab|cd/i
   3211     ABC
   3212     ABCD
   3213 
   3214 /()ef/i
   3215     DEF
   3216 
   3217 /$b/i
   3218 \= Expect no match
   3219     A]C
   3220     B
   3221 
   3222 /a\(b/i
   3223     A(B
   3224 
   3225 /a\(*b/i
   3226     AB
   3227     A((B
   3228 
   3229 /a\\b/i
   3230 \= Expect no match
   3231     A\=notbol
   3232 
   3233 /((a))/i
   3234     ABC
   3235 
   3236 /(a)b(c)/i
   3237     ABC
   3238 
   3239 /a+b+c/i
   3240     AABBABC
   3241 
   3242 /a{1,}b{1,}c/i
   3243     AABBABC
   3244 
   3245 /a.+?c/i
   3246     ABCABC
   3247 
   3248 /a.*?c/i
   3249     ABCABC
   3250 
   3251 /a.{0,5}?c/i
   3252     ABCABC
   3253 
   3254 /(a+|b)*/i
   3255     AB
   3256 
   3257 /(a+|b){0,}/i
   3258     AB
   3259 
   3260 /(a+|b)+/i
   3261     AB
   3262 
   3263 /(a+|b){1,}/i
   3264     AB
   3265 
   3266 /(a+|b)?/i
   3267     AB
   3268 
   3269 /(a+|b){0,1}/i
   3270     AB
   3271 
   3272 /(a+|b){0,1}?/i
   3273     AB
   3274 
   3275 /[^ab]*/i
   3276     CDE
   3277 
   3278 /abc/i
   3279 
   3280 /a*/i
   3281 
   3282 /([abc])*d/i
   3283     ABBBCD
   3284 
   3285 /([abc])*bcd/i
   3286     ABCD
   3287 
   3288 /a|b|c|d|e/i
   3289     E
   3290 
   3291 /(a|b|c|d|e)f/i
   3292     EF
   3293 
   3294 /abcd*efg/i
   3295     ABCDEFG
   3296 
   3297 /ab*/i
   3298     XABYABBBZ
   3299     XAYABBBZ
   3300 
   3301 /(ab|cd)e/i
   3302     ABCDE
   3303 
   3304 /[abhgefdc]ij/i
   3305     HIJ
   3306 
   3307 /^(ab|cd)e/i
   3308 \= Expect no match
   3309     ABCDE
   3310 
   3311 /(abc|)ef/i
   3312     ABCDEF
   3313 
   3314 /(a|b)c*d/i
   3315     ABCD
   3316 
   3317 /(ab|ab*)bc/i
   3318     ABC
   3319 
   3320 /a([bc]*)c*/i
   3321     ABC
   3322 
   3323 /a([bc]*)(c*d)/i
   3324     ABCD
   3325 
   3326 /a([bc]+)(c*d)/i
   3327     ABCD
   3328 
   3329 /a([bc]*)(c+d)/i
   3330     ABCD
   3331 
   3332 /a[bcd]*dcdcde/i
   3333     ADCDCDE
   3334 
   3335 /a[bcd]+dcdcde/i
   3336 
   3337 /(ab|a)b*c/i
   3338     ABC
   3339 
   3340 /((a)(b)c)(d)/i
   3341     ABCD
   3342 
   3343 /[a-zA-Z_][a-zA-Z0-9_]*/i
   3344     ALPHA
   3345 
   3346 /^a(bc+|b[eh])g|.h$/i
   3347     ABH
   3348 
   3349 /(bc+d$|ef*g.|h?i(j|k))/i
   3350     EFFGZ
   3351     IJ
   3352     REFFGZ
   3353 \= Expect no match
   3354     ADCDCDE
   3355     EFFG
   3356     BCDD
   3357 
   3358 /((((((((((a))))))))))/i
   3359     A
   3360 
   3361 /(((((((((a)))))))))/i
   3362     A
   3363 
   3364 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
   3365     A
   3366 
   3367 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
   3368     C
   3369 
   3370 /multiple words of text/i
   3371 \= Expect no match
   3372     AA
   3373     UH-UH
   3374 
   3375 /multiple words/i
   3376     MULTIPLE WORDS, YEAH
   3377 
   3378 /(.*)c(.*)/i
   3379     ABCDE
   3380 
   3381 /\((.*), (.*)\)/i
   3382     (A, B)
   3383 
   3384 /[k]/i
   3385 
   3386 /abcd/i
   3387     ABCD
   3388 
   3389 /a(bc)d/i
   3390     ABCD
   3391 
   3392 /a[-]?c/i
   3393     AC
   3394 
   3395 /a(?!b)./
   3396     abad
   3397 
   3398 /a(?=d)./
   3399     abad
   3400 
   3401 /a(?=c|d)./
   3402     abad
   3403 
   3404 /a(?:b|c|d)(.)/
   3405     ace
   3406 
   3407 /a(?:b|c|d)*(.)/
   3408     ace
   3409 
   3410 /a(?:b|c|d)+?(.)/
   3411     ace
   3412     acdbcdbe
   3413 
   3414 /a(?:b|c|d)+(.)/
   3415     acdbcdbe
   3416 
   3417 /a(?:b|c|d){2}(.)/
   3418     acdbcdbe
   3419 
   3420 /a(?:b|c|d){4,5}(.)/
   3421     acdbcdbe
   3422 
   3423 /a(?:b|c|d){4,5}?(.)/
   3424     acdbcdbe
   3425 
   3426 /((foo)|(bar))*/
   3427     foobar
   3428 
   3429 /a(?:b|c|d){6,7}(.)/
   3430     acdbcdbe
   3431 
   3432 /a(?:b|c|d){6,7}?(.)/
   3433     acdbcdbe
   3434 
   3435 /a(?:b|c|d){5,6}(.)/
   3436     acdbcdbe
   3437 
   3438 /a(?:b|c|d){5,6}?(.)/
   3439     acdbcdbe
   3440 
   3441 /a(?:b|c|d){5,7}(.)/
   3442     acdbcdbe
   3443 
   3444 /a(?:b|c|d){5,7}?(.)/
   3445     acdbcdbe
   3446 
   3447 /a(?:b|(c|e){1,2}?|d)+?(.)/
   3448     ace
   3449 
   3450 /^(.+)?B/
   3451     AB
   3452 
   3453 /^([^a-z])|(\^)$/
   3454     .
   3455 
   3456 /^[<>]&/
   3457     <&OUT
   3458 
   3459 /(?:(f)(o)(o)|(b)(a)(r))*/
   3460     foobar
   3461 
   3462 /(?<=a)b/
   3463     ab
   3464 \= Expect no match
   3465     cb
   3466     b
   3467 
   3468 /(?<!c)b/
   3469     ab
   3470     b
   3471     b
   3472 
   3473 /(?:..)*a/
   3474     aba
   3475 
   3476 /(?:..)*?a/
   3477     aba
   3478 
   3479 /^(){3,5}/
   3480     abc
   3481 
   3482 /^(a+)*ax/
   3483     aax
   3484 
   3485 /^((a|b)+)*ax/
   3486     aax
   3487 
   3488 /^((a|bc)+)*ax/
   3489     aax
   3490 
   3491 /(a|x)*ab/
   3492     cab
   3493 
   3494 /(a)*ab/
   3495     cab
   3496 
   3497 /(?:(?i)a)b/
   3498     ab
   3499 
   3500 /((?i)a)b/
   3501     ab
   3502 
   3503 /(?:(?i)a)b/
   3504     Ab
   3505 
   3506 /((?i)a)b/
   3507     Ab
   3508 
   3509 /(?:(?i)a)b/
   3510 \= Expect no match
   3511     cb
   3512     aB
   3513 
   3514 /((?i)a)b/
   3515 
   3516 /(?i:a)b/
   3517     ab
   3518 
   3519 /((?i:a))b/
   3520     ab
   3521 
   3522 /(?i:a)b/
   3523     Ab
   3524 
   3525 /((?i:a))b/
   3526     Ab
   3527 
   3528 /(?i:a)b/
   3529 \= Expect no match
   3530     aB
   3531     aB
   3532 
   3533 /((?i:a))b/
   3534 
   3535 /(?:(?-i)a)b/i
   3536     ab
   3537 
   3538 /((?-i)a)b/i
   3539     ab
   3540 
   3541 /(?:(?-i)a)b/i
   3542     aB
   3543 
   3544 /((?-i)a)b/i
   3545     aB
   3546 
   3547 /(?:(?-i)a)b/i
   3548     aB
   3549 \= Expect no match
   3550     Ab
   3551 
   3552 /((?-i)a)b/i
   3553 
   3554 /(?:(?-i)a)b/i
   3555     aB
   3556 
   3557 /((?-i)a)b/i
   3558     aB
   3559 
   3560 /(?:(?-i)a)b/i
   3561 \= Expect no match
   3562     Ab
   3563     AB
   3564 
   3565 /((?-i)a)b/i
   3566 
   3567 /(?-i:a)b/i
   3568     ab
   3569 
   3570 /((?-i:a))b/i
   3571     ab
   3572 
   3573 /(?-i:a)b/i
   3574     aB
   3575 
   3576 /((?-i:a))b/i
   3577     aB
   3578 
   3579 /(?-i:a)b/i
   3580 \= Expect no match
   3581     AB
   3582     Ab
   3583 
   3584 /((?-i:a))b/i
   3585 
   3586 /(?-i:a)b/i
   3587     aB
   3588 
   3589 /((?-i:a))b/i
   3590     aB
   3591 
   3592 /(?-i:a)b/i
   3593 \= Expect no match
   3594     Ab
   3595     AB
   3596 
   3597 /((?-i:a))b/i
   3598 
   3599 /((?-i:a.))b/i
   3600 \= Expect no match
   3601     AB
   3602     a\nB
   3603 
   3604 /((?s-i:a.))b/i
   3605     a\nB
   3606 
   3607 /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
   3608     cabbbb
   3609 
   3610 /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
   3611     caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
   3612 
   3613 /foo\w*\d{4}baz/
   3614     foobar1234baz
   3615 
   3616 /x(~~)*(?:(?:F)?)?/
   3617     x~~
   3618 
   3619 /^a(?#xxx){3}c/
   3620     aaac
   3621 
   3622 /^a (?#xxx) (?#yyy) {3}c/x
   3623     aaac
   3624 
   3625 /(?<![cd])b/
   3626 \= Expect no match
   3627     B\nB
   3628     dbcb
   3629 
   3630 /(?<![cd])[ab]/
   3631     dbaacb
   3632 
   3633 /(?<!(c|d))b/
   3634 
   3635 /(?<!(c|d))[ab]/
   3636     dbaacb
   3637 
   3638 /(?<!cd)[ab]/
   3639     cdaccb
   3640 
   3641 /^(?:a?b?)*$/
   3642 \= Expect no match
   3643     dbcb
   3644     a--
   3645 
   3646 /((?s)^a(.))((?m)^b$)/
   3647     a\nb\nc\n
   3648 
   3649 /((?m)^b$)/
   3650     a\nb\nc\n
   3651 
   3652 /(?m)^b/
   3653     a\nb\n
   3654 
   3655 /(?m)^(b)/
   3656     a\nb\n
   3657 
   3658 /((?m)^b)/
   3659     a\nb\n
   3660 
   3661 /\n((?m)^b)/
   3662     a\nb\n
   3663 
   3664 /((?s).)c(?!.)/
   3665     a\nb\nc\n
   3666     a\nb\nc\n
   3667 
   3668 /((?s)b.)c(?!.)/
   3669     a\nb\nc\n
   3670     a\nb\nc\n
   3671 
   3672 /^b/
   3673 
   3674 /()^b/
   3675 \= Expect no match
   3676     a\nb\nc\n
   3677     a\nb\nc\n
   3678 
   3679 /((?m)^b)/
   3680     a\nb\nc\n
   3681 
   3682 /(?(?!a)a|b)/
   3683 
   3684 /(?(?!a)b|a)/
   3685     a
   3686 
   3687 /(?(?=a)b|a)/
   3688 \= Expect no match
   3689     a
   3690     a
   3691 
   3692 /(?(?=a)a|b)/
   3693     a
   3694 
   3695 /(\w+:)+/
   3696     one:
   3697 
   3698 /$(?<=^(a))/
   3699     a
   3700 
   3701 /([\w:]+::)?(\w+)$/
   3702     abcd
   3703     xy:z:::abcd
   3704 
   3705 /^[^bcd]*(c+)/
   3706     aexycd
   3707 
   3708 /(a*)b+/
   3709     caab
   3710 
   3711 /([\w:]+::)?(\w+)$/
   3712     abcd
   3713     xy:z:::abcd
   3714 \= Expect no match
   3715     abcd:
   3716     abcd:
   3717 
   3718 /^[^bcd]*(c+)/
   3719     aexycd
   3720 
   3721 /(>a+)ab/
   3722 
   3723 /(?>a+)b/
   3724     aaab
   3725 
   3726 /([[:]+)/
   3727     a:[b]:
   3728 
   3729 /([[=]+)/
   3730     a=[b]=
   3731 
   3732 /([[.]+)/
   3733     a.[b].
   3734 
   3735 /((?>a+)b)/
   3736     aaab
   3737 
   3738 /(?>(a+))b/
   3739     aaab
   3740 
   3741 /((?>[^()]+)|\([^()]*\))+/
   3742     ((abc(ade)ufh()()x
   3743 
   3744 /a\Z/
   3745 \= Expect no match
   3746     aaab
   3747     a\nb\n
   3748 
   3749 /b\Z/
   3750     a\nb\n
   3751 
   3752 /b\z/
   3753 
   3754 /b\Z/
   3755     a\nb
   3756 
   3757 /b\z/
   3758     a\nb
   3759     
   3760 /(?>.*)(?<=(abcd|wxyz))/
   3761     alphabetabcd
   3762     endingwxyz
   3763 \= Expect no match
   3764     a rather long string that doesn't end with one of them
   3765 
   3766 /word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
   3767     word cat dog elephant mussel cow horse canary baboon snake shark otherword
   3768 \= Expect no match
   3769     word cat dog elephant mussel cow horse canary baboon snake shark
   3770   
   3771 /word (?>[a-zA-Z0-9]+ ){0,30}otherword/
   3772 \= Expect no match
   3773     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
   3774 
   3775 /(?<=\d{3}(?!999))foo/
   3776     999foo
   3777     123999foo 
   3778 \= Expect no match
   3779     123abcfoo
   3780     
   3781 /(?<=(?!...999)\d{3})foo/
   3782     999foo
   3783     123999foo 
   3784 \= Expect no match
   3785     123abcfoo
   3786 
   3787 /(?<=\d{3}(?!999)...)foo/
   3788     123abcfoo
   3789     123456foo 
   3790 \= Expect no match
   3791     123999foo  
   3792     
   3793 /(?<=\d{3}...)(?<!999)foo/
   3794     123abcfoo   
   3795     123456foo 
   3796 \= Expect no match
   3797     123999foo  
   3798 
   3799 /((Z)+|A)*/
   3800     ZABCDEFG
   3801 
   3802 /(Z()|A)*/
   3803     ZABCDEFG
   3804 
   3805 /(Z(())|A)*/
   3806     ZABCDEFG
   3807 
   3808 /((?>Z)+|A)*/
   3809     ZABCDEFG
   3810 
   3811 /((?>)+|A)*/
   3812     ZABCDEFG
   3813 
   3814 /a*/g
   3815     abbab
   3816 
   3817 /^[\d-a]/
   3818     abcde
   3819     -things
   3820     0digit
   3821 \= Expect no match
   3822     bcdef    
   3823     
   3824 /[[:space:]]+/
   3825     > \x09\x0a\x0c\x0d\x0b<
   3826      
   3827 /[[:blank:]]+/
   3828     > \x09\x0a\x0c\x0d\x0b<
   3829      
   3830 /[\s]+/
   3831     > \x09\x0a\x0c\x0d\x0b<
   3832      
   3833 /\s+/
   3834     > \x09\x0a\x0c\x0d\x0b<
   3835      
   3836 /ab/x
   3838     ab
   3839 
   3840 /(?!\A)x/m
   3841   a\nxb\n
   3842 
   3843 /(?!^)x/m
   3844 \= Expect no match
   3845     a\nxb\n
   3846 
   3847 /abc\Qabc\Eabc/
   3848     abcabcabc
   3849     
   3850 /abc\Q(*+|\Eabc/
   3851     abc(*+|abc 
   3852 
   3853 /   abc\Q abc\Eabc/x
   3854     abc abcabc
   3855 \= Expect no match
   3856     abcabcabc  
   3857     
   3858 /abc#comment
   3859     \Q#not comment
   3860     literal\E/x
   3861     abc#not comment\n    literal     
   3862 
   3863 /abc#comment
   3864     \Q#not comment
   3865     literal/x
   3866     abc#not comment\n    literal     
   3867 
   3868 /abc#comment
   3869     \Q#not comment
   3870     literal\E #more comment
   3871     /x
   3872     abc#not comment\n    literal     
   3873 
   3874 /abc#comment
   3875     \Q#not comment
   3876     literal\E #more comment/x
   3877     abc#not comment\n    literal     
   3878 
   3879 /\Qabc\$xyz\E/
   3880     abc\\\$xyz
   3881 
   3882 /\Qabc\E\$\Qxyz\E/
   3883     abc\$xyz
   3884 
   3885 /\Gabc/
   3886     abc
   3887 \= Expect no match
   3888     xyzabc  
   3889 
   3890 /\Gabc./g
   3891     abc1abc2xyzabc3
   3892 
   3893 /abc./g
   3894     abc1abc2xyzabc3 
   3895 
   3896 /a(?x: b c )d/
   3897     XabcdY
   3898 \= Expect no match 
   3899     Xa b c d Y 
   3900 
   3901 /((?x)x y z | a b c)/
   3902     XabcY
   3903     AxyzB 
   3904 
   3905 /(?i)AB(?-i)C/
   3906     XabCY
   3907 \= Expect no match
   3908     XabcY  
   3909 
   3910 /((?i)AB(?-i)C|D)E/
   3911     abCE
   3912     DE
   3913 \= Expect no match
   3914     abcE
   3915     abCe  
   3916     dE
   3917     De    
   3918 
   3919 /[z\Qa-d]\E]/
   3920     z
   3921     a
   3922     -
   3923     d
   3924     ] 
   3925 \= Expect no match
   3926     b     
   3927 
   3928 /(a+)*b/
   3929 \= Expect no match
   3930     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
   3931     
   3932 /(?i)reg(?:ul(?:[a]|ae)r|ex)/
   3933     REGular
   3934     regulaer
   3935     Regex  
   3936     regulr 
   3937 
   3938 /[--]+/
   3939     
   3940     
   3941     
   3942     
   3943 
   3944 /(?<=Z)X./
   3945     \x84XAZXB
   3946 
   3947 /^(?(2)a|(1)(2))+$/
   3948     123a
   3949 
   3950 /(?<=a|bbbb)c/
   3951     ac
   3952     bbbbc
   3953 
   3954 /line\nbreak/
   3955     this is a line\nbreak
   3956     line one\nthis is a line\nbreak in the second line 
   3957 
   3958 /line\nbreak/firstline
   3959     this is a line\nbreak
   3960 \= Expect no match 
   3961     line one\nthis is a line\nbreak in the second line 
   3962 
   3963 /line\nbreak/m,firstline
   3964     this is a line\nbreak
   3965 \= Expect no match 
   3966     line one\nthis is a line\nbreak in the second line 
   3967 
   3968 /1234/
   3969     123\=ps
   3970 \= Expect no match 
   3971     a4\=ps,dfa_restart
   3972 
   3973 /1234/
   3974     123\=ps
   3975     4\=ps,dfa_restart
   3976 
   3977 /^/gm
   3978     a\nb\nc\n
   3979     \ 
   3980     
   3981 /(?<=C\n)^/gm
   3982     A\nC\nC\n 
   3983 
   3984 /(?s)A?B/
   3985     AB
   3986     aB  
   3987 
   3988 /(?s)A*B/
   3989     AB
   3990     aB  
   3991 
   3992 /(?m)A?B/
   3993     AB
   3994     aB  
   3995 
   3996 /(?m)A*B/
   3997     AB
   3998     aB  
   3999 
   4000 /Content-Type\x3A[^\r\n]{6,}/
   4001     Content-Type:xxxxxyyy 
   4002 
   4003 /Content-Type\x3A[^\r\n]{6,}z/
   4004     Content-Type:xxxxxyyyz
   4005 
   4006 /Content-Type\x3A[^a]{6,}/
   4007     Content-Type:xxxyyy 
   4008 
   4009 /Content-Type\x3A[^a]{6,}z/
   4010     Content-Type:xxxyyyz
   4011 
   4012 /^abc/Im,newline=lf
   4013     xyz\nabc
   4014     xyz\r\nabc
   4015 \= Expect no match
   4016     xyz\rabc
   4017     xyzabc\r
   4018     xyzabc\rpqr
   4019     xyzabc\r\n
   4020     xyzabc\r\npqr
   4021 
   4022 /^abc/Im,newline=crlf
   4023     xyz\r\nabclf>
   4024 \= Expect no match
   4025     xyz\nabclf
   4026     xyz\rabclf
   4027     
   4028 /^abc/Im,newline=cr
   4029     xyz\rabc
   4030 \= Expect no match
   4031     xyz\nabc
   4032     xyz\r\nabc
   4033 
   4034 /.*/I,newline=lf
   4035     abc\ndef
   4036     abc\rdef
   4037     abc\r\ndef
   4038 
   4039 /.*/I,newline=cr
   4040     abc\ndef
   4041     abc\rdef
   4042     abc\r\ndef
   4043 
   4044 /.*/I,newline=crlf
   4045     abc\ndef
   4046     abc\rdef
   4047     abc\r\ndef
   4048 
   4049 /\w+(.)(.)?def/Is
   4050     abc\ndef
   4051     abc\rdef
   4052     abc\r\ndef
   4053 
   4054 /\w+(.)(.)?def/s
   4055     abc\ndef
   4056     abc\rdef
   4057     abc\r\ndef
   4058 
   4059 /^\w+=.*(\\\n.*)*/
   4060     abc=xyz\\\npqr
   4061 
   4062 /^(a()*)*/
   4063     aaaa
   4064 
   4065 /^(?:a(?:(?:))*)*/
   4066     aaaa
   4067 
   4068 /^(a()+)+/
   4069     aaaa
   4070 
   4071 /^(?:a(?:(?:))+)+/
   4072     aaaa
   4073 
   4074 /(a|)*\d/
   4075   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
   4076 \= Expect no match
   4077   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   4078 
   4079 /(?>a|)*\d/
   4080   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
   4081 \= Expect no match
   4082   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   4083 
   4084 /(?:a|)*\d/
   4085   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
   4086 \= Expect no match
   4087   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   4088 
   4089 /^a.b/newline=lf
   4090     a\rb
   4091 \= Expect no match
   4092     a\nb
   4093 
   4094 /^a.b/newline=cr
   4095     a\nb
   4096 \= Expect no match
   4097     a\rb
   4098 
   4099 /^a.b/newline=anycrlf
   4100     a\x85b
   4101 \= Expect no match
   4102     a\rb
   4103 
   4104 /^a.b/newline=any
   4105 \= Expect no match
   4106     a\nb
   4107     a\rb
   4108     a\x85b
   4109 
   4110 /^abc./gmx,newline=any
   4111     abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK
   4112 
   4113 /abc.$/gmx,newline=any
   4114     abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9
   4115 
   4116 /^a\Rb/bsr=unicode
   4117     a\nb
   4118     a\rb
   4119     a\r\nb
   4120     a\x0bb
   4121     a\x0cb
   4122     a\x85b   
   4123 \= Expect no match
   4124     a\n\rb    
   4125 
   4126 /^a\R*b/bsr=unicode
   4127     ab
   4128     a\nb
   4129     a\rb
   4130     a\r\nb
   4131     a\x0bb
   4132     a\x0cb
   4133     a\x85b   
   4134     a\n\rb    
   4135     a\n\r\x85\x0cb 
   4136 
   4137 /^a\R+b/bsr=unicode
   4138     a\nb
   4139     a\rb
   4140     a\r\nb
   4141     a\x0bb
   4142     a\x0cb
   4143     a\x85b   
   4144     a\n\rb    
   4145     a\n\r\x85\x0cb 
   4146 \= Expect no match
   4147     ab  
   4148     
   4149 /^a\R{1,3}b/bsr=unicode
   4150     a\nb
   4151     a\n\rb
   4152     a\n\r\x85b
   4153     a\r\n\r\nb 
   4154     a\r\n\r\n\r\nb 
   4155     a\n\r\n\rb
   4156     a\n\n\r\nb 
   4157 \= Expect no match
   4158     a\n\n\n\rb
   4159     a\r
   4160 
   4161 /.+foo/
   4162     afoo
   4163 \= Expect no match 
   4164     \r\nfoo 
   4165     \nfoo 
   4166 
   4167 /.+foo/newline=crlf
   4168     afoo
   4169     \nfoo 
   4170 \= Expect no match 
   4171     \r\nfoo 
   4172 
   4173 /.+foo/newline=any
   4174     afoo
   4175 \= Expect no match 
   4176     \nfoo 
   4177     \r\nfoo 
   4178 
   4179 /.+foo/s
   4180     afoo
   4181     \r\nfoo 
   4182     \nfoo 
   4183 
   4184 /^$/gm,newline=any
   4185     abc\r\rxyz
   4186     abc\n\rxyz  
   4187 \= Expect no match 
   4188     abc\r\nxyz
   4189 
   4190 /^X/m
   4191     XABC
   4192 \= Expect no match 
   4193     XABC\=notbol
   4194 
   4195 /(?m)^$/g,newline=any,aftertext
   4196     abc\r\n\r\n
   4197 
   4198 /(?m)^$|^\r\n/g,newline=any,aftertext
   4199     abc\r\n\r\n
   4200     
   4201 /(?m)$/g,newline=any,aftertext
   4202     abc\r\n\r\n
   4203 
   4204 /(?|(abc)|(xyz))/
   4205    >abc<
   4206    >xyz< 
   4207 
   4208 /(x)(?|(abc)|(xyz))(x)/
   4209     xabcx
   4210     xxyzx 
   4211 
   4212 /(x)(?|(abc)(pqr)|(xyz))(x)/
   4213     xabcpqrx
   4214     xxyzx 
   4215 
   4216 /(?|(abc)|(xyz))(?1)/
   4217     abcabc
   4218     xyzabc 
   4219 \= Expect no match 
   4220     xyzxyz 
   4221  
   4222 /\H\h\V\v/
   4223     X X\x0a
   4224     X\x09X\x0b
   4225 \= Expect no match
   4226     \xa0 X\x0a   
   4227     
   4228 /\H*\h+\V?\v{3,4}/
   4229     \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
   4230     \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
   4231     \x09\x20\xa0\x0a\x0b\x0c
   4232 \= Expect no match 
   4233     \x09\x20\xa0\x0a\x0b
   4234      
   4235 /\H{3,4}/
   4236     XY  ABCDE
   4237     XY  PQR ST 
   4238     
   4239 /.\h{3,4}./
   4240     XY  AB    PQRS
   4241 
   4242 /\h*X\h?\H+Y\H?Z/
   4243     >XNNNYZ
   4244     >  X NYQZ
   4245 \= Expect no match
   4246     >XYZ   
   4247     >  X NY Z
   4248 
   4249 /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
   4250     >XY\x0aZ\x0aA\x0bNN\x0c
   4251     >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
   4252 
   4253 /.+A/newline=crlf
   4254 \= Expect no match
   4255     \r\nA
   4256     
   4257 /\nA/newline=crlf
   4258     \r\nA 
   4259 
   4260 /[\r\n]A/newline=crlf
   4261     \r\nA 
   4262 
   4263 /(\r|\n)A/newline=crlf
   4264     \r\nA 
   4265 
   4266 /a\Rb/I,bsr=anycrlf
   4267     a\rb
   4268     a\nb
   4269     a\r\nb
   4270 \= Expect no match
   4271     a\x85b
   4272     a\x0bb     
   4273 
   4274 /a\Rb/I,bsr=unicode
   4275     a\rb
   4276     a\nb
   4277     a\r\nb
   4278     a\x85b
   4279     a\x0bb     
   4280     
   4281 /a\R?b/I,bsr=anycrlf
   4282     a\rb
   4283     a\nb
   4284     a\r\nb
   4285 \= Expect no match
   4286     a\x85b
   4287     a\x0bb     
   4288 
   4289 /a\R?b/I,bsr=unicode
   4290     a\rb
   4291     a\nb
   4292     a\r\nb
   4293     a\x85b
   4294     a\x0bb     
   4295     
   4296 /a\R{2,4}b/I,bsr=anycrlf
   4297     a\r\n\nb
   4298     a\n\r\rb
   4299     a\r\n\r\n\r\n\r\nb
   4300 \= Expect no match
   4301     a\x0b\x0bb     
   4302     a\x85\x85b
   4303 
   4304 /a\R{2,4}b/I,bsr=unicode
   4305     a\r\rb
   4306     a\n\n\nb
   4307     a\r\n\n\r\rb
   4308     a\x85\x85b
   4309     a\x0b\x0bb     
   4310 \= Expect no match 
   4311     a\r\r\r\r\rb 
   4312     
   4313 /a(?!)|\wbc/
   4314     abc 
   4315 
   4316 /a[]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
   4317 \= Expect no match
   4318     ab
   4319 
   4320 /a[]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
   4321 \= Expect no match
   4322     ab 
   4323 
   4324 /a[]*+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
   4325 \= Expect no match
   4326     ab 
   4327 
   4328 /a[^]b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
   4329     aXb
   4330     a\nb 
   4331 \= Expect no match
   4332     ab  
   4333     
   4334 /a[^]+b/alt_bsux,allow_empty_class,match_unset_backref,dupnames
   4335     aXb
   4336     a\nX\nXb 
   4337 \= Expect no match
   4338     ab  
   4339 
   4340 /X$/dollar_endonly
   4341     X
   4342 \= Expect no match 
   4343     X\n 
   4344 
   4345 /X$/
   4346     X
   4347     X\n 
   4348 
   4349 /xyz/auto_callout
   4350   xyz 
   4351   abcxyz 
   4352 \= Expect no match 
   4353   abc
   4354   abcxypqr  
   4355 
   4356 /xyz/auto_callout,no_start_optimize
   4357   abcxyz 
   4358 \= Expect no match 
   4359   abc
   4360   abcxypqr  
   4361 
   4362 /(*NO_START_OPT)xyz/auto_callout
   4363   abcxyz 
   4364   
   4365 /(?C)ab/
   4366   ab
   4367   ab\=callout_none
   4368   
   4369 /ab/auto_callout
   4370   ab
   4371   ab\=callout_none
   4372 
   4373 /^"((?(?=[a])[^"])|b)*"$/auto_callout
   4374     "ab"
   4375     "ab"\=callout_none
   4376 
   4377 /\d+X|9+Y/
   4378     ++++123999\=ps
   4379     ++++123999Y\=ps
   4380 
   4381 /Z(*F)/
   4382 \= Expect no match 
   4383     Z\=ps
   4384     ZA\=ps
   4385     
   4386 /Z(?!)/
   4387 \= Expect no match 
   4388     Z\=ps
   4389     ZA\=ps
   4390 
   4391 /dog(sbody)?/
   4392     dogs\=ps
   4393     dogs\=ph
   4394     
   4395 /dog(sbody)??/
   4396     dogs\=ps
   4397     dogs\=ph
   4398 
   4399 /dog|dogsbody/
   4400     dogs\=ps
   4401     dogs\=ph
   4402  
   4403 /dogsbody|dog/
   4404     dogs\=ps
   4405     dogs\=ph
   4406 
   4407 /Z(*F)Q|ZXY/
   4408     Z\=ps
   4409 \= Expect no match 
   4410     ZA\=ps
   4411     X\=ps
   4412 
   4413 /\bthe cat\b/
   4414     the cat\=ps
   4415     the cat\=ph
   4416 
   4417 /dog(sbody)?/
   4418     dogs\=ps
   4419     body\=dfa_restart
   4420 
   4421 /dog(sbody)?/
   4422     dogs\=ph
   4423     body\=dfa_restart
   4424 
   4425 /abc/
   4426    abc\=ps
   4427    abc\=ph
   4428 
   4429 /abc\K123/
   4430     xyzabc123pqr
   4431     
   4432 /(?<=abc)123/
   4433     xyzabc123pqr 
   4434     xyzabc12\=ps
   4435     xyzabc12\=ph
   4436 
   4437 /\babc\b/
   4438     +++abc+++
   4439     +++ab\=ps
   4440     +++ab\=ph
   4441 
   4442 /(?=C)/g,aftertext
   4443     ABCDECBA
   4444 
   4445 /(abc|def|xyz)/I
   4446     terhjk;abcdaadsfe
   4447     the quick xyz brown fox 
   4448 \= Expect no match
   4449     thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
   4450 
   4451 /(abc|def|xyz)/I,no_start_optimize
   4452     terhjk;abcdaadsfe
   4453     the quick xyz brown fox
   4454 \= Expect no match
   4455     thejk;adlfj aenjl;fda asdfasd ehj;kjxyasiupd
   4456 
   4457 /abcd*/aftertext
   4458     xxxxabcd\=ps
   4459     xxxxabcd\=ph
   4460     dddxxx\=dfa_restart
   4461     xxxxabcd\=ph
   4462     xxx\=dfa_restart
   4463 
   4464 /abcd*/i
   4465     xxxxabcd\=ps
   4466     xxxxabcd\=ph
   4467     XXXXABCD\=ps
   4468     XXXXABCD\=ph
   4469 
   4470 /abc\d*/
   4471     xxxxabc1\=ps
   4472     xxxxabc1\=ph
   4473 
   4474 /abc[de]*/
   4475     xxxxabcde\=ps
   4476     xxxxabcde\=ph
   4477 
   4478 /(?:(?1)|B)(A(*F)|C)/
   4479     ABCD
   4480     CCD
   4481 \= Expect no match
   4482     CAD   
   4483 
   4484 /^(?:(?1)|B)(A(*F)|C)/
   4485     CCD
   4486     BCD 
   4487 \= Expect no match
   4488     ABCD
   4489     CAD
   4490     BAD    
   4491 
   4492 /^(?!a(*SKIP)b)/
   4493     ac
   4494     
   4495 /^(?=a(*SKIP)b|ac)/
   4496     ac
   4497     
   4498 /^(?=a(*THEN)b|ac)/
   4499     ac
   4500     
   4501 /^(?=a(*PRUNE)b)/
   4502     ab  
   4503 
   4504 /^(?(?!a(*SKIP)b))/
   4505     ac
   4506 
   4507 /(?<=abc)def/
   4508     abc\=ph
   4509 
   4510 /abc$/
   4511     abc
   4512     abc\=ps
   4513     abc\=ph
   4514 
   4515 /abc$/m
   4516     abc
   4517     abc\n
   4518     abc\=ph
   4519     abc\n\=ph
   4520     abc\=ps
   4521     abc\n\=ps
   4522 
   4523 /abc\z/
   4524     abc
   4525     abc\=ps
   4526     abc\=ph
   4527 
   4528 /abc\Z/
   4529     abc
   4530     abc\=ps
   4531     abc\=ph
   4532 
   4533 /abc\b/
   4534     abc
   4535     abc\=ps
   4536     abc\=ph
   4537 
   4538 /abc\B/
   4539     abc\=ps
   4540     abc\=ph
   4541 \= Expect no match 
   4542     abc
   4543 
   4544 /.+/
   4545     abc\=offset=0
   4546     abc\=offset=1
   4547     abc\=offset=2
   4548 \= Bad offsets
   4549     abc\=offset=4
   4550     abc\=offset=-4 
   4551 \= Expect no match 
   4552     abc\=offset=3
   4553 
   4554 /^(?:a)++\w/
   4555      aaaab
   4556 \= Expect no match 
   4557      aaaa 
   4558      bbb 
   4559 
   4560 /^(?:aa|(?:a)++\w)/
   4561      aaaab
   4562      aaaa 
   4563 \= Expect no match 
   4564      bbb 
   4565 
   4566 /^(?:a)*+\w/
   4567      aaaab
   4568      bbb 
   4569 \= Expect no match 
   4570      aaaa 
   4571 
   4572 /^(a)++\w/
   4573      aaaab
   4574 \= Expect no match 
   4575      aaaa 
   4576      bbb 
   4577 
   4578 /^(a|)++\w/
   4579      aaaab
   4580 \= Expect no match 
   4581      aaaa 
   4582      bbb 
   4583 
   4584 /(?=abc){3}abc/aftertext
   4585     abcabcabc
   4586 \= Expect no match
   4587     xyz  
   4588     
   4589 /(?=abc)+abc/aftertext
   4590     abcabcabc
   4591 \= Expect no match
   4592     xyz  
   4593     
   4594 /(?=abc)++abc/aftertext
   4595     abcabcabc
   4596 \= Expect no match
   4597     xyz  
   4598     
   4599 /(?=abc){0}xyz/
   4600     xyz 
   4601 
   4602 /(?=abc){1}xyz/
   4603 \= Expect no match
   4604     xyz 
   4605     
   4606 /(?=(a))?./
   4607     ab
   4608     bc
   4609       
   4610 /(?=(a))??./
   4611     ab
   4612     bc
   4613 
   4614 /^(?=(a)){0}b(?1)/
   4615     backgammon
   4616 
   4617 /^(?=(?1))?[az]([abc])d/
   4618     abd 
   4619     zcdxx 
   4620 
   4621 /^(?!a){0}\w+/
   4622     aaaaa
   4623 
   4624 /(?<=(abc))?xyz/
   4625     abcxyz
   4626     pqrxyz 
   4627 
   4628 /((?2))((?1))/
   4629     abc
   4630 
   4631 /(?(R)a+|(?R)b)/
   4632     aaaabcde
   4633 
   4634 /(?(R)a+|((?R))b)/
   4635     aaaabcde
   4636 
   4637 /((?(R)a+|(?1)b))/
   4638     aaaabcde
   4639 
   4640 /((?(R2)a+|(?1)b))/
   4641     aaaabcde
   4642 
   4643 /(?(R)a*(?1)|((?R))b)/
   4644     aaaabcde
   4645 
   4646 /(a+)/no_auto_possess
   4647     aaaa\=ovector=3
   4648     aaaa\=ovector=4
   4649 
   4650 /^\R/
   4651     \r\=ps
   4652     \r\=ph
   4653     
   4654 /^\R{2,3}x/
   4655     \r\=ps
   4656     \r\=ph
   4657     \r\r\=ps
   4658     \r\r\=ph
   4659     \r\r\r\=ps
   4660     \r\r\r\=ph
   4661     \r\rx
   4662     \r\r\rx    
   4663 
   4664 /^\R{2,3}?x/
   4665     \r\=ps
   4666     \r\=ph
   4667     \r\r\=ps
   4668     \r\r\=ph
   4669     \r\r\r\=ps
   4670     \r\r\r\=ph
   4671     \r\rx
   4672     \r\r\rx    
   4673     
   4674 /^\R?x/
   4675     \r\=ps
   4676     \r\=ph
   4677     x
   4678     \rx  
   4679 
   4680 /^\R+x/
   4681     \r\=ps
   4682     \r\=ph
   4683     \r\n\=ps
   4684     \r\n\=ph
   4685     \rx  
   4686 
   4687 /^a$/newline=crlf
   4688     a\r\=ps
   4689     a\r\=ph
   4690 
   4691 /^a$/m,newline=crlf
   4692     a\r\=ps
   4693     a\r\=ph
   4694 
   4695 /^(a$|a\r)/newline=crlf
   4696     a\r\=ps
   4697     a\r\=ph
   4698 
   4699 /^(a$|a\r)/m,newline=crlf
   4700     a\r\=ps
   4701     a\r\=ph
   4702 
   4703 /./newline=crlf
   4704     \r\=ps
   4705     \r\=ph
   4706   
   4707 /.{2,3}/newline=crlf
   4708     \r\=ps
   4709     \r\=ph
   4710     \r\r\=ps
   4711     \r\r\=ph
   4712     \r\r\r\=ps
   4713     \r\r\r\=ph
   4714 
   4715 /.{2,3}?/newline=crlf
   4716     \r\=ps
   4717     \r\=ph
   4718     \r\r\=ps
   4719     \r\r\=ph
   4720     \r\r\r\=ps
   4721     \r\r\r\=ph
   4722 
   4723 # Test simple validity check for restarts 
   4724 
   4725 /abcdef/
   4726    abc\=dfa_restart
   4727 
   4728 /<H((?(?!<H|F>)(.)|(?R))++)*F>/
   4729     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.
   4730 
   4731 /^(?>.{4})abc|^\w\w.xabcd/
   4732     xxxxabcd
   4733     xx\xa0xabcd 
   4734 
   4735 /^(.{4}){2}+abc|^\w\w.x\w\w\w\wabcd/
   4736     xxxxxxxxabcd
   4737     xx\xa0xxxxxabcd 
   4738 
   4739 /abcd/
   4740     abcd\=ovector=0
   4741 
   4742 # These tests show up auto-possessification 
   4743 
   4744 /[ab]*/
   4745     aaaa
   4746     
   4747 /[ab]*?/
   4748     aaaa
   4749     
   4750 /[ab]?/
   4751     aaaa
   4752     
   4753 /[ab]??/
   4754     aaaa
   4755     
   4756 /[ab]+/
   4757     aaaa
   4758     
   4759 /[ab]+?/
   4760     aaaa
   4761     
   4762 /[ab]{2,3}/
   4763     aaaa
   4764     
   4765 /[ab]{2,3}?/
   4766     aaaa
   4767     
   4768 /[ab]{2,}/
   4769     aaaa    
   4770 
   4771 /[ab]{2,}?/
   4772     aaaa    
   4773 
   4774 '\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++'
   4775     NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
   4776 
   4777 '\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
   4778     NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
   4779 
   4780 /abc(?=xyz)/allusedtext
   4781     abcxyzpqr
   4782     abcxyzpqr\=aftertext
   4783     
   4784 /(?<=pqr)abc(?=xyz)/allusedtext
   4785     xyzpqrabcxyzpqr
   4786     xyzpqrabcxyzpqr\=aftertext
   4787     
   4788 /a\b/
   4789     a.\=allusedtext
   4790     a\=allusedtext  
   4791 
   4792 /abc(?=abcde)(?=ab)/allusedtext
   4793     abcabcdefg
   4794 
   4795 /a*?b*?/
   4796     ab
   4797 
   4798 /(*NOTEMPTY)a*?b*?/
   4799     ab
   4800     ba
   4801     cb  
   4802 
   4803 /(*NOTEMPTY_ATSTART)a*?b*?/aftertext
   4804     ab
   4805     cdab 
   4806 
   4807 /(a)(b)|(c)/
   4808     XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
   4809 
   4810 /(?<A>aa)/
   4811     aa\=get=A
   4812     aa\=copy=A 
   4813 
   4814 /a+/no_auto_possess
   4815     a\=ovector=2,get=1,get=2,getall
   4816     aaa\=ovector=2,get=1,get=2,getall
   4817 
   4818 /a(b)c(d)/
   4819     abc\=ph,copy=0,copy=1,getall
   4820 
   4821 /ab(?C" any text with spaces ")cde/B
   4822     abcde
   4823     12abcde
   4824 
   4825 /^a(b)c(?C1)def/
   4826       abcdef
   4827 
   4828 /^a(b)c(?C"AB")def/
   4829       abcdef
   4830 
   4831 /^a(b)c(?C1)def/
   4832       abcdef\=callout_capture
   4833 
   4834 /^a(b)c(?C{AB})def/B
   4835       abcdef\=callout_capture
   4836 
   4837 /^(?(?C25)(?=abc)abcd|xyz)/B
   4838     abcdefg
   4839     xyz123 
   4840 
   4841 /^(?(?C$abc$)(?=abc)abcd|xyz)/B
   4842     abcdefg
   4843     xyz123 
   4844 
   4845 /^ab(?C'first')cd(?C"second")ef/
   4846     abcdefg
   4847 
   4848 /(?:a(?C`code`)){3}X/
   4849     aaaXY
   4850 
   4851 # Binary zero in callout string
   4852 /"a(?C'x" 00 "z')b"/hex
   4853     abcdefgh
   4854 
   4855 /(?(?!)a|b)/
   4856     bbb
   4857 \= Expect no match
   4858     aaa 
   4859 
   4860 /^/gm
   4861     \n\n\n
   4862 
   4863 /^/gm,alt_circumflex
   4864     \n\n\n
   4865 
   4866 /abc/use_offset_limit
   4867     1234abcde\=offset_limit=100
   4868     1234abcde\=offset_limit=9
   4869     1234abcde\=offset_limit=4
   4870     1234abcde\=offset_limit=4,offset=4
   4871 \= Expect no match
   4872     1234abcde\=offset_limit=4,offset=5
   4873     1234abcde\=offset_limit=3
   4874 
   4875 /(?<=abc)/use_offset_limit
   4876     1234abc\=offset_limit=7
   4877 \= Expect no match
   4878     1234abc\=offset_limit=6
   4879 
   4880 /abcd/null_context
   4881     abcd\=null_context
   4882 
   4883 /()()a+/no_auto_possess
   4884     aaa\=dfa,allcaptures
   4885     a\=dfa,allcaptures
   4886 
   4887 # End of testinput6
   4888