Home | History | Annotate | Download | only in testdata
      1 /-- This set of tests is for features that are compatible with all versions of
      2     Perl 5, in non-UTF-8 mode. --/
      3 
      4 /the quick brown fox/
      5     the quick brown fox
      6     The quick brown FOX
      7     What do you know about the quick brown fox?
      8     What do you know about THE QUICK BROWN FOX?
      9 
     10 /The quick brown fox/i
     11     the quick brown fox
     12     The quick brown FOX
     13     What do you know about the quick brown fox?
     14     What do you know about THE QUICK BROWN FOX?
     15 
     16 /abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
     17     abcd\t\n\r\f\a\e9;\$\\?caxyz
     18 
     19 /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
     20     abxyzpqrrrabbxyyyypqAzz
     21     abxyzpqrrrabbxyyyypqAzz
     22     aabxyzpqrrrabbxyyyypqAzz
     23     aaabxyzpqrrrabbxyyyypqAzz
     24     aaaabxyzpqrrrabbxyyyypqAzz
     25     abcxyzpqrrrabbxyyyypqAzz
     26     aabcxyzpqrrrabbxyyyypqAzz
     27     aaabcxyzpqrrrabbxyyyypAzz
     28     aaabcxyzpqrrrabbxyyyypqAzz
     29     aaabcxyzpqrrrabbxyyyypqqAzz
     30     aaabcxyzpqrrrabbxyyyypqqqAzz
     31     aaabcxyzpqrrrabbxyyyypqqqqAzz
     32     aaabcxyzpqrrrabbxyyyypqqqqqAzz
     33     aaabcxyzpqrrrabbxyyyypqqqqqqAzz
     34     aaaabcxyzpqrrrabbxyyyypqAzz
     35     abxyzzpqrrrabbxyyyypqAzz
     36     aabxyzzzpqrrrabbxyyyypqAzz
     37     aaabxyzzzzpqrrrabbxyyyypqAzz
     38     aaaabxyzzzzpqrrrabbxyyyypqAzz
     39     abcxyzzpqrrrabbxyyyypqAzz
     40     aabcxyzzzpqrrrabbxyyyypqAzz
     41     aaabcxyzzzzpqrrrabbxyyyypqAzz
     42     aaaabcxyzzzzpqrrrabbxyyyypqAzz
     43     aaaabcxyzzzzpqrrrabbbxyyyypqAzz
     44     aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
     45     aaabcxyzpqrrrabbxyyyypABzz
     46     aaabcxyzpqrrrabbxyyyypABBzz
     47     >>>aaabxyzpqrrrabbxyyyypqAzz
     48     >aaaabxyzpqrrrabbxyyyypqAzz
     49     >>>>abcxyzpqrrrabbxyyyypqAzz
     50     *** Failers
     51     abxyzpqrrabbxyyyypqAzz
     52     abxyzpqrrrrabbxyyyypqAzz
     53     abxyzpqrrrabxyyyypqAzz
     54     aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
     55     aaaabcxyzzzzpqrrrabbbxyyypqAzz
     56     aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
     57 
     58 /^(abc){1,2}zz/
     59     abczz
     60     abcabczz
     61     *** Failers
     62     zz
     63     abcabcabczz
     64     >>abczz
     65 
     66 /^(b+?|a){1,2}?c/
     67     bc
     68     bbc
     69     bbbc
     70     bac
     71     bbac
     72     aac
     73     abbbbbbbbbbbc
     74     bbbbbbbbbbbac
     75     *** Failers
     76     aaac
     77     abbbbbbbbbbbac
     78 
     79 /^(b+|a){1,2}c/
     80     bc
     81     bbc
     82     bbbc
     83     bac
     84     bbac
     85     aac
     86     abbbbbbbbbbbc
     87     bbbbbbbbbbbac
     88     *** Failers
     89     aaac
     90     abbbbbbbbbbbac
     91 
     92 /^(b+|a){1,2}?bc/
     93     bbc
     94 
     95 /^(b*|ba){1,2}?bc/
     96     babc
     97     bbabc
     98     bababc
     99     *** Failers
    100     bababbc
    101     babababc
    102 
    103 /^(ba|b*){1,2}?bc/
    104     babc
    105     bbabc
    106     bababc
    107     *** Failers
    108     bababbc
    109     babababc
    110 
    111 /^\ca\cA\c[\c{\c:/
    112     \x01\x01\e;z
    113 
    114 /^[ab\]cde]/
    115     athing
    116     bthing
    117     ]thing
    118     cthing
    119     dthing
    120     ething
    121     *** Failers
    122     fthing
    123     [thing
    124     \\thing
    125 
    126 /^[]cde]/
    127     ]thing
    128     cthing
    129     dthing
    130     ething
    131     *** Failers
    132     athing
    133     fthing
    134 
    135 /^[^ab\]cde]/
    136     fthing
    137     [thing
    138     \\thing
    139     *** Failers
    140     athing
    141     bthing
    142     ]thing
    143     cthing
    144     dthing
    145     ething
    146 
    147 /^[^]cde]/
    148     athing
    149     fthing
    150     *** Failers
    151     ]thing
    152     cthing
    153     dthing
    154     ething
    155 
    156 /^\/
    157     
    158 
    159 /^/
    160     
    161 
    162 /^[0-9]+$/
    163     0
    164     1
    165     2
    166     3
    167     4
    168     5
    169     6
    170     7
    171     8
    172     9
    173     10
    174     100
    175     *** Failers
    176     abc
    177 
    178 /^.*nter/
    179     enter
    180     inter
    181     uponter
    182 
    183 /^xxx[0-9]+$/
    184     xxx0
    185     xxx1234
    186     *** Failers
    187     xxx
    188 
    189 /^.+[0-9][0-9][0-9]$/
    190     x123
    191     xx123
    192     123456
    193     *** Failers
    194     123
    195     x1234
    196 
    197 /^.+?[0-9][0-9][0-9]$/
    198     x123
    199     xx123
    200     123456
    201     *** Failers
    202     123
    203     x1234
    204 
    205 /^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
    206     abc!pqr=apquxz.ixr.zzz.ac.uk
    207     *** Failers
    208     !pqr=apquxz.ixr.zzz.ac.uk
    209     abc!=apquxz.ixr.zzz.ac.uk
    210     abc!pqr=apquxz:ixr.zzz.ac.uk
    211     abc!pqr=apquxz.ixr.zzz.ac.ukk
    212 
    213 /:/
    214     Well, we need a colon: somewhere
    215     *** Fail if we don't
    216 
    217 /([\da-f:]+)$/i
    218     0abc
    219     abc
    220     fed
    221     E
    222     ::
    223     5f03:12C0::932e
    224     fed def
    225     Any old stuff
    226     *** Failers
    227     0zzz
    228     gzzz
    229     fed\x20
    230     Any old rubbish
    231 
    232 /^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
    233     .1.2.3
    234     A.12.123.0
    235     *** Failers
    236     .1.2.3333
    237     1.2.3
    238     1234.2.3
    239 
    240 /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
    241     1 IN SOA non-sp1 non-sp2(
    242     1    IN    SOA    non-sp1    non-sp2   (
    243     *** Failers
    244     1IN SOA non-sp1 non-sp2(
    245 
    246 /^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
    247     a.
    248     Z.
    249     2.
    250     ab-c.pq-r.
    251     sxk.zzz.ac.uk.
    252     x-.y-.
    253     *** Failers
    254     -abc.peq.
    255 
    256 /^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
    257     *.a
    258     *.b0-a
    259     *.c3-b.c
    260     *.c-a.b-c
    261     *** Failers
    262     *.0
    263     *.a-
    264     *.a-b.c-
    265     *.c-a.0-c
    266 
    267 /^(?=ab(de))(abd)(e)/
    268     abde
    269 
    270 /^(?!(ab)de|x)(abd)(f)/
    271     abdf
    272 
    273 /^(?=(ab(cd)))(ab)/
    274     abcd
    275 
    276 /^[\da-f](\.[\da-f])*$/i
    277     a.b.c.d
    278     A.B.C.D
    279     a.b.c.1.2.3.C
    280 
    281 /^\".*\"\s*(;.*)?$/
    282     \"1234\"
    283     \"abcd\" ;
    284     \"\" ; rhubarb
    285     *** Failers
    286     \"1234\" : things
    287 
    288 /^$/
    289     \
    290     *** Failers
    291 
    292 /   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/x
    293     ab c
    294     *** Failers
    295     abc
    296     ab cde
    297 
    298 /(?x)   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/
    299     ab c
    300     *** Failers
    301     abc
    302     ab cde
    303 
    304 /^   a\ b[c ]d       $/x
    305     a bcd
    306     a b d
    307     *** Failers
    308     abcd
    309     ab d
    310 
    311 /^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
    312     abcdefhijklm
    313 
    314 /^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
    315     abcdefhijklm
    316 
    317 /^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
    318     a+ Z0+\x08\n\x1d\x12
    319 
    320 /^[.^$|()*+?{,}]+/
    321     .^\$(*+)|{?,?}
    322 
    323 /^a*\w/
    324     z
    325     az
    326     aaaz
    327     a
    328     aa
    329     aaaa
    330     a+
    331     aa+
    332 
    333 /^a*?\w/
    334     z
    335     az
    336     aaaz
    337     a
    338     aa
    339     aaaa
    340     a+
    341     aa+
    342 
    343 /^a+\w/
    344     az
    345     aaaz
    346     aa
    347     aaaa
    348     aa+
    349 
    350 /^a+?\w/
    351     az
    352     aaaz
    353     aa
    354     aaaa
    355     aa+
    356 
    357 /^\d{8}\w{2,}/
    358     1234567890
    359     12345678ab
    360     12345678__
    361     *** Failers
    362     1234567
    363 
    364 /^[aeiou\d]{4,5}$/
    365     uoie
    366     1234
    367     12345
    368     aaaaa
    369     *** Failers
    370     123456
    371 
    372 /^[aeiou\d]{4,5}?/
    373     uoie
    374     1234
    375     12345
    376     aaaaa
    377     123456
    378 
    379 /\A(abc|def)=(\1){2,3}\Z/
    380     abc=abcabc
    381     def=defdefdef
    382     *** Failers
    383     abc=defdef
    384 
    385 /^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
    386     abcdefghijkcda2
    387     abcdefghijkkkkcda2
    388 
    389 /(cat(a(ract|tonic)|erpillar)) \1()2(3)/
    390     cataract cataract23
    391     catatonic catatonic23
    392     caterpillar caterpillar23
    393 
    394 
    395 /^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]/
    396     From abcd  Mon Sep 01 12:33:02 1997
    397 
    398 /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
    399     From abcd  Mon Sep 01 12:33:02 1997
    400     From abcd  Mon Sep  1 12:33:02 1997
    401     *** Failers
    402     From abcd  Sep 01 12:33:02 1997
    403 
    404 /^12.34/s
    405     12\n34
    406     12\r34
    407 
    408 /\w+(?=\t)/
    409     the quick brown\t fox
    410 
    411 /foo(?!bar)(.*)/
    412     foobar is foolish see?
    413 
    414 /(?:(?!foo)...|^.{0,2})bar(.*)/
    415     foobar crowbar etc
    416     barrel
    417     2barrel
    418     A barrel
    419 
    420 /^(\D*)(?=\d)(?!123)/
    421     abc456
    422     *** Failers
    423     abc123
    424 
    425 /^1234(?# test newlines
    426   inside)/
    427     1234
    428 
    429 /^1234 #comment in extended re
    430   /x
    431     1234
    432 
    433 /#rhubarb
    434   abcd/x
    435     abcd
    436 
    437 /^abcd#rhubarb/x
    438     abcd
    439 
    440 /^(a)\1{2,3}(.)/
    441     aaab
    442     aaaab
    443     aaaaab
    444     aaaaaab
    445 
    446 /(?!^)abc/
    447     the abc
    448     *** Failers
    449     abc
    450 
    451 /(?=^)abc/
    452     abc
    453     *** Failers
    454     the abc
    455 
    456 /^[ab]{1,3}(ab*|b)/
    457     aabbbbb
    458 
    459 /^[ab]{1,3}?(ab*|b)/
    460     aabbbbb
    461 
    462 /^[ab]{1,3}?(ab*?|b)/
    463     aabbbbb
    464 
    465 /^[ab]{1,3}(ab*?|b)/
    466     aabbbbb
    467 
    468 /  (?: [\040\t] |  \(
    469 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    470 \)  )*                          # optional leading comment
    471 (?:    (?:
    472 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    473 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    474 |
    475 " (?:                      # opening quote...
    476 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    477 |                     #    or
    478 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    479 )* "  # closing quote
    480 )                    # initial word
    481 (?:  (?: [\040\t] |  \(
    482 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    483 \)  )*  \.  (?: [\040\t] |  \(
    484 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    485 \)  )*   (?:
    486 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    487 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    488 |
    489 " (?:                      # opening quote...
    490 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    491 |                     #    or
    492 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    493 )* "  # closing quote
    494 )  )* # further okay, if led by a period
    495 (?: [\040\t] |  \(
    496 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    497 \)  )*  @  (?: [\040\t] |  \(
    498 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    499 \)  )*    (?:
    500 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    501 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    502 |   \[                         # [
    503 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    504 \]                        #           ]
    505 )                           # initial subdomain
    506 (?:                                  #
    507 (?: [\040\t] |  \(
    508 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    509 \)  )*  \.                        # if led by a period...
    510 (?: [\040\t] |  \(
    511 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    512 \)  )*   (?:
    513 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    514 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    515 |   \[                         # [
    516 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    517 \]                        #           ]
    518 )                     #   ...further okay
    519 )*
    520 # address
    521 |                     #  or
    522 (?:
    523 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    524 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    525 |
    526 " (?:                      # opening quote...
    527 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    528 |                     #    or
    529 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    530 )* "  # closing quote
    531 )             # one word, optionally followed by....
    532 (?:
    533 [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]  |  # atom and space parts, or...
    534 \(
    535 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    536 \)       |  # comments, or...
    537 
    538 " (?:                      # opening quote...
    539 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    540 |                     #    or
    541 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    542 )* "  # closing quote
    543 # quoted strings
    544 )*
    545 <  (?: [\040\t] |  \(
    546 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    547 \)  )*                     # leading <
    548 (?:  @  (?: [\040\t] |  \(
    549 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    550 \)  )*    (?:
    551 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    552 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    553 |   \[                         # [
    554 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    555 \]                        #           ]
    556 )                           # initial subdomain
    557 (?:                                  #
    558 (?: [\040\t] |  \(
    559 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    560 \)  )*  \.                        # if led by a period...
    561 (?: [\040\t] |  \(
    562 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    563 \)  )*   (?:
    564 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    565 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    566 |   \[                         # [
    567 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    568 \]                        #           ]
    569 )                     #   ...further okay
    570 )*
    571 
    572 (?:  (?: [\040\t] |  \(
    573 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    574 \)  )*  ,  (?: [\040\t] |  \(
    575 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    576 \)  )*  @  (?: [\040\t] |  \(
    577 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    578 \)  )*    (?:
    579 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    580 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    581 |   \[                         # [
    582 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    583 \]                        #           ]
    584 )                           # initial subdomain
    585 (?:                                  #
    586 (?: [\040\t] |  \(
    587 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    588 \)  )*  \.                        # if led by a period...
    589 (?: [\040\t] |  \(
    590 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    591 \)  )*   (?:
    592 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    593 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    594 |   \[                         # [
    595 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    596 \]                        #           ]
    597 )                     #   ...further okay
    598 )*
    599 )* # further okay, if led by comma
    600 :                                # closing colon
    601 (?: [\040\t] |  \(
    602 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    603 \)  )*  )? #       optional route
    604 (?:
    605 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    606 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    607 |
    608 " (?:                      # opening quote...
    609 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    610 |                     #    or
    611 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    612 )* "  # closing quote
    613 )                    # initial word
    614 (?:  (?: [\040\t] |  \(
    615 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    616 \)  )*  \.  (?: [\040\t] |  \(
    617 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    618 \)  )*   (?:
    619 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    620 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    621 |
    622 " (?:                      # opening quote...
    623 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    624 |                     #    or
    625 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    626 )* "  # closing quote
    627 )  )* # further okay, if led by a period
    628 (?: [\040\t] |  \(
    629 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    630 \)  )*  @  (?: [\040\t] |  \(
    631 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    632 \)  )*    (?:
    633 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    634 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    635 |   \[                         # [
    636 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    637 \]                        #           ]
    638 )                           # initial subdomain
    639 (?:                                  #
    640 (?: [\040\t] |  \(
    641 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    642 \)  )*  \.                        # if led by a period...
    643 (?: [\040\t] |  \(
    644 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    645 \)  )*   (?:
    646 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    647 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    648 |   \[                         # [
    649 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    650 \]                        #           ]
    651 )                     #   ...further okay
    652 )*
    653 #       address spec
    654 (?: [\040\t] |  \(
    655 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    656 \)  )*  > #                  trailing >
    657 # name and address
    658 )  (?: [\040\t] |  \(
    659 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    660 \)  )*                       # optional trailing comment
    661 /x
    662     Alan Other <user\@dom.ain>
    663     <user\@dom.ain>
    664     user\@dom.ain
    665     \"A. Other\" <user.1234\@dom.ain> (a comment)
    666     A. Other <user.1234\@dom.ain> (a comment)
    667     \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
    668     A missing angle <user\@some.where
    669     *** Failers
    670     The quick brown fox
    671 
    672 /[\040\t]*                    # Nab whitespace.
    673 (?:
    674 \(                              #  (
    675 [^\\\x80-\xff\n\015()] *                             #     normal*
    676 (?:                                 #       (
    677 (?:  \\ [^\x80-\xff]  |
    678 \(                            #  (
    679 [^\\\x80-\xff\n\015()] *                            #     normal*
    680 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    681 \)                           #                       )
    682 )    #         special
    683 [^\\\x80-\xff\n\015()] *                         #         normal*
    684 )*                                  #            )*
    685 \)                             #                )
    686 [\040\t]* )*    # If comment found, allow more spaces.
    687 # optional leading comment
    688 (?:
    689 (?:
    690 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    691 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    692 # Atom
    693 |                       #  or
    694 "                                     # "
    695 [^\\\x80-\xff\n\015"] *                            #   normal
    696 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
    697 "                                     #        "
    698 # Quoted string
    699 )
    700 [\040\t]*                    # Nab whitespace.
    701 (?:
    702 \(                              #  (
    703 [^\\\x80-\xff\n\015()] *                             #     normal*
    704 (?:                                 #       (
    705 (?:  \\ [^\x80-\xff]  |
    706 \(                            #  (
    707 [^\\\x80-\xff\n\015()] *                            #     normal*
    708 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    709 \)                           #                       )
    710 )    #         special
    711 [^\\\x80-\xff\n\015()] *                         #         normal*
    712 )*                                  #            )*
    713 \)                             #                )
    714 [\040\t]* )*    # If comment found, allow more spaces.
    715 (?:
    716 \.
    717 [\040\t]*                    # Nab whitespace.
    718 (?:
    719 \(                              #  (
    720 [^\\\x80-\xff\n\015()] *                             #     normal*
    721 (?:                                 #       (
    722 (?:  \\ [^\x80-\xff]  |
    723 \(                            #  (
    724 [^\\\x80-\xff\n\015()] *                            #     normal*
    725 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    726 \)                           #                       )
    727 )    #         special
    728 [^\\\x80-\xff\n\015()] *                         #         normal*
    729 )*                                  #            )*
    730 \)                             #                )
    731 [\040\t]* )*    # If comment found, allow more spaces.
    732 (?:
    733 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    734 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    735 # Atom
    736 |                       #  or
    737 "                                     # "
    738 [^\\\x80-\xff\n\015"] *                            #   normal
    739 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
    740 "                                     #        "
    741 # Quoted string
    742 )
    743 [\040\t]*                    # Nab whitespace.
    744 (?:
    745 \(                              #  (
    746 [^\\\x80-\xff\n\015()] *                             #     normal*
    747 (?:                                 #       (
    748 (?:  \\ [^\x80-\xff]  |
    749 \(                            #  (
    750 [^\\\x80-\xff\n\015()] *                            #     normal*
    751 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    752 \)                           #                       )
    753 )    #         special
    754 [^\\\x80-\xff\n\015()] *                         #         normal*
    755 )*                                  #            )*
    756 \)                             #                )
    757 [\040\t]* )*    # If comment found, allow more spaces.
    758 # additional words
    759 )*
    760 @
    761 [\040\t]*                    # Nab whitespace.
    762 (?:
    763 \(                              #  (
    764 [^\\\x80-\xff\n\015()] *                             #     normal*
    765 (?:                                 #       (
    766 (?:  \\ [^\x80-\xff]  |
    767 \(                            #  (
    768 [^\\\x80-\xff\n\015()] *                            #     normal*
    769 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    770 \)                           #                       )
    771 )    #         special
    772 [^\\\x80-\xff\n\015()] *                         #         normal*
    773 )*                                  #            )*
    774 \)                             #                )
    775 [\040\t]* )*    # If comment found, allow more spaces.
    776 (?:
    777 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    778 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    779 |
    780 \[                            # [
    781 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
    782 \]                           #           ]
    783 )
    784 [\040\t]*                    # Nab whitespace.
    785 (?:
    786 \(                              #  (
    787 [^\\\x80-\xff\n\015()] *                             #     normal*
    788 (?:                                 #       (
    789 (?:  \\ [^\x80-\xff]  |
    790 \(                            #  (
    791 [^\\\x80-\xff\n\015()] *                            #     normal*
    792 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    793 \)                           #                       )
    794 )    #         special
    795 [^\\\x80-\xff\n\015()] *                         #         normal*
    796 )*                                  #            )*
    797 \)                             #                )
    798 [\040\t]* )*    # If comment found, allow more spaces.
    799 # optional trailing comments
    800 (?:
    801 \.
    802 [\040\t]*                    # Nab whitespace.
    803 (?:
    804 \(                              #  (
    805 [^\\\x80-\xff\n\015()] *                             #     normal*
    806 (?:                                 #       (
    807 (?:  \\ [^\x80-\xff]  |
    808 \(                            #  (
    809 [^\\\x80-\xff\n\015()] *                            #     normal*
    810 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    811 \)                           #                       )
    812 )    #         special
    813 [^\\\x80-\xff\n\015()] *                         #         normal*
    814 )*                                  #            )*
    815 \)                             #                )
    816 [\040\t]* )*    # If comment found, allow more spaces.
    817 (?:
    818 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    819 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    820 |
    821 \[                            # [
    822 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
    823 \]                           #           ]
    824 )
    825 [\040\t]*                    # Nab whitespace.
    826 (?:
    827 \(                              #  (
    828 [^\\\x80-\xff\n\015()] *                             #     normal*
    829 (?:                                 #       (
    830 (?:  \\ [^\x80-\xff]  |
    831 \(                            #  (
    832 [^\\\x80-\xff\n\015()] *                            #     normal*
    833 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    834 \)                           #                       )
    835 )    #         special
    836 [^\\\x80-\xff\n\015()] *                         #         normal*
    837 )*                                  #            )*
    838 \)                             #                )
    839 [\040\t]* )*    # If comment found, allow more spaces.
    840 # optional trailing comments
    841 )*
    842 # address
    843 |                             #  or
    844 (?:
    845 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    846 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    847 # Atom
    848 |                       #  or
    849 "                                     # "
    850 [^\\\x80-\xff\n\015"] *                            #   normal
    851 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
    852 "                                     #        "
    853 # Quoted string
    854 )
    855 # leading word
    856 [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *               # "normal" atoms and or spaces
    857 (?:
    858 (?:
    859 \(                              #  (
    860 [^\\\x80-\xff\n\015()] *                             #     normal*
    861 (?:                                 #       (
    862 (?:  \\ [^\x80-\xff]  |
    863 \(                            #  (
    864 [^\\\x80-\xff\n\015()] *                            #     normal*
    865 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    866 \)                           #                       )
    867 )    #         special
    868 [^\\\x80-\xff\n\015()] *                         #         normal*
    869 )*                                  #            )*
    870 \)                             #                )
    871 |
    872 "                                     # "
    873 [^\\\x80-\xff\n\015"] *                            #   normal
    874 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
    875 "                                     #        "
    876 ) # "special" comment or quoted string
    877 [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *            #  more "normal"
    878 )*
    879 <
    880 [\040\t]*                    # Nab whitespace.
    881 (?:
    882 \(                              #  (
    883 [^\\\x80-\xff\n\015()] *                             #     normal*
    884 (?:                                 #       (
    885 (?:  \\ [^\x80-\xff]  |
    886 \(                            #  (
    887 [^\\\x80-\xff\n\015()] *                            #     normal*
    888 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    889 \)                           #                       )
    890 )    #         special
    891 [^\\\x80-\xff\n\015()] *                         #         normal*
    892 )*                                  #            )*
    893 \)                             #                )
    894 [\040\t]* )*    # If comment found, allow more spaces.
    895 # <
    896 (?:
    897 @
    898 [\040\t]*                    # Nab whitespace.
    899 (?:
    900 \(                              #  (
    901 [^\\\x80-\xff\n\015()] *                             #     normal*
    902 (?:                                 #       (
    903 (?:  \\ [^\x80-\xff]  |
    904 \(                            #  (
    905 [^\\\x80-\xff\n\015()] *                            #     normal*
    906 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    907 \)                           #                       )
    908 )    #         special
    909 [^\\\x80-\xff\n\015()] *                         #         normal*
    910 )*                                  #            )*
    911 \)                             #                )
    912 [\040\t]* )*    # If comment found, allow more spaces.
    913 (?:
    914 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    915 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    916 |
    917 \[                            # [
    918 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
    919 \]                           #           ]
    920 )
    921 [\040\t]*                    # Nab whitespace.
    922 (?:
    923 \(                              #  (
    924 [^\\\x80-\xff\n\015()] *                             #     normal*
    925 (?:                                 #       (
    926 (?:  \\ [^\x80-\xff]  |
    927 \(                            #  (
    928 [^\\\x80-\xff\n\015()] *                            #     normal*
    929 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    930 \)                           #                       )
    931 )    #         special
    932 [^\\\x80-\xff\n\015()] *                         #         normal*
    933 )*                                  #            )*
    934 \)                             #                )
    935 [\040\t]* )*    # If comment found, allow more spaces.
    936 # optional trailing comments
    937 (?:
    938 \.
    939 [\040\t]*                    # Nab whitespace.
    940 (?:
    941 \(                              #  (
    942 [^\\\x80-\xff\n\015()] *                             #     normal*
    943 (?:                                 #       (
    944 (?:  \\ [^\x80-\xff]  |
    945 \(                            #  (
    946 [^\\\x80-\xff\n\015()] *                            #     normal*
    947 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    948 \)                           #                       )
    949 )    #         special
    950 [^\\\x80-\xff\n\015()] *                         #         normal*
    951 )*                                  #            )*
    952 \)                             #                )
    953 [\040\t]* )*    # If comment found, allow more spaces.
    954 (?:
    955 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    956 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    957 |
    958 \[                            # [
    959 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
    960 \]                           #           ]
    961 )
    962 [\040\t]*                    # Nab whitespace.
    963 (?:
    964 \(                              #  (
    965 [^\\\x80-\xff\n\015()] *                             #     normal*
    966 (?:                                 #       (
    967 (?:  \\ [^\x80-\xff]  |
    968 \(                            #  (
    969 [^\\\x80-\xff\n\015()] *                            #     normal*
    970 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    971 \)                           #                       )
    972 )    #         special
    973 [^\\\x80-\xff\n\015()] *                         #         normal*
    974 )*                                  #            )*
    975 \)                             #                )
    976 [\040\t]* )*    # If comment found, allow more spaces.
    977 # optional trailing comments
    978 )*
    979 (?: ,
    980 [\040\t]*                    # Nab whitespace.
    981 (?:
    982 \(                              #  (
    983 [^\\\x80-\xff\n\015()] *                             #     normal*
    984 (?:                                 #       (
    985 (?:  \\ [^\x80-\xff]  |
    986 \(                            #  (
    987 [^\\\x80-\xff\n\015()] *                            #     normal*
    988 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    989 \)                           #                       )
    990 )    #         special
    991 [^\\\x80-\xff\n\015()] *                         #         normal*
    992 )*                                  #            )*
    993 \)                             #                )
    994 [\040\t]* )*    # If comment found, allow more spaces.
    995 @
    996 [\040\t]*                    # Nab whitespace.
    997 (?:
    998 \(                              #  (
    999 [^\\\x80-\xff\n\015()] *                             #     normal*
   1000 (?:                                 #       (
   1001 (?:  \\ [^\x80-\xff]  |
   1002 \(                            #  (
   1003 [^\\\x80-\xff\n\015()] *                            #     normal*
   1004 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1005 \)                           #                       )
   1006 )    #         special
   1007 [^\\\x80-\xff\n\015()] *                         #         normal*
   1008 )*                                  #            )*
   1009 \)                             #                )
   1010 [\040\t]* )*    # If comment found, allow more spaces.
   1011 (?:
   1012 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1013 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1014 |
   1015 \[                            # [
   1016 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
   1017 \]                           #           ]
   1018 )
   1019 [\040\t]*                    # Nab whitespace.
   1020 (?:
   1021 \(                              #  (
   1022 [^\\\x80-\xff\n\015()] *                             #     normal*
   1023 (?:                                 #       (
   1024 (?:  \\ [^\x80-\xff]  |
   1025 \(                            #  (
   1026 [^\\\x80-\xff\n\015()] *                            #     normal*
   1027 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1028 \)                           #                       )
   1029 )    #         special
   1030 [^\\\x80-\xff\n\015()] *                         #         normal*
   1031 )*                                  #            )*
   1032 \)                             #                )
   1033 [\040\t]* )*    # If comment found, allow more spaces.
   1034 # optional trailing comments
   1035 (?:
   1036 \.
   1037 [\040\t]*                    # Nab whitespace.
   1038 (?:
   1039 \(                              #  (
   1040 [^\\\x80-\xff\n\015()] *                             #     normal*
   1041 (?:                                 #       (
   1042 (?:  \\ [^\x80-\xff]  |
   1043 \(                            #  (
   1044 [^\\\x80-\xff\n\015()] *                            #     normal*
   1045 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1046 \)                           #                       )
   1047 )    #         special
   1048 [^\\\x80-\xff\n\015()] *                         #         normal*
   1049 )*                                  #            )*
   1050 \)                             #                )
   1051 [\040\t]* )*    # If comment found, allow more spaces.
   1052 (?:
   1053 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1054 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1055 |
   1056 \[                            # [
   1057 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
   1058 \]                           #           ]
   1059 )
   1060 [\040\t]*                    # Nab whitespace.
   1061 (?:
   1062 \(                              #  (
   1063 [^\\\x80-\xff\n\015()] *                             #     normal*
   1064 (?:                                 #       (
   1065 (?:  \\ [^\x80-\xff]  |
   1066 \(                            #  (
   1067 [^\\\x80-\xff\n\015()] *                            #     normal*
   1068 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1069 \)                           #                       )
   1070 )    #         special
   1071 [^\\\x80-\xff\n\015()] *                         #         normal*
   1072 )*                                  #            )*
   1073 \)                             #                )
   1074 [\040\t]* )*    # If comment found, allow more spaces.
   1075 # optional trailing comments
   1076 )*
   1077 )*  # additional domains
   1078 :
   1079 [\040\t]*                    # Nab whitespace.
   1080 (?:
   1081 \(                              #  (
   1082 [^\\\x80-\xff\n\015()] *                             #     normal*
   1083 (?:                                 #       (
   1084 (?:  \\ [^\x80-\xff]  |
   1085 \(                            #  (
   1086 [^\\\x80-\xff\n\015()] *                            #     normal*
   1087 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1088 \)                           #                       )
   1089 )    #         special
   1090 [^\\\x80-\xff\n\015()] *                         #         normal*
   1091 )*                                  #            )*
   1092 \)                             #                )
   1093 [\040\t]* )*    # If comment found, allow more spaces.
   1094 # optional trailing comments
   1095 )?     #       optional route
   1096 (?:
   1097 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1098 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1099 # Atom
   1100 |                       #  or
   1101 "                                     # "
   1102 [^\\\x80-\xff\n\015"] *                            #   normal
   1103 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
   1104 "                                     #        "
   1105 # Quoted string
   1106 )
   1107 [\040\t]*                    # Nab whitespace.
   1108 (?:
   1109 \(                              #  (
   1110 [^\\\x80-\xff\n\015()] *                             #     normal*
   1111 (?:                                 #       (
   1112 (?:  \\ [^\x80-\xff]  |
   1113 \(                            #  (
   1114 [^\\\x80-\xff\n\015()] *                            #     normal*
   1115 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1116 \)                           #                       )
   1117 )    #         special
   1118 [^\\\x80-\xff\n\015()] *                         #         normal*
   1119 )*                                  #            )*
   1120 \)                             #                )
   1121 [\040\t]* )*    # If comment found, allow more spaces.
   1122 (?:
   1123 \.
   1124 [\040\t]*                    # Nab whitespace.
   1125 (?:
   1126 \(                              #  (
   1127 [^\\\x80-\xff\n\015()] *                             #     normal*
   1128 (?:                                 #       (
   1129 (?:  \\ [^\x80-\xff]  |
   1130 \(                            #  (
   1131 [^\\\x80-\xff\n\015()] *                            #     normal*
   1132 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1133 \)                           #                       )
   1134 )    #         special
   1135 [^\\\x80-\xff\n\015()] *                         #         normal*
   1136 )*                                  #            )*
   1137 \)                             #                )
   1138 [\040\t]* )*    # If comment found, allow more spaces.
   1139 (?:
   1140 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1141 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1142 # Atom
   1143 |                       #  or
   1144 "                                     # "
   1145 [^\\\x80-\xff\n\015"] *                            #   normal
   1146 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
   1147 "                                     #        "
   1148 # Quoted string
   1149 )
   1150 [\040\t]*                    # Nab whitespace.
   1151 (?:
   1152 \(                              #  (
   1153 [^\\\x80-\xff\n\015()] *                             #     normal*
   1154 (?:                                 #       (
   1155 (?:  \\ [^\x80-\xff]  |
   1156 \(                            #  (
   1157 [^\\\x80-\xff\n\015()] *                            #     normal*
   1158 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1159 \)                           #                       )
   1160 )    #         special
   1161 [^\\\x80-\xff\n\015()] *                         #         normal*
   1162 )*                                  #            )*
   1163 \)                             #                )
   1164 [\040\t]* )*    # If comment found, allow more spaces.
   1165 # additional words
   1166 )*
   1167 @
   1168 [\040\t]*                    # Nab whitespace.
   1169 (?:
   1170 \(                              #  (
   1171 [^\\\x80-\xff\n\015()] *                             #     normal*
   1172 (?:                                 #       (
   1173 (?:  \\ [^\x80-\xff]  |
   1174 \(                            #  (
   1175 [^\\\x80-\xff\n\015()] *                            #     normal*
   1176 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1177 \)                           #                       )
   1178 )    #         special
   1179 [^\\\x80-\xff\n\015()] *                         #         normal*
   1180 )*                                  #            )*
   1181 \)                             #                )
   1182 [\040\t]* )*    # If comment found, allow more spaces.
   1183 (?:
   1184 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1185 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1186 |
   1187 \[                            # [
   1188 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
   1189 \]                           #           ]
   1190 )
   1191 [\040\t]*                    # Nab whitespace.
   1192 (?:
   1193 \(                              #  (
   1194 [^\\\x80-\xff\n\015()] *                             #     normal*
   1195 (?:                                 #       (
   1196 (?:  \\ [^\x80-\xff]  |
   1197 \(                            #  (
   1198 [^\\\x80-\xff\n\015()] *                            #     normal*
   1199 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1200 \)                           #                       )
   1201 )    #         special
   1202 [^\\\x80-\xff\n\015()] *                         #         normal*
   1203 )*                                  #            )*
   1204 \)                             #                )
   1205 [\040\t]* )*    # If comment found, allow more spaces.
   1206 # optional trailing comments
   1207 (?:
   1208 \.
   1209 [\040\t]*                    # Nab whitespace.
   1210 (?:
   1211 \(                              #  (
   1212 [^\\\x80-\xff\n\015()] *                             #     normal*
   1213 (?:                                 #       (
   1214 (?:  \\ [^\x80-\xff]  |
   1215 \(                            #  (
   1216 [^\\\x80-\xff\n\015()] *                            #     normal*
   1217 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1218 \)                           #                       )
   1219 )    #         special
   1220 [^\\\x80-\xff\n\015()] *                         #         normal*
   1221 )*                                  #            )*
   1222 \)                             #                )
   1223 [\040\t]* )*    # If comment found, allow more spaces.
   1224 (?:
   1225 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1226 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1227 |
   1228 \[                            # [
   1229 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
   1230 \]                           #           ]
   1231 )
   1232 [\040\t]*                    # Nab whitespace.
   1233 (?:
   1234 \(                              #  (
   1235 [^\\\x80-\xff\n\015()] *                             #     normal*
   1236 (?:                                 #       (
   1237 (?:  \\ [^\x80-\xff]  |
   1238 \(                            #  (
   1239 [^\\\x80-\xff\n\015()] *                            #     normal*
   1240 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1241 \)                           #                       )
   1242 )    #         special
   1243 [^\\\x80-\xff\n\015()] *                         #         normal*
   1244 )*                                  #            )*
   1245 \)                             #                )
   1246 [\040\t]* )*    # If comment found, allow more spaces.
   1247 # optional trailing comments
   1248 )*
   1249 #       address spec
   1250 >                    #                 >
   1251 # name and address
   1252 )
   1253 /x
   1254     Alan Other <user\@dom.ain>
   1255     <user\@dom.ain>
   1256     user\@dom.ain
   1257     \"A. Other\" <user.1234\@dom.ain> (a comment)
   1258     A. Other <user.1234\@dom.ain> (a comment)
   1259     \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
   1260     A missing angle <user\@some.where
   1261     *** Failers
   1262     The quick brown fox
   1263 
   1264 /abc\0def\00pqr\000xyz\0000AB/
   1265     abc\0def\00pqr\000xyz\0000AB
   1266     abc456 abc\0def\00pqr\000xyz\0000ABCDE
   1267 
   1268 /abc\x0def\x00pqr\x000xyz\x0000AB/
   1269     abc\x0def\x00pqr\x000xyz\x0000AB
   1270     abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
   1271 
   1272 /^[\000-\037]/
   1273     \0A
   1274     \01B
   1275     \037C
   1276 
   1277 /\0*/
   1278     \0\0\0\0
   1279 
   1280 /A\x0{2,3}Z/
   1281     The A\x0\x0Z
   1282     An A\0\x0\0Z
   1283     *** Failers
   1284     A\0Z
   1285     A\0\x0\0\x0Z
   1286 
   1287 /^(cow|)\1(bell)/
   1288     cowcowbell
   1289     bell
   1290     *** Failers
   1291     cowbell
   1292 
   1293 /^\s/
   1294     \040abc
   1295     \x0cabc
   1296     \nabc
   1297     \rabc
   1298     \tabc
   1299     *** Failers
   1300     abc
   1301 
   1302 /^a	b
   1303       c/x
   1305     abc
   1306 
   1307 /^(a|)\1*b/
   1308     ab
   1309     aaaab
   1310     b
   1311     *** Failers
   1312     acb
   1313 
   1314 /^(a|)\1+b/
   1315     aab
   1316     aaaab
   1317     b
   1318     *** Failers
   1319     ab
   1320 
   1321 /^(a|)\1?b/
   1322     ab
   1323     aab
   1324     b
   1325     *** Failers
   1326     acb
   1327 
   1328 /^(a|)\1{2}b/
   1329     aaab
   1330     b
   1331     *** Failers
   1332     ab
   1333     aab
   1334     aaaab
   1335 
   1336 /^(a|)\1{2,3}b/
   1337     aaab
   1338     aaaab
   1339     b
   1340     *** Failers
   1341     ab
   1342     aab
   1343     aaaaab
   1344 
   1345 /ab{1,3}bc/
   1346     abbbbc
   1347     abbbc
   1348     abbc
   1349     *** Failers
   1350     abc
   1351     abbbbbc
   1352 
   1353 /([^.]*)\.([^:]*):[T ]+(.*)/
   1354     track1.title:TBlah blah blah
   1355 
   1356 /([^.]*)\.([^:]*):[T ]+(.*)/i
   1357     track1.title:TBlah blah blah
   1358 
   1359 /([^.]*)\.([^:]*):[t ]+(.*)/i
   1360     track1.title:TBlah blah blah
   1361 
   1362 /^[W-c]+$/
   1363     WXY_^abc
   1364     *** Failers
   1365     wxy
   1366 
   1367 /^[W-c]+$/i
   1368     WXY_^abc
   1369     wxy_^ABC
   1370 
   1371 /^[\x3f-\x5F]+$/i
   1372     WXY_^abc
   1373     wxy_^ABC
   1374 
   1375 /^abc$/m
   1376     abc
   1377     qqq\nabc
   1378     abc\nzzz
   1379     qqq\nabc\nzzz
   1380 
   1381 /^abc$/
   1382     abc
   1383     *** Failers
   1384     qqq\nabc
   1385     abc\nzzz
   1386     qqq\nabc\nzzz
   1387 
   1388 /\Aabc\Z/m
   1389     abc
   1390     abc\n 
   1391     *** Failers
   1392     qqq\nabc
   1393     abc\nzzz
   1394     qqq\nabc\nzzz
   1395     
   1396 /\A(.)*\Z/s
   1397     abc\ndef
   1398 
   1399 /\A(.)*\Z/m
   1400     *** Failers
   1401     abc\ndef
   1402 
   1403 /(?:b)|(?::+)/
   1404     b::c
   1405     c::b
   1406 
   1407 /[-az]+/
   1408     az-
   1409     *** Failers
   1410     b
   1411 
   1412 /[az-]+/
   1413     za-
   1414     *** Failers
   1415     b
   1416 
   1417 /[a\-z]+/
   1418     a-z
   1419     *** Failers
   1420     b
   1421 
   1422 /[a-z]+/
   1423     abcdxyz
   1424 
   1425 /[\d-]+/
   1426     12-34
   1427     *** Failers
   1428     aaa
   1429 
   1430 /[\d-z]+/
   1431     12-34z
   1432     *** Failers
   1433     aaa
   1434 
   1435 /\x5c/
   1436     \\
   1437 
   1438 /\x20Z/
   1439     the Zoo
   1440     *** Failers
   1441     Zulu
   1442 
   1443 /(abc)\1/i
   1444     abcabc
   1445     ABCabc
   1446     abcABC
   1447 
   1448 /ab{3cd/
   1449     ab{3cd
   1450 
   1451 /ab{3,cd/
   1452     ab{3,cd
   1453 
   1454 /ab{3,4a}cd/
   1455     ab{3,4a}cd
   1456 
   1457 /{4,5a}bc/
   1458     {4,5a}bc
   1459 
   1460 /abc$/
   1461     abc
   1462     abc\n
   1463     *** Failers
   1464     abc\ndef
   1465 
   1466 /(abc)\123/
   1467     abc\x53
   1468 
   1469 /(abc)\223/
   1470     abc\x93
   1471 
   1472 /(abc)\323/
   1473     abc\xd3
   1474 
   1475 /(abc)\100/
   1476     abc\x40
   1477     abc\100
   1478 
   1479 /(abc)\1000/
   1480     abc\x400
   1481     abc\x40\x30
   1482     abc\1000
   1483     abc\100\x30
   1484     abc\100\060
   1485     abc\100\60
   1486 
   1487 /abc\81/
   1488     abc\081
   1489     abc\0\x38\x31
   1490 
   1491 /abc\91/
   1492     abc\091
   1493     abc\0\x39\x31
   1494 
   1495 /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
   1496     abcdefghijkllS
   1497 
   1498 /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
   1499     abcdefghijk\12S
   1500 
   1501 /ab\idef/
   1502     abidef
   1503 
   1504 /a{0}bc/
   1505     bc
   1506 
   1507 /(a|(bc)){0,0}?xyz/
   1508     xyz
   1509 
   1510 /abc[\10]de/
   1511     abc\010de
   1512 
   1513 /abc[\1]de/
   1514     abc\1de
   1515 
   1516 /(abc)[\1]de/
   1517     abc\1de
   1518 
   1519 /(?s)a.b/
   1520     a\nb
   1521 
   1522 /^([^a])([^\b])([^c]*)([^d]{3,4})/
   1523     baNOTccccd
   1524     baNOTcccd
   1525     baNOTccd
   1526     bacccd
   1527     *** Failers
   1528     anything
   1529     b\bc   
   1530     baccd
   1531 
   1532 /[^a]/
   1533     Abc
   1534   
   1535 /[^a]/i
   1536     Abc 
   1537 
   1538 /[^a]+/
   1539     AAAaAbc
   1540   
   1541 /[^a]+/i
   1542     AAAaAbc 
   1543 
   1544 /[^a]+/
   1545     bbb\nccc
   1546    
   1547 /[^k]$/
   1548     abc
   1549     *** Failers
   1550     abk   
   1551    
   1552 /[^k]{2,3}$/
   1553     abc
   1554     kbc
   1555     kabc 
   1556     *** Failers
   1557     abk
   1558     akb
   1559     akk 
   1560 
   1561 /^\d{8,}\@.+[^k]$/
   1562     12345678\@a.b.c.d
   1563     123456789\@x.y.z
   1564     *** Failers
   1565     12345678\@x.y.uk
   1566     1234567\@a.b.c.d       
   1567 
   1568 /(a)\1{8,}/
   1569     aaaaaaaaa
   1570     aaaaaaaaaa
   1571     *** Failers
   1572     aaaaaaa   
   1573 
   1574 /[^a]/
   1575     aaaabcd
   1576     aaAabcd 
   1577 
   1578 /[^a]/i
   1579     aaaabcd
   1580     aaAabcd 
   1581 
   1582 /[^az]/
   1583     aaaabcd
   1584     aaAabcd 
   1585 
   1586 /[^az]/i
   1587     aaaabcd
   1588     aaAabcd 
   1589 
   1590 /\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/
   1591  \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
   1592 
   1593 /P[^*]TAIRE[^*]{1,6}?LL/
   1594     xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
   1595 
   1596 /P[^*]TAIRE[^*]{1,}?LL/
   1597     xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
   1598 
   1599 /(\.\d\d[1-9]?)\d+/
   1600     1.230003938
   1601     1.875000282   
   1602     1.235  
   1603                   
   1604 /(\.\d\d((?=0)|\d(?=\d)))/
   1605     1.230003938      
   1606     1.875000282
   1607     *** Failers 
   1608     1.235 
   1609     
   1610 /a(?)b/
   1611     ab 
   1612  
   1613 /\b(foo)\s+(\w+)/i
   1614     Food is on the foo table
   1615     
   1616 /foo(.*)bar/
   1617     The food is under the bar in the barn.
   1618     
   1619 /foo(.*?)bar/  
   1620     The food is under the bar in the barn.
   1621 
   1622 /(.*)(\d*)/
   1623     I have 2 numbers: 53147
   1624     
   1625 /(.*)(\d+)/
   1626     I have 2 numbers: 53147
   1627  
   1628 /(.*?)(\d*)/
   1629     I have 2 numbers: 53147
   1630 
   1631 /(.*?)(\d+)/
   1632     I have 2 numbers: 53147
   1633 
   1634 /(.*)(\d+)$/
   1635     I have 2 numbers: 53147
   1636 
   1637 /(.*?)(\d+)$/
   1638     I have 2 numbers: 53147
   1639 
   1640 /(.*)\b(\d+)$/
   1641     I have 2 numbers: 53147
   1642 
   1643 /(.*\D)(\d+)$/
   1644     I have 2 numbers: 53147
   1645 
   1646 /^\D*(?!123)/
   1647     ABC123
   1648      
   1649 /^(\D*)(?=\d)(?!123)/
   1650     ABC445
   1651     *** Failers
   1652     ABC123
   1653     
   1654 /^[W-]46]/
   1655     W46]789 
   1656     -46]789
   1657     *** Failers
   1658     Wall
   1659     Zebra
   1660     42
   1661     [abcd] 
   1662     ]abcd[
   1663        
   1664 /^[W-\]46]/
   1665     W46]789 
   1666     Wall
   1667     Zebra
   1668     Xylophone  
   1669     42
   1670     [abcd] 
   1671     ]abcd[
   1672     \\backslash 
   1673     *** Failers
   1674     -46]789
   1675     well
   1676     
   1677 /\d\d\/\d\d\/\d\d\d\d/
   1678     01/01/2000
   1679 
   1680 /word (?:[a-zA-Z0-9]+ ){0,10}otherword/
   1681   word cat dog elephant mussel cow horse canary baboon snake shark otherword
   1682   word cat dog elephant mussel cow horse canary baboon snake shark
   1683 
   1684 /word (?:[a-zA-Z0-9]+ ){0,300}otherword/
   1685   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
   1686 
   1687 /^(a){0,0}/
   1688     bcd
   1689     abc
   1690     aab     
   1691 
   1692 /^(a){0,1}/
   1693     bcd
   1694     abc
   1695     aab  
   1696 
   1697 /^(a){0,2}/
   1698     bcd
   1699     abc
   1700     aab  
   1701 
   1702 /^(a){0,3}/
   1703     bcd
   1704     abc
   1705     aab
   1706     aaa   
   1707 
   1708 /^(a){0,}/
   1709     bcd
   1710     abc
   1711     aab
   1712     aaa
   1713     aaaaaaaa    
   1714 
   1715 /^(a){1,1}/
   1716     bcd
   1717     abc
   1718     aab  
   1719 
   1720 /^(a){1,2}/
   1721     bcd
   1722     abc
   1723     aab  
   1724 
   1725 /^(a){1,3}/
   1726     bcd
   1727     abc
   1728     aab
   1729     aaa   
   1730 
   1731 /^(a){1,}/
   1732     bcd
   1733     abc
   1734     aab
   1735     aaa
   1736     aaaaaaaa    
   1737 
   1738 /.*\.gif/
   1739     borfle\nbib.gif\nno
   1740 
   1741 /.{0,}\.gif/
   1742     borfle\nbib.gif\nno
   1743 
   1744 /.*\.gif/m
   1745     borfle\nbib.gif\nno
   1746 
   1747 /.*\.gif/s
   1748     borfle\nbib.gif\nno
   1749 
   1750 /.*\.gif/ms
   1751     borfle\nbib.gif\nno
   1752     
   1753 /.*$/
   1754     borfle\nbib.gif\nno
   1755 
   1756 /.*$/m
   1757     borfle\nbib.gif\nno
   1758 
   1759 /.*$/s
   1760     borfle\nbib.gif\nno
   1761 
   1762 /.*$/ms
   1763     borfle\nbib.gif\nno
   1764     
   1765 /.*$/
   1766     borfle\nbib.gif\nno\n
   1767 
   1768 /.*$/m
   1769     borfle\nbib.gif\nno\n
   1770 
   1771 /.*$/s
   1772     borfle\nbib.gif\nno\n
   1773 
   1774 /.*$/ms
   1775     borfle\nbib.gif\nno\n
   1776     
   1777 /(.*X|^B)/
   1778     abcde\n1234Xyz
   1779     BarFoo 
   1780     *** Failers
   1781     abcde\nBar  
   1782 
   1783 /(.*X|^B)/m
   1784     abcde\n1234Xyz
   1785     BarFoo 
   1786     abcde\nBar  
   1787 
   1788 /(.*X|^B)/s
   1789     abcde\n1234Xyz
   1790     BarFoo 
   1791     *** Failers
   1792     abcde\nBar  
   1793 
   1794 /(.*X|^B)/ms
   1795     abcde\n1234Xyz
   1796     BarFoo 
   1797     abcde\nBar  
   1798 
   1799 /(?s)(.*X|^B)/
   1800     abcde\n1234Xyz
   1801     BarFoo 
   1802     *** Failers 
   1803     abcde\nBar  
   1804 
   1805 /(?s:.*X|^B)/
   1806     abcde\n1234Xyz
   1807     BarFoo 
   1808     *** Failers 
   1809     abcde\nBar  
   1810 
   1811 /^.*B/
   1812     **** Failers
   1813     abc\nB
   1814      
   1815 /(?s)^.*B/
   1816     abc\nB
   1817 
   1818 /(?m)^.*B/
   1819     abc\nB
   1820      
   1821 /(?ms)^.*B/
   1822     abc\nB
   1823 
   1824 /(?ms)^B/
   1825     abc\nB
   1826 
   1827 /(?s)B$/
   1828     B\n
   1829 
   1830 /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
   1831     123456654321
   1832   
   1833 /^\d\d\d\d\d\d\d\d\d\d\d\d/
   1834     123456654321 
   1835 
   1836 /^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
   1837     123456654321
   1838   
   1839 /^[abc]{12}/
   1840     abcabcabcabc
   1841     
   1842 /^[a-c]{12}/
   1843     abcabcabcabc
   1844     
   1845 /^(a|b|c){12}/
   1846     abcabcabcabc 
   1847 
   1848 /^[abcdefghijklmnopqrstuvwxy0123456789]/
   1849     n
   1850     *** Failers 
   1851     z 
   1852 
   1853 /abcde{0,0}/
   1854     abcd
   1855     *** Failers
   1856     abce  
   1857 
   1858 /ab[cd]{0,0}e/
   1859     abe
   1860     *** Failers
   1861     abcde 
   1862     
   1863 /ab(c){0,0}d/
   1864     abd
   1865     *** Failers
   1866     abcd   
   1867 
   1868 /a(b*)/
   1869     a
   1870     ab
   1871     abbbb
   1872     *** Failers
   1873     bbbbb    
   1874     
   1875 /ab\d{0}e/
   1876     abe
   1877     *** Failers
   1878     ab1e   
   1879     
   1880 /"([^\\"]+|\\.)*"/
   1881     the \"quick\" brown fox
   1882     \"the \\\"quick\\\" brown fox\" 
   1883 
   1884 /.*?/g+
   1885     abc
   1886   
   1887 /\b/g+
   1888     abc 
   1889 
   1890 /\b/+g
   1891     abc 
   1892 
   1893 //g
   1894     abc
   1895 
   1896 /<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
   1897   <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>
   1898 
   1899 /a[^a]b/
   1900     acb
   1901     a\nb
   1902     
   1903 /a.b/
   1904     acb
   1905     *** Failers 
   1906     a\nb   
   1907     
   1908 /a[^a]b/s
   1909     acb
   1910     a\nb  
   1911     
   1912 /a.b/s
   1913     acb
   1914     a\nb  
   1915 
   1916 /^(b+?|a){1,2}?c/
   1917     bac
   1918     bbac
   1919     bbbac
   1920     bbbbac
   1921     bbbbbac 
   1922 
   1923 /^(b+|a){1,2}?c/
   1924     bac
   1925     bbac
   1926     bbbac
   1927     bbbbac
   1928     bbbbbac 
   1929     
   1930 /(?!\A)x/m
   1931     x\nb\n
   1932     a\bx\n  
   1933     
   1934 /\x0{ab}/
   1935     \0{ab} 
   1936 
   1937 /(A|B)*?CD/
   1938     CD 
   1939     
   1940 /(A|B)*CD/
   1941     CD 
   1942 
   1943 /(AB)*?\1/
   1944     ABABAB
   1945 
   1946 /(AB)*\1/
   1947     ABABAB
   1948     
   1949 /(?<!bar)foo/
   1950     foo
   1951     catfood
   1952     arfootle
   1953     rfoosh
   1954     *** Failers
   1955     barfoo
   1956     towbarfoo
   1957 
   1958 /\w{3}(?<!bar)foo/
   1959     catfood
   1960     *** Failers
   1961     foo
   1962     barfoo
   1963     towbarfoo
   1964 
   1965 /(?<=(foo)a)bar/
   1966     fooabar
   1967     *** Failers
   1968     bar
   1969     foobbar
   1970       
   1971 /\Aabc\z/m
   1972     abc
   1973     *** Failers
   1974     abc\n   
   1975     qqq\nabc
   1976     abc\nzzz
   1977     qqq\nabc\nzzz
   1978 
   1979 "(?>.*/)foo"
   1980     /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
   1981 
   1982 "(?>.*/)foo"
   1983     /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
   1984 
   1985 /(?>(\.\d\d[1-9]?))\d+/
   1986     1.230003938
   1987     1.875000282
   1988     *** Failers 
   1989     1.235 
   1990 
   1991 /^((?>\w+)|(?>\s+))*$/
   1992     now is the time for all good men to come to the aid of the party
   1993     *** Failers
   1994     this is not a line with only words and spaces!
   1995     
   1996 /(\d+)(\w)/
   1997     12345a
   1998     12345+ 
   1999 
   2000 /((?>\d+))(\w)/
   2001     12345a
   2002     *** Failers
   2003     12345+ 
   2004 
   2005 /(?>a+)b/
   2006     aaab
   2007 
   2008 /((?>a+)b)/
   2009     aaab
   2010 
   2011 /(?>(a+))b/
   2012     aaab
   2013 
   2014 /(?>b)+/
   2015     aaabbbccc
   2016 
   2017 /(?>a+|b+|c+)*c/
   2018     aaabbbbccccd
   2019 
   2020 /((?>[^()]+)|\([^()]*\))+/
   2021     ((abc(ade)ufh()()x
   2022     
   2023 /\(((?>[^()]+)|\([^()]+\))+\)/ 
   2024     (abc)
   2025     (abc(def)xyz)
   2026     *** Failers
   2027     ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa   
   2028 
   2029 /a(?-i)b/i
   2030     ab
   2031     Ab
   2032     *** Failers 
   2033     aB
   2034     AB
   2035         
   2036 /(a (?x)b c)d e/
   2037     a bcd e
   2038     *** Failers
   2039     a b cd e
   2040     abcd e   
   2041     a bcde 
   2042  
   2043 /(a b(?x)c d (?-x)e f)/
   2044     a bcde f
   2045     *** Failers
   2046     abcdef  
   2047 
   2048 /(a(?i)b)c/
   2049     abc
   2050     aBc
   2051     *** Failers
   2052     abC
   2053     aBC  
   2054     Abc
   2055     ABc
   2056     ABC
   2057     AbC
   2058     
   2059 /a(?i:b)c/
   2060     abc
   2061     aBc
   2062     *** Failers 
   2063     ABC
   2064     abC
   2065     aBC
   2066     
   2067 /a(?i:b)*c/
   2068     aBc
   2069     aBBc
   2070     *** Failers 
   2071     aBC
   2072     aBBC
   2073     
   2074 /a(?=b(?i)c)\w\wd/
   2075     abcd
   2076     abCd
   2077     *** Failers
   2078     aBCd
   2079     abcD     
   2080     
   2081 /(?s-i:more.*than).*million/i
   2082     more than million
   2083     more than MILLION
   2084     more \n than Million 
   2085     *** Failers
   2086     MORE THAN MILLION    
   2087     more \n than \n million 
   2088 
   2089 /(?:(?s-i)more.*than).*million/i
   2090     more than million
   2091     more than MILLION
   2092     more \n than Million 
   2093     *** Failers
   2094     MORE THAN MILLION    
   2095     more \n than \n million 
   2096     
   2097 /(?>a(?i)b+)+c/ 
   2098     abc
   2099     aBbc
   2100     aBBc 
   2101     *** Failers
   2102     Abc
   2103     abAb    
   2104     abbC 
   2105     
   2106 /(?=a(?i)b)\w\wc/
   2107     abc
   2108     aBc
   2109     *** Failers
   2110     Ab 
   2111     abC
   2112     aBC     
   2113     
   2114 /(?<=a(?i)b)(\w\w)c/
   2115     abxxc
   2116     aBxxc
   2117     *** Failers
   2118     Abxxc
   2119     ABxxc
   2120     abxxC      
   2121 
   2122 /(?:(a)|b)(?(1)A|B)/
   2123     aA
   2124     bB
   2125     *** Failers
   2126     aB
   2127     bA    
   2128 
   2129 /^(a)?(?(1)a|b)+$/
   2130     aa
   2131     b
   2132     bb  
   2133     *** Failers
   2134     ab   
   2135 
   2136 /^(?(?=abc)\w{3}:|\d\d)$/
   2137     abc:
   2138     12
   2139     *** Failers
   2140     123
   2141     xyz    
   2142 
   2143 /^(?(?!abc)\d\d|\w{3}:)$/
   2144     abc:
   2145     12
   2146     *** Failers
   2147     123
   2148     xyz    
   2149     
   2150 /(?(?<=foo)bar|cat)/
   2151     foobar
   2152     cat
   2153     fcat
   2154     focat   
   2155     *** Failers
   2156     foocat  
   2157 
   2158 /(?(?<!foo)cat|bar)/
   2159     foobar
   2160     cat
   2161     fcat
   2162     focat   
   2163     *** Failers
   2164     foocat  
   2165 
   2166 /( \( )? [^()]+ (?(1) \) |) /x
   2167     abcd
   2168     (abcd)
   2169     the quick (abcd) fox
   2170     (abcd   
   2171 
   2172 /( \( )? [^()]+ (?(1) \) ) /x
   2173     abcd
   2174     (abcd)
   2175     the quick (abcd) fox
   2176     (abcd   
   2177 
   2178 /^(?(2)a|(1)(2))+$/
   2179     12
   2180     12a
   2181     12aa
   2182     *** Failers
   2183     1234    
   2184 
   2185 /((?i)blah)\s+\1/
   2186     blah blah
   2187     BLAH BLAH
   2188     Blah Blah
   2189     blaH blaH
   2190     *** Failers
   2191     blah BLAH
   2192     Blah blah      
   2193     blaH blah 
   2194 
   2195 /((?i)blah)\s+(?i:\1)/
   2196     blah blah
   2197     BLAH BLAH
   2198     Blah Blah
   2199     blaH blaH
   2200     blah BLAH
   2201     Blah blah      
   2202     blaH blah 
   2203 
   2204 /(?>a*)*/
   2205     a
   2206     aa
   2207     aaaa
   2208     
   2209 /(abc|)+/
   2210     abc
   2211     abcabc
   2212     abcabcabc
   2213     xyz      
   2214 
   2215 /([a]*)*/
   2216     a
   2217     aaaaa 
   2218  
   2219 /([ab]*)*/
   2220     a
   2221     b
   2222     ababab
   2223     aaaabcde
   2224     bbbb    
   2225  
   2226 /([^a]*)*/
   2227     b
   2228     bbbb
   2229     aaa   
   2230  
   2231 /([^ab]*)*/
   2232     cccc
   2233     abab  
   2234  
   2235 /([a]*?)*/
   2236     a
   2237     aaaa 
   2238  
   2239 /([ab]*?)*/
   2240     a
   2241     b
   2242     abab
   2243     baba   
   2244  
   2245 /([^a]*?)*/
   2246     b
   2247     bbbb
   2248     aaa   
   2249  
   2250 /([^ab]*?)*/
   2251     c
   2252     cccc
   2253     baba   
   2254  
   2255 /(?>a*)*/
   2256     a
   2257     aaabcde 
   2258  
   2259 /((?>a*))*/
   2260     aaaaa
   2261     aabbaa 
   2262  
   2263 /((?>a*?))*/
   2264     aaaaa
   2265     aabbaa 
   2266 
   2267 /(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
   2268     12-sep-98
   2269     12-09-98
   2270     *** Failers
   2271     sep-12-98
   2272         
   2273 /(?<=(foo))bar\1/
   2274     foobarfoo
   2275     foobarfootling 
   2276     *** Failers
   2277     foobar
   2278     barfoo   
   2279 
   2280 /(?i:saturday|sunday)/
   2281     saturday
   2282     sunday
   2283     Saturday
   2284     Sunday
   2285     SATURDAY
   2286     SUNDAY
   2287     SunDay
   2288     
   2289 /(a(?i)bc|BB)x/
   2290     abcx
   2291     aBCx
   2292     bbx
   2293     BBx
   2294     *** Failers
   2295     abcX
   2296     aBCX
   2297     bbX
   2298     BBX               
   2299 
   2300 /^([ab](?i)[cd]|[ef])/
   2301     ac
   2302     aC
   2303     bD
   2304     elephant
   2305     Europe 
   2306     frog
   2307     France
   2308     *** Failers
   2309     Africa     
   2310 
   2311 /^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
   2312     ab
   2313     aBd
   2314     xy
   2315     xY
   2316     zebra
   2317     Zambesi
   2318     *** Failers
   2319     aCD  
   2320     XY  
   2321 
   2322 /(?<=foo\n)^bar/m
   2323     foo\nbar
   2324     *** Failers
   2325     bar
   2326     baz\nbar   
   2327 
   2328 /(?<=(?<!foo)bar)baz/
   2329     barbaz
   2330     barbarbaz 
   2331     koobarbaz 
   2332     *** Failers
   2333     baz
   2334     foobarbaz 
   2335 
   2336 /The cases of aaaa and aaaaaa are missed out below because Perl does things/
   2337 /differently. We know that odd, and maybe incorrect, things happen with/
   2338 /recursive references in Perl, as far as 5.11.3 - see some stuff in test #2./
   2339 
   2340 /^(a\1?){4}$/
   2341     a
   2342     aa
   2343     aaa
   2344     aaaaa
   2345     aaaaaaa
   2346     aaaaaaaa
   2347     aaaaaaaaa
   2348     aaaaaaaaaa
   2349     aaaaaaaaaaa
   2350     aaaaaaaaaaaa
   2351     aaaaaaaaaaaaa
   2352     aaaaaaaaaaaaaa
   2353     aaaaaaaaaaaaaaa
   2354     aaaaaaaaaaaaaaaa               
   2355 
   2356 /^(a\1?)(a\1?)(a\2?)(a\3?)$/
   2357     a
   2358     aa
   2359     aaa
   2360     aaaa
   2361     aaaaa
   2362     aaaaaa
   2363     aaaaaaa
   2364     aaaaaaaa
   2365     aaaaaaaaa
   2366     aaaaaaaaaa
   2367     aaaaaaaaaaa
   2368     aaaaaaaaaaaa
   2369     aaaaaaaaaaaaa
   2370     aaaaaaaaaaaaaa
   2371     aaaaaaaaaaaaaaa
   2372     aaaaaaaaaaaaaaaa               
   2373 
   2374 /The following tests are taken from the Perl 5.005 test suite; some of them/
   2375 /are compatible with 5.004, but I'd rather not have to sort them out./
   2376 
   2377 /abc/
   2378     abc
   2379     xabcy
   2380     ababc
   2381     *** Failers
   2382     xbc
   2383     axc
   2384     abx
   2385 
   2386 /ab*c/
   2387     abc
   2388 
   2389 /ab*bc/
   2390     abc
   2391     abbc
   2392     abbbbc
   2393 
   2394 /.{1}/
   2395     abbbbc
   2396 
   2397 /.{3,4}/
   2398     abbbbc
   2399 
   2400 /ab{0,}bc/
   2401     abbbbc
   2402 
   2403 /ab+bc/
   2404     abbc
   2405     *** Failers
   2406     abc
   2407     abq
   2408 
   2409 /ab{1,}bc/
   2410 
   2411 /ab+bc/
   2412     abbbbc
   2413 
   2414 /ab{1,}bc/
   2415     abbbbc
   2416 
   2417 /ab{1,3}bc/
   2418     abbbbc
   2419 
   2420 /ab{3,4}bc/
   2421     abbbbc
   2422 
   2423 /ab{4,5}bc/
   2424     *** Failers
   2425     abq
   2426     abbbbc
   2427 
   2428 /ab?bc/
   2429     abbc
   2430     abc
   2431 
   2432 /ab{0,1}bc/
   2433     abc
   2434 
   2435 /ab?bc/
   2436 
   2437 /ab?c/
   2438     abc
   2439 
   2440 /ab{0,1}c/
   2441     abc
   2442 
   2443 /^abc$/
   2444     abc
   2445     *** Failers
   2446     abbbbc
   2447     abcc
   2448 
   2449 /^abc/
   2450     abcc
   2451 
   2452 /^abc$/
   2453 
   2454 /abc$/
   2455     aabc
   2456     *** Failers
   2457     aabc
   2458     aabcd
   2459 
   2460 /^/
   2461     abc
   2462 
   2463 /$/
   2464     abc
   2465 
   2466 /a.c/
   2467     abc
   2468     axc
   2469 
   2470 /a.*c/
   2471     axyzc
   2472 
   2473 /a[bc]d/
   2474     abd
   2475     *** Failers
   2476     axyzd
   2477     abc
   2478 
   2479 /a[b-d]e/
   2480     ace
   2481 
   2482 /a[b-d]/
   2483     aac
   2484 
   2485 /a[-b]/
   2486     a-
   2487 
   2488 /a[b-]/
   2489     a-
   2490 
   2491 /a]/
   2492     a]
   2493 
   2494 /a[]]b/
   2495     a]b
   2496 
   2497 /a[^bc]d/
   2498     aed
   2499     *** Failers
   2500     abd
   2501     abd
   2502 
   2503 /a[^-b]c/
   2504     adc
   2505 
   2506 /a[^]b]c/
   2507     adc
   2508     *** Failers
   2509     a-c
   2510     a]c
   2511 
   2512 /\ba\b/
   2513     a-
   2514     -a
   2515     -a-
   2516 
   2517 /\by\b/
   2518     *** Failers
   2519     xy
   2520     yz
   2521     xyz
   2522 
   2523 /\Ba\B/
   2524     *** Failers
   2525     a-
   2526     -a
   2527     -a-
   2528 
   2529 /\By\b/
   2530     xy
   2531 
   2532 /\by\B/
   2533     yz
   2534 
   2535 /\By\B/
   2536     xyz
   2537 
   2538 /\w/
   2539     a
   2540 
   2541 /\W/
   2542     -
   2543     *** Failers
   2544     -
   2545     a
   2546 
   2547 /a\sb/
   2548     a b
   2549 
   2550 /a\Sb/
   2551     a-b
   2552     *** Failers
   2553     a-b
   2554     a b
   2555 
   2556 /\d/
   2557     1
   2558 
   2559 /\D/
   2560     -
   2561     *** Failers
   2562     -
   2563     1
   2564 
   2565 /[\w]/
   2566     a
   2567 
   2568 /[\W]/
   2569     -
   2570     *** Failers
   2571     -
   2572     a
   2573 
   2574 /a[\s]b/
   2575     a b
   2576 
   2577 /a[\S]b/
   2578     a-b
   2579     *** Failers
   2580     a-b
   2581     a b
   2582 
   2583 /[\d]/
   2584     1
   2585 
   2586 /[\D]/
   2587     -
   2588     *** Failers
   2589     -
   2590     1
   2591 
   2592 /ab|cd/
   2593     abc
   2594     abcd
   2595 
   2596 /()ef/
   2597     def
   2598 
   2599 /$b/
   2600 
   2601 /a\(b/
   2602     a(b
   2603 
   2604 /a\(*b/
   2605     ab
   2606     a((b
   2607 
   2608 /a\\b/
   2609     a\b
   2610 
   2611 /((a))/
   2612     abc
   2613 
   2614 /(a)b(c)/
   2615     abc
   2616 
   2617 /a+b+c/
   2618     aabbabc
   2619 
   2620 /a{1,}b{1,}c/
   2621     aabbabc
   2622 
   2623 /a.+?c/
   2624     abcabc
   2625 
   2626 /(a+|b)*/
   2627     ab
   2628 
   2629 /(a+|b){0,}/
   2630     ab
   2631 
   2632 /(a+|b)+/
   2633     ab
   2634 
   2635 /(a+|b){1,}/
   2636     ab
   2637 
   2638 /(a+|b)?/
   2639     ab
   2640 
   2641 /(a+|b){0,1}/
   2642     ab
   2643 
   2644 /[^ab]*/
   2645     cde
   2646 
   2647 /abc/
   2648     *** Failers
   2649     b
   2650     
   2651 
   2652 /a*/
   2653     
   2654 
   2655 /([abc])*d/
   2656     abbbcd
   2657 
   2658 /([abc])*bcd/
   2659     abcd
   2660 
   2661 /a|b|c|d|e/
   2662     e
   2663 
   2664 /(a|b|c|d|e)f/
   2665     ef
   2666 
   2667 /abcd*efg/
   2668     abcdefg
   2669 
   2670 /ab*/
   2671     xabyabbbz
   2672     xayabbbz
   2673 
   2674 /(ab|cd)e/
   2675     abcde
   2676 
   2677 /[abhgefdc]ij/
   2678     hij
   2679 
   2680 /^(ab|cd)e/
   2681 
   2682 /(abc|)ef/
   2683     abcdef
   2684 
   2685 /(a|b)c*d/
   2686     abcd
   2687 
   2688 /(ab|ab*)bc/
   2689     abc
   2690 
   2691 /a([bc]*)c*/
   2692     abc
   2693 
   2694 /a([bc]*)(c*d)/
   2695     abcd
   2696 
   2697 /a([bc]+)(c*d)/
   2698     abcd
   2699 
   2700 /a([bc]*)(c+d)/
   2701     abcd
   2702 
   2703 /a[bcd]*dcdcde/
   2704     adcdcde
   2705 
   2706 /a[bcd]+dcdcde/
   2707     *** Failers
   2708     abcde
   2709     adcdcde
   2710 
   2711 /(ab|a)b*c/
   2712     abc
   2713 
   2714 /((a)(b)c)(d)/
   2715     abcd
   2716 
   2717 /[a-zA-Z_][a-zA-Z0-9_]*/
   2718     alpha
   2719 
   2720 /^a(bc+|b[eh])g|.h$/
   2721     abh
   2722 
   2723 /(bc+d$|ef*g.|h?i(j|k))/
   2724     effgz
   2725     ij
   2726     reffgz
   2727     *** Failers
   2728     effg
   2729     bcdd
   2730 
   2731 /((((((((((a))))))))))/
   2732     a
   2733 
   2734 /((((((((((a))))))))))\10/
   2735     aa
   2736 
   2737 /(((((((((a)))))))))/
   2738     a
   2739 
   2740 /multiple words of text/
   2741     *** Failers
   2742     aa
   2743     uh-uh
   2744 
   2745 /multiple words/
   2746     multiple words, yeah
   2747 
   2748 /(.*)c(.*)/
   2749     abcde
   2750 
   2751 /\((.*), (.*)\)/
   2752     (a, b)
   2753 
   2754 /[k]/
   2755 
   2756 /abcd/
   2757     abcd
   2758 
   2759 /a(bc)d/
   2760     abcd
   2761 
   2762 /a[-]?c/
   2763     ac
   2764 
   2765 /(abc)\1/
   2766     abcabc
   2767 
   2768 /([a-c]*)\1/
   2769     abcabc
   2770 
   2771 /(a)|\1/
   2772     a
   2773     *** Failers
   2774     ab
   2775     x
   2776 
   2777 /(([a-c])b*?\2)*/
   2778     ababbbcbc
   2779 
   2780 /(([a-c])b*?\2){3}/
   2781     ababbbcbc
   2782 
   2783 /((\3|b)\2(a)x)+/
   2784     aaaxabaxbaaxbbax
   2785 
   2786 /((\3|b)\2(a)){2,}/
   2787     bbaababbabaaaaabbaaaabba
   2788 
   2789 /abc/i
   2790     ABC
   2791     XABCY
   2792     ABABC
   2793     *** Failers
   2794     aaxabxbaxbbx
   2795     XBC
   2796     AXC
   2797     ABX
   2798 
   2799 /ab*c/i
   2800     ABC
   2801 
   2802 /ab*bc/i
   2803     ABC
   2804     ABBC
   2805 
   2806 /ab*?bc/i
   2807     ABBBBC
   2808 
   2809 /ab{0,}?bc/i
   2810     ABBBBC
   2811 
   2812 /ab+?bc/i
   2813     ABBC
   2814 
   2815 /ab+bc/i
   2816     *** Failers
   2817     ABC
   2818     ABQ
   2819 
   2820 /ab{1,}bc/i
   2821 
   2822 /ab+bc/i
   2823     ABBBBC
   2824 
   2825 /ab{1,}?bc/i
   2826     ABBBBC
   2827 
   2828 /ab{1,3}?bc/i
   2829     ABBBBC
   2830 
   2831 /ab{3,4}?bc/i
   2832     ABBBBC
   2833 
   2834 /ab{4,5}?bc/i
   2835     *** Failers
   2836     ABQ
   2837     ABBBBC
   2838 
   2839 /ab??bc/i
   2840     ABBC
   2841     ABC
   2842 
   2843 /ab{0,1}?bc/i
   2844     ABC
   2845 
   2846 /ab??bc/i
   2847 
   2848 /ab??c/i
   2849     ABC
   2850 
   2851 /ab{0,1}?c/i
   2852     ABC
   2853 
   2854 /^abc$/i
   2855     ABC
   2856     *** Failers
   2857     ABBBBC
   2858     ABCC
   2859 
   2860 /^abc/i
   2861     ABCC
   2862 
   2863 /^abc$/i
   2864 
   2865 /abc$/i
   2866     AABC
   2867 
   2868 /^/i
   2869     ABC
   2870 
   2871 /$/i
   2872     ABC
   2873 
   2874 /a.c/i
   2875     ABC
   2876     AXC
   2877 
   2878 /a.*?c/i
   2879     AXYZC
   2880 
   2881 /a.*c/i
   2882     *** Failers
   2883     AABC
   2884     AXYZD
   2885 
   2886 /a[bc]d/i
   2887     ABD
   2888 
   2889 /a[b-d]e/i
   2890     ACE
   2891     *** Failers
   2892     ABC
   2893     ABD
   2894 
   2895 /a[b-d]/i
   2896     AAC
   2897 
   2898 /a[-b]/i
   2899     A-
   2900 
   2901 /a[b-]/i
   2902     A-
   2903 
   2904 /a]/i
   2905     A]
   2906 
   2907 /a[]]b/i
   2908     A]B
   2909 
   2910 /a[^bc]d/i
   2911     AED
   2912 
   2913 /a[^-b]c/i
   2914     ADC
   2915     *** Failers
   2916     ABD
   2917     A-C
   2918 
   2919 /a[^]b]c/i
   2920     ADC
   2921 
   2922 /ab|cd/i
   2923     ABC
   2924     ABCD
   2925 
   2926 /()ef/i
   2927     DEF
   2928 
   2929 /$b/i
   2930     *** Failers
   2931     A]C
   2932     B
   2933 
   2934 /a\(b/i
   2935     A(B
   2936 
   2937 /a\(*b/i
   2938     AB
   2939     A((B
   2940 
   2941 /a\\b/i
   2942     A\B
   2943 
   2944 /((a))/i
   2945     ABC
   2946 
   2947 /(a)b(c)/i
   2948     ABC
   2949 
   2950 /a+b+c/i
   2951     AABBABC
   2952 
   2953 /a{1,}b{1,}c/i
   2954     AABBABC
   2955 
   2956 /a.+?c/i
   2957     ABCABC
   2958 
   2959 /a.*?c/i
   2960     ABCABC
   2961 
   2962 /a.{0,5}?c/i
   2963     ABCABC
   2964 
   2965 /(a+|b)*/i
   2966     AB
   2967 
   2968 /(a+|b){0,}/i
   2969     AB
   2970 
   2971 /(a+|b)+/i
   2972     AB
   2973 
   2974 /(a+|b){1,}/i
   2975     AB
   2976 
   2977 /(a+|b)?/i
   2978     AB
   2979 
   2980 /(a+|b){0,1}/i
   2981     AB
   2982 
   2983 /(a+|b){0,1}?/i
   2984     AB
   2985 
   2986 /[^ab]*/i
   2987     CDE
   2988 
   2989 /abc/i
   2990 
   2991 /a*/i
   2992     
   2993 
   2994 /([abc])*d/i
   2995     ABBBCD
   2996 
   2997 /([abc])*bcd/i
   2998     ABCD
   2999 
   3000 /a|b|c|d|e/i
   3001     E
   3002 
   3003 /(a|b|c|d|e)f/i
   3004     EF
   3005 
   3006 /abcd*efg/i
   3007     ABCDEFG
   3008 
   3009 /ab*/i
   3010     XABYABBBZ
   3011     XAYABBBZ
   3012 
   3013 /(ab|cd)e/i
   3014     ABCDE
   3015 
   3016 /[abhgefdc]ij/i
   3017     HIJ
   3018 
   3019 /^(ab|cd)e/i
   3020     ABCDE
   3021 
   3022 /(abc|)ef/i
   3023     ABCDEF
   3024 
   3025 /(a|b)c*d/i
   3026     ABCD
   3027 
   3028 /(ab|ab*)bc/i
   3029     ABC
   3030 
   3031 /a([bc]*)c*/i
   3032     ABC
   3033 
   3034 /a([bc]*)(c*d)/i
   3035     ABCD
   3036 
   3037 /a([bc]+)(c*d)/i
   3038     ABCD
   3039 
   3040 /a([bc]*)(c+d)/i
   3041     ABCD
   3042 
   3043 /a[bcd]*dcdcde/i
   3044     ADCDCDE
   3045 
   3046 /a[bcd]+dcdcde/i
   3047 
   3048 /(ab|a)b*c/i
   3049     ABC
   3050 
   3051 /((a)(b)c)(d)/i
   3052     ABCD
   3053 
   3054 /[a-zA-Z_][a-zA-Z0-9_]*/i
   3055     ALPHA
   3056 
   3057 /^a(bc+|b[eh])g|.h$/i
   3058     ABH
   3059 
   3060 /(bc+d$|ef*g.|h?i(j|k))/i
   3061     EFFGZ
   3062     IJ
   3063     REFFGZ
   3064     *** Failers
   3065     ADCDCDE
   3066     EFFG
   3067     BCDD
   3068 
   3069 /((((((((((a))))))))))/i
   3070     A
   3071 
   3072 /((((((((((a))))))))))\10/i
   3073     AA
   3074 
   3075 /(((((((((a)))))))))/i
   3076     A
   3077 
   3078 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
   3079     A
   3080 
   3081 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
   3082     C
   3083 
   3084 /multiple words of text/i
   3085     *** Failers
   3086     AA
   3087     UH-UH
   3088 
   3089 /multiple words/i
   3090     MULTIPLE WORDS, YEAH
   3091 
   3092 /(.*)c(.*)/i
   3093     ABCDE
   3094 
   3095 /\((.*), (.*)\)/i
   3096     (A, B)
   3097 
   3098 /[k]/i
   3099 
   3100 /abcd/i
   3101     ABCD
   3102 
   3103 /a(bc)d/i
   3104     ABCD
   3105 
   3106 /a[-]?c/i
   3107     AC
   3108 
   3109 /(abc)\1/i
   3110     ABCABC
   3111 
   3112 /([a-c]*)\1/i
   3113     ABCABC
   3114 
   3115 /a(?!b)./
   3116     abad
   3117 
   3118 /a(?=d)./
   3119     abad
   3120 
   3121 /a(?=c|d)./
   3122     abad
   3123 
   3124 /a(?:b|c|d)(.)/
   3125     ace
   3126 
   3127 /a(?:b|c|d)*(.)/
   3128     ace
   3129 
   3130 /a(?:b|c|d)+?(.)/
   3131     ace
   3132     acdbcdbe
   3133 
   3134 /a(?:b|c|d)+(.)/
   3135     acdbcdbe
   3136 
   3137 /a(?:b|c|d){2}(.)/
   3138     acdbcdbe
   3139 
   3140 /a(?:b|c|d){4,5}(.)/
   3141     acdbcdbe
   3142 
   3143 /a(?:b|c|d){4,5}?(.)/
   3144     acdbcdbe
   3145 
   3146 /((foo)|(bar))*/
   3147     foobar
   3148 
   3149 /a(?:b|c|d){6,7}(.)/
   3150     acdbcdbe
   3151 
   3152 /a(?:b|c|d){6,7}?(.)/
   3153     acdbcdbe
   3154 
   3155 /a(?:b|c|d){5,6}(.)/
   3156     acdbcdbe
   3157 
   3158 /a(?:b|c|d){5,6}?(.)/
   3159     acdbcdbe
   3160 
   3161 /a(?:b|c|d){5,7}(.)/
   3162     acdbcdbe
   3163 
   3164 /a(?:b|c|d){5,7}?(.)/
   3165     acdbcdbe
   3166 
   3167 /a(?:b|(c|e){1,2}?|d)+?(.)/
   3168     ace
   3169 
   3170 /^(.+)?B/
   3171     AB
   3172 
   3173 /^([^a-z])|(\^)$/
   3174     .
   3175 
   3176 /^[<>]&/
   3177     <&OUT
   3178 
   3179 /^(a\1?){4}$/
   3180     aaaaaaaaaa
   3181     *** Failers
   3182     AB
   3183     aaaaaaaaa
   3184     aaaaaaaaaaa
   3185 
   3186 /^(a(?(1)\1)){4}$/
   3187     aaaaaaaaaa
   3188     *** Failers
   3189     aaaaaaaaa
   3190     aaaaaaaaaaa
   3191 
   3192 /(?:(f)(o)(o)|(b)(a)(r))*/
   3193     foobar
   3194 
   3195 /(?<=a)b/
   3196     ab
   3197     *** Failers
   3198     cb
   3199     b
   3200 
   3201 /(?<!c)b/
   3202     ab
   3203     b
   3204     b
   3205 
   3206 /(?:..)*a/
   3207     aba
   3208 
   3209 /(?:..)*?a/
   3210     aba
   3211 
   3212 /^(?:b|a(?=(.)))*\1/
   3213     abc
   3214 
   3215 /^(){3,5}/
   3216     abc
   3217 
   3218 /^(a+)*ax/
   3219     aax
   3220 
   3221 /^((a|b)+)*ax/
   3222     aax
   3223 
   3224 /^((a|bc)+)*ax/
   3225     aax
   3226 
   3227 /(a|x)*ab/
   3228     cab
   3229 
   3230 /(a)*ab/
   3231     cab
   3232 
   3233 /(?:(?i)a)b/
   3234     ab
   3235 
   3236 /((?i)a)b/
   3237     ab
   3238 
   3239 /(?:(?i)a)b/
   3240     Ab
   3241 
   3242 /((?i)a)b/
   3243     Ab
   3244 
   3245 /(?:(?i)a)b/
   3246     *** Failers
   3247     cb
   3248     aB
   3249 
   3250 /((?i)a)b/
   3251 
   3252 /(?i:a)b/
   3253     ab
   3254 
   3255 /((?i:a))b/
   3256     ab
   3257 
   3258 /(?i:a)b/
   3259     Ab
   3260 
   3261 /((?i:a))b/
   3262     Ab
   3263 
   3264 /(?i:a)b/
   3265     *** Failers
   3266     aB
   3267     aB
   3268 
   3269 /((?i:a))b/
   3270 
   3271 /(?:(?-i)a)b/i
   3272     ab
   3273 
   3274 /((?-i)a)b/i
   3275     ab
   3276 
   3277 /(?:(?-i)a)b/i
   3278     aB
   3279 
   3280 /((?-i)a)b/i
   3281     aB
   3282 
   3283 /(?:(?-i)a)b/i
   3284     *** Failers
   3285     aB
   3286     Ab
   3287 
   3288 /((?-i)a)b/i
   3289 
   3290 /(?:(?-i)a)b/i
   3291     aB
   3292 
   3293 /((?-i)a)b/i
   3294     aB
   3295 
   3296 /(?:(?-i)a)b/i
   3297     *** Failers
   3298     Ab
   3299     AB
   3300 
   3301 /((?-i)a)b/i
   3302 
   3303 /(?-i:a)b/i
   3304     ab
   3305 
   3306 /((?-i:a))b/i
   3307     ab
   3308 
   3309 /(?-i:a)b/i
   3310     aB
   3311 
   3312 /((?-i:a))b/i
   3313     aB
   3314 
   3315 /(?-i:a)b/i
   3316     *** Failers
   3317     AB
   3318     Ab
   3319 
   3320 /((?-i:a))b/i
   3321 
   3322 /(?-i:a)b/i
   3323     aB
   3324 
   3325 /((?-i:a))b/i
   3326     aB
   3327 
   3328 /(?-i:a)b/i
   3329     *** Failers
   3330     Ab
   3331     AB
   3332 
   3333 /((?-i:a))b/i
   3334 
   3335 /((?-i:a.))b/i
   3336     *** Failers
   3337     AB
   3338     a\nB
   3339 
   3340 /((?s-i:a.))b/i
   3341     a\nB
   3342 
   3343 /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
   3344     cabbbb
   3345 
   3346 /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
   3347     caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
   3348 
   3349 /(ab)\d\1/i
   3350     Ab4ab
   3351     ab4Ab
   3352 
   3353 /foo\w*\d{4}baz/
   3354     foobar1234baz
   3355 
   3356 /x(~~)*(?:(?:F)?)?/
   3357     x~~
   3358 
   3359 /^a(?#xxx){3}c/
   3360     aaac
   3361 
   3362 /^a (?#xxx) (?#yyy) {3}c/x
   3363     aaac
   3364 
   3365 /(?<![cd])b/
   3366     *** Failers
   3367     B\nB
   3368     dbcb
   3369 
   3370 /(?<![cd])[ab]/
   3371     dbaacb
   3372 
   3373 /(?<!(c|d))b/
   3374 
   3375 /(?<!(c|d))[ab]/
   3376     dbaacb
   3377 
   3378 /(?<!cd)[ab]/
   3379     cdaccb
   3380 
   3381 /^(?:a?b?)*$/
   3382     \
   3383     a
   3384     ab
   3385     aaa   
   3386     *** Failers
   3387     dbcb
   3388     a--
   3389     aa-- 
   3390 
   3391 /((?s)^a(.))((?m)^b$)/
   3392     a\nb\nc\n
   3393 
   3394 /((?m)^b$)/
   3395     a\nb\nc\n
   3396 
   3397 /(?m)^b/
   3398     a\nb\n
   3399 
   3400 /(?m)^(b)/
   3401     a\nb\n
   3402 
   3403 /((?m)^b)/
   3404     a\nb\n
   3405 
   3406 /\n((?m)^b)/
   3407     a\nb\n
   3408 
   3409 /((?s).)c(?!.)/
   3410     a\nb\nc\n
   3411     a\nb\nc\n
   3412 
   3413 /((?s)b.)c(?!.)/
   3414     a\nb\nc\n
   3415     a\nb\nc\n
   3416 
   3417 /^b/
   3418 
   3419 /()^b/
   3420     *** Failers
   3421     a\nb\nc\n
   3422     a\nb\nc\n
   3423 
   3424 /((?m)^b)/
   3425     a\nb\nc\n
   3426 
   3427 /(x)?(?(1)a|b)/
   3428     *** Failers
   3429     a
   3430     a
   3431 
   3432 /(x)?(?(1)b|a)/
   3433     a
   3434 
   3435 /()?(?(1)b|a)/
   3436     a
   3437 
   3438 /()(?(1)b|a)/
   3439 
   3440 /()?(?(1)a|b)/
   3441     a
   3442 
   3443 /^(\()?blah(?(1)(\)))$/
   3444     (blah)
   3445     blah
   3446     *** Failers
   3447     a
   3448     blah)
   3449     (blah
   3450 
   3451 /^(\(+)?blah(?(1)(\)))$/
   3452     (blah)
   3453     blah
   3454     *** Failers
   3455     blah)
   3456     (blah
   3457 
   3458 /(?(?!a)a|b)/
   3459 
   3460 /(?(?!a)b|a)/
   3461     a
   3462 
   3463 /(?(?=a)b|a)/
   3464     *** Failers
   3465     a
   3466     a
   3467 
   3468 /(?(?=a)a|b)/
   3469     a
   3470 
   3471 /(?=(a+?))(\1ab)/
   3472     aaab
   3473 
   3474 /^(?=(a+?))\1ab/
   3475 
   3476 /(\w+:)+/
   3477     one:
   3478 
   3479 /$(?<=^(a))/
   3480     a
   3481 
   3482 /(?=(a+?))(\1ab)/
   3483     aaab
   3484 
   3485 /^(?=(a+?))\1ab/
   3486     *** Failers
   3487     aaab
   3488     aaab
   3489 
   3490 /([\w:]+::)?(\w+)$/
   3491     abcd
   3492     xy:z:::abcd
   3493 
   3494 /^[^bcd]*(c+)/
   3495     aexycd
   3496 
   3497 /(a*)b+/
   3498     caab
   3499 
   3500 /([\w:]+::)?(\w+)$/
   3501     abcd
   3502     xy:z:::abcd
   3503     *** Failers
   3504     abcd:
   3505     abcd:
   3506 
   3507 /^[^bcd]*(c+)/
   3508     aexycd
   3509 
   3510 /(>a+)ab/
   3511 
   3512 /(?>a+)b/
   3513     aaab
   3514 
   3515 /([[:]+)/
   3516     a:[b]:
   3517 
   3518 /([[=]+)/
   3519     a=[b]=
   3520 
   3521 /([[.]+)/
   3522     a.[b].
   3523 
   3524 /((?>a+)b)/
   3525     aaab
   3526 
   3527 /(?>(a+))b/
   3528     aaab
   3529 
   3530 /((?>[^()]+)|\([^()]*\))+/
   3531     ((abc(ade)ufh()()x
   3532 
   3533 /a\Z/
   3534     *** Failers
   3535     aaab
   3536     a\nb\n
   3537 
   3538 /b\Z/
   3539     a\nb\n
   3540 
   3541 /b\z/
   3542 
   3543 /b\Z/
   3544     a\nb
   3545 
   3546 /b\z/
   3547     a\nb
   3548     *** Failers
   3549     
   3550 /^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
   3551     a
   3552     abc
   3553     a-b
   3554     0-9 
   3555     a.b
   3556     5.6.7  
   3557     the.quick.brown.fox
   3558     a100.b200.300c  
   3559     12-ab.1245 
   3560     *** Failers
   3561     \
   3562     .a
   3563     -a
   3564     a-
   3565     a.  
   3566     a_b 
   3567     a.-
   3568     a..  
   3569     ab..bc 
   3570     the.quick.brown.fox-
   3571     the.quick.brown.fox.
   3572     the.quick.brown.fox_
   3573     the.quick.brown.fox+       
   3574 
   3575 /(?>.*)(?<=(abcd|wxyz))/
   3576     alphabetabcd
   3577     endingwxyz
   3578     *** Failers
   3579     a rather long string that doesn't end with one of them
   3580 
   3581 /word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
   3582     word cat dog elephant mussel cow horse canary baboon snake shark otherword
   3583     word cat dog elephant mussel cow horse canary baboon snake shark
   3584   
   3585 /word (?>[a-zA-Z0-9]+ ){0,30}otherword/
   3586     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
   3587 
   3588 /(?<=\d{3}(?!999))foo/
   3589     999foo
   3590     123999foo 
   3591     *** Failers
   3592     123abcfoo
   3593     
   3594 /(?<=(?!...999)\d{3})foo/
   3595     999foo
   3596     123999foo 
   3597     *** Failers
   3598     123abcfoo
   3599 
   3600 /(?<=\d{3}(?!999)...)foo/
   3601     123abcfoo
   3602     123456foo 
   3603     *** Failers
   3604     123999foo  
   3605     
   3606 /(?<=\d{3}...)(?<!999)foo/
   3607     123abcfoo   
   3608     123456foo 
   3609     *** Failers
   3610     123999foo  
   3611 
   3612 /<a[\s]+href[\s]*=[\s]*          # find <a href=
   3613  ([\"\'])?                       # find single or double quote
   3614  (?(1) (.*?)\1 | ([^\s]+))       # if quote found, match up to next matching
   3615                                  # quote, otherwise match up to next space
   3616 /isx
   3617     <a href=abcd xyz
   3618     <a href=\"abcd xyz pqr\" cats
   3619     <a href=\'abcd xyz pqr\' cats
   3620 
   3621 /<a\s+href\s*=\s*                # find <a href=
   3622  (["'])?                         # find single or double quote
   3623  (?(1) (.*?)\1 | (\S+))          # if quote found, match up to next matching
   3624                                  # quote, otherwise match up to next space
   3625 /isx
   3626     <a href=abcd xyz
   3627     <a href=\"abcd xyz pqr\" cats
   3628     <a href       =       \'abcd xyz pqr\' cats
   3629 
   3630 /<a\s+href(?>\s*)=(?>\s*)        # find <a href=
   3631  (["'])?                         # find single or double quote
   3632  (?(1) (.*?)\1 | (\S+))          # if quote found, match up to next matching
   3633                                  # quote, otherwise match up to next space
   3634 /isx
   3635     <a href=abcd xyz
   3636     <a href=\"abcd xyz pqr\" cats
   3637     <a href       =       \'abcd xyz pqr\' cats
   3638 
   3639 /((Z)+|A)*/
   3640     ZABCDEFG
   3641 
   3642 /(Z()|A)*/
   3643     ZABCDEFG
   3644 
   3645 /(Z(())|A)*/
   3646     ZABCDEFG
   3647 
   3648 /((?>Z)+|A)*/
   3649     ZABCDEFG
   3650 
   3651 /((?>)+|A)*/
   3652     ZABCDEFG
   3653 
   3654 /a*/g
   3655     abbab
   3656 
   3657 /^[a-\d]/
   3658     abcde
   3659     -things
   3660     0digit
   3661     *** Failers
   3662     bcdef    
   3663 
   3664 /^[\d-a]/
   3665     abcde
   3666     -things
   3667     0digit
   3668     *** Failers
   3669     bcdef    
   3670     
   3671 /[[:space:]]+/
   3672     > \x09\x0a\x0c\x0d\x0b<
   3673      
   3674 /[[:blank:]]+/
   3675     > \x09\x0a\x0c\x0d\x0b<
   3676      
   3677 /[\s]+/
   3678     > \x09\x0a\x0c\x0d\x0b<
   3679      
   3680 /\s+/
   3681     > \x09\x0a\x0c\x0d\x0b<
   3682      
   3683 /ab/x
   3685     ab
   3686 
   3687 /(?!\A)x/m
   3688   a\nxb\n
   3689 
   3690 /(?!^)x/m
   3691   a\nxb\n
   3692 
   3693 /abc\Qabc\Eabc/
   3694     abcabcabc
   3695     
   3696 /abc\Q(*+|\Eabc/
   3697     abc(*+|abc 
   3698 
   3699 /   abc\Q abc\Eabc/x
   3700     abc abcabc
   3701     *** Failers
   3702     abcabcabc  
   3703     
   3704 /abc#comment
   3705     \Q#not comment
   3706     literal\E/x
   3707     abc#not comment\n    literal     
   3708 
   3709 /abc#comment
   3710     \Q#not comment
   3711     literal/x
   3712     abc#not comment\n    literal     
   3713 
   3714 /abc#comment
   3715     \Q#not comment
   3716     literal\E #more comment
   3717     /x
   3718     abc#not comment\n    literal     
   3719 
   3720 /abc#comment
   3721     \Q#not comment
   3722     literal\E #more comment/x
   3723     abc#not comment\n    literal     
   3724 
   3725 /\Qabc\$xyz\E/
   3726     abc\\\$xyz
   3727 
   3728 /\Qabc\E\$\Qxyz\E/
   3729     abc\$xyz
   3730 
   3731 /\Gabc/
   3732     abc
   3733     *** Failers
   3734     xyzabc  
   3735 
   3736 /\Gabc./g
   3737     abc1abc2xyzabc3
   3738 
   3739 /abc./g
   3740     abc1abc2xyzabc3 
   3741 
   3742 /a(?x: b c )d/
   3743     XabcdY
   3744     *** Failers 
   3745     Xa b c d Y 
   3746 
   3747 /((?x)x y z | a b c)/
   3748     XabcY
   3749     AxyzB 
   3750 
   3751 /(?i)AB(?-i)C/
   3752     XabCY
   3753     *** Failers
   3754     XabcY  
   3755 
   3756 /((?i)AB(?-i)C|D)E/
   3757     abCE
   3758     DE
   3759     *** Failers
   3760     abcE
   3761     abCe  
   3762     dE
   3763     De    
   3764 
   3765 /(.*)\d+\1/
   3766     abc123abc
   3767     abc123bc 
   3768 
   3769 /(.*)\d+\1/s
   3770     abc123abc
   3771     abc123bc 
   3772     
   3773 /((.*))\d+\1/
   3774     abc123abc
   3775     abc123bc  
   3776 
   3777 /-- This tests for an IPv6 address in the form where it can have up to --/
   3778 /-- eight components, one and only one of which is empty. This must be --/
   3779 /-- an internal component. --/
   3780 
   3781 /^(?!:)                       # colon disallowed at start
   3782   (?:                         # start of item
   3783     (?: [0-9a-f]{1,4} |       # 1-4 hex digits or
   3784     (?(1)0 | () ) )           # if null previously matched, fail; else null
   3785     :                         # followed by colon
   3786   ){1,7}                      # end item; 1-7 of them required               
   3787   [0-9a-f]{1,4} $             # final hex number at end of string
   3788   (?(1)|.)                    # check that there was an empty component
   3789   /xi
   3790     a123::a123
   3791     a123:b342::abcd
   3792     a123:b342::324e:abcd
   3793     a123:ddde:b342::324e:abcd
   3794     a123:ddde:b342::324e:dcba:abcd
   3795     a123:ddde:9999:b342::324e:dcba:abcd
   3796     *** Failers
   3797     1:2:3:4:5:6:7:8
   3798     a123:bce:ddde:9999:b342::324e:dcba:abcd
   3799     a123::9999:b342::324e:dcba:abcd
   3800     abcde:2:3:4:5:6:7:8
   3801     ::1
   3802     abcd:fee0:123::   
   3803     :1
   3804     1:  
   3805 
   3806 /[z\Qa-d]\E]/
   3807     z
   3808     a
   3809     -
   3810     d
   3811     ] 
   3812     *** Failers
   3813     b     
   3814 
   3815 /[\z\C]/
   3816     z
   3817     C 
   3818     
   3819 /\M/
   3820     M 
   3821     
   3822 /(a+)*b/
   3823     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
   3824     
   3825 /(?i)reg(?:ul(?:[a]|ae)r|ex)/
   3826     REGular
   3827     regulaer
   3828     Regex  
   3829     regulr 
   3830 
   3831 /[--]+/
   3832     
   3833     
   3834     
   3835     
   3836 
   3837 /(?<=Z)X./
   3838   \x84XAZXB
   3839 
   3840 /ab cd (?x) de fg/
   3841     ab cd defg
   3842 
   3843 /ab cd(?x) de fg/
   3844     ab cddefg
   3845     ** Failers 
   3846     abcddefg
   3847 
   3848 /(?<![^f]oo)(bar)/
   3849     foobarX 
   3850     ** Failers 
   3851     boobarX
   3852 
   3853 /(?<![^f])X/
   3854     offX
   3855     ** Failers
   3856     onyX  
   3857 
   3858 /(?<=[^f])X/
   3859     onyX
   3860     ** Failers
   3861     offX 
   3862 
   3863 /^/mg
   3864     a\nb\nc\n
   3865     \ 
   3866     
   3867 /(?<=C\n)^/mg
   3868     A\nC\nC\n 
   3869 
   3870 /(?:(?(1)a|b)(X))+/
   3871     bXaX
   3872 
   3873 /(?:(?(1)\1a|b)(X|Y))+/
   3874     bXXaYYaY
   3875     bXYaXXaX  
   3876 
   3877 /()()()()()()()()()(?:(?(10)\10a|b)(X|Y))+/
   3878     bXXaYYaY
   3879 
   3880 /[[,abc,]+]/
   3881     abc]
   3882     a,b]
   3883     [a,b,c]  
   3884 
   3885 /(?-x: )/x
   3886     A\x20B
   3887     
   3888 "(?x)(?-x: \s*#\s*)"
   3889     A # B
   3890     ** Failers
   3891     #  
   3892 
   3893 "(?x-is)(?:(?-ixs) \s*#\s*) include"
   3894     A #include
   3895     ** Failers
   3896     A#include  
   3897     A #Include
   3898 
   3899 /a*b*\w/
   3900     aaabbbb
   3901     aaaa
   3902     a
   3903 
   3904 /a*b?\w/
   3905     aaabbbb
   3906     aaaa
   3907     a
   3908 
   3909 /a*b{0,4}\w/
   3910     aaabbbb
   3911     aaaa
   3912     a
   3913 
   3914 /a*b{0,}\w/
   3915     aaabbbb
   3916     aaaa
   3917     a
   3918     
   3919 /a*\d*\w/
   3920     0a
   3921     a 
   3922     
   3923 /a*b *\w/x
   3924     a 
   3925 
   3926 /a*b#comment
   3927   *\w/x
   3928     a 
   3929 
   3930 /a* b *\w/x
   3931     a 
   3932 
   3933 /^\w+=.*(\\\n.*)*/
   3934     abc=xyz\\\npqr
   3935 
   3936 /(?=(\w+))\1:/
   3937     abcd:
   3938 
   3939 /^(?=(\w+))\1:/
   3940     abcd:
   3941 
   3942 /^\Eabc/
   3943     abc
   3944     
   3945 /^[\Eabc]/
   3946     a
   3947     ** Failers 
   3948     E 
   3949     
   3950 /^[a-\Ec]/
   3951     b
   3952     ** Failers
   3953     -
   3954     E    
   3955 
   3956 /^[a\E\E-\Ec]/
   3957     b
   3958     ** Failers
   3959     -
   3960     E    
   3961 
   3962 /^[\E\Qa\E-\Qz\E]+/
   3963     b
   3964     ** Failers
   3965     -  
   3966     
   3967 /^[a\Q]bc\E]/
   3968     a
   3969     ]
   3970     c
   3971     
   3972 /^[a-\Q\E]/
   3973     a
   3974     -     
   3975 
   3976 /^(a()*)*/
   3977     aaaa
   3978 
   3979 /^(?:a(?:(?:))*)*/
   3980     aaaa
   3981 
   3982 /^(a()+)+/
   3983     aaaa
   3984 
   3985 /^(?:a(?:(?:))+)+/
   3986     aaaa
   3987 
   3988 /(a){0,3}(?(1)b|(c|))*D/
   3989     abbD
   3990     ccccD
   3991     D  
   3992 
   3993 /(a|)*\d/
   3994   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   3995   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
   3996 
   3997 /(?>a|)*\d/
   3998   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   3999   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
   4000 
   4001 /(?:a|)*\d/
   4002   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   4003   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
   4004 
   4005 /\Z/g
   4006   abc\n
   4007   
   4008 /^(?s)(?>.*)(?<!\n)/
   4009   abc
   4010   abc\n  
   4011 
   4012 /^(?![^\n]*\n\z)/
   4013   abc
   4014   abc\n 
   4015   
   4016 /\z(?<!\n)/
   4017   abc
   4018   abc\n  
   4019 
   4020 /(.*(.)?)*/
   4021     abcd
   4022 
   4023 /( (A | (?(1)0|) )*   )/x
   4024     abcd
   4025 
   4026 /( ( (?(1)0|) )*   )/x
   4027     abcd
   4028 
   4029 /(  (?(1)0|)*   )/x
   4030     abcd
   4031 
   4032 /[[:abcd:xyz]]/
   4033     a]
   4034     :] 
   4035     
   4036 /[abc[:x\]pqr]/
   4037     a
   4038     [
   4039     :
   4040     ]
   4041     p    
   4042 
   4043 /.*[op][xyz]/
   4044     fooabcfoo
   4045 
   4046 /(?(?=.*b)b|^)/
   4047    adc
   4048    abc 
   4049 
   4050 /(?(?=^.*b)b|^)/
   4051    adc
   4052    abc 
   4053 
   4054 /(?(?=.*b)b|^)*/
   4055    adc
   4056    abc 
   4057 
   4058 /(?(?=.*b)b|^)+/
   4059    adc
   4060    abc 
   4061 
   4062 /(?(?=b).*b|^d)/
   4063     abc
   4064 
   4065 /(?(?=.*b).*b|^d)/
   4066     abc
   4067 
   4068 /^%((?(?=[a])[^%])|b)*%$/
   4069     %ab%
   4070 
   4071 /(?i)a(?-i)b|c/
   4072     XabX
   4073     XAbX
   4074     CcC 
   4075     ** Failers
   4076     XABX   
   4077 
   4078 /[\x00-\xff\s]+/
   4079     \x0a\x0b\x0c\x0d
   4080 
   4081 /^\c/
   4082     ?
   4083 
   4084 /-- End of testinput1 --/
   4085