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.10, in non-UTF-8 mode. It should run clean for the 8-bit, 16-bit,
      3     and 32-bit PCRE libraries. --/
      4     
      5 < forbid 89?=ABCDEFfGILMNPTUWXZ<
      6 
      7 /the quick brown fox/
      8     the quick brown fox
      9     The quick brown FOX
     10     What do you know about the quick brown fox?
     11     What do you know about THE QUICK BROWN FOX?
     12 
     13 /The quick brown fox/i
     14     the quick brown fox
     15     The quick brown FOX
     16     What do you know about the quick brown fox?
     17     What do you know about THE QUICK BROWN FOX?
     18 
     19 /abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
     20     abcd\t\n\r\f\a\e9;\$\\?caxyz
     21 
     22 /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
     23     abxyzpqrrrabbxyyyypqAzz
     24     abxyzpqrrrabbxyyyypqAzz
     25     aabxyzpqrrrabbxyyyypqAzz
     26     aaabxyzpqrrrabbxyyyypqAzz
     27     aaaabxyzpqrrrabbxyyyypqAzz
     28     abcxyzpqrrrabbxyyyypqAzz
     29     aabcxyzpqrrrabbxyyyypqAzz
     30     aaabcxyzpqrrrabbxyyyypAzz
     31     aaabcxyzpqrrrabbxyyyypqAzz
     32     aaabcxyzpqrrrabbxyyyypqqAzz
     33     aaabcxyzpqrrrabbxyyyypqqqAzz
     34     aaabcxyzpqrrrabbxyyyypqqqqAzz
     35     aaabcxyzpqrrrabbxyyyypqqqqqAzz
     36     aaabcxyzpqrrrabbxyyyypqqqqqqAzz
     37     aaaabcxyzpqrrrabbxyyyypqAzz
     38     abxyzzpqrrrabbxyyyypqAzz
     39     aabxyzzzpqrrrabbxyyyypqAzz
     40     aaabxyzzzzpqrrrabbxyyyypqAzz
     41     aaaabxyzzzzpqrrrabbxyyyypqAzz
     42     abcxyzzpqrrrabbxyyyypqAzz
     43     aabcxyzzzpqrrrabbxyyyypqAzz
     44     aaabcxyzzzzpqrrrabbxyyyypqAzz
     45     aaaabcxyzzzzpqrrrabbxyyyypqAzz
     46     aaaabcxyzzzzpqrrrabbbxyyyypqAzz
     47     aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
     48     aaabcxyzpqrrrabbxyyyypABzz
     49     aaabcxyzpqrrrabbxyyyypABBzz
     50     >>>aaabxyzpqrrrabbxyyyypqAzz
     51     >aaaabxyzpqrrrabbxyyyypqAzz
     52     >>>>abcxyzpqrrrabbxyyyypqAzz
     53     *** Failers
     54     abxyzpqrrabbxyyyypqAzz
     55     abxyzpqrrrrabbxyyyypqAzz
     56     abxyzpqrrrabxyyyypqAzz
     57     aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
     58     aaaabcxyzzzzpqrrrabbbxyyypqAzz
     59     aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
     60 
     61 /^(abc){1,2}zz/
     62     abczz
     63     abcabczz
     64     *** Failers
     65     zz
     66     abcabcabczz
     67     >>abczz
     68 
     69 /^(b+?|a){1,2}?c/
     70     bc
     71     bbc
     72     bbbc
     73     bac
     74     bbac
     75     aac
     76     abbbbbbbbbbbc
     77     bbbbbbbbbbbac
     78     *** Failers
     79     aaac
     80     abbbbbbbbbbbac
     81 
     82 /^(b+|a){1,2}c/
     83     bc
     84     bbc
     85     bbbc
     86     bac
     87     bbac
     88     aac
     89     abbbbbbbbbbbc
     90     bbbbbbbbbbbac
     91     *** Failers
     92     aaac
     93     abbbbbbbbbbbac
     94 
     95 /^(b+|a){1,2}?bc/
     96     bbc
     97 
     98 /^(b*|ba){1,2}?bc/
     99     babc
    100     bbabc
    101     bababc
    102     *** Failers
    103     bababbc
    104     babababc
    105 
    106 /^(ba|b*){1,2}?bc/
    107     babc
    108     bbabc
    109     bababc
    110     *** Failers
    111     bababbc
    112     babababc
    113 
    114 /^\ca\cA\c[;\c:/
    115     \x01\x01\e;z
    116 
    117 /^[ab\]cde]/
    118     athing
    119     bthing
    120     ]thing
    121     cthing
    122     dthing
    123     ething
    124     *** Failers
    125     fthing
    126     [thing
    127     \\thing
    128 
    129 /^[]cde]/
    130     ]thing
    131     cthing
    132     dthing
    133     ething
    134     *** Failers
    135     athing
    136     fthing
    137 
    138 /^[^ab\]cde]/
    139     fthing
    140     [thing
    141     \\thing
    142     *** Failers
    143     athing
    144     bthing
    145     ]thing
    146     cthing
    147     dthing
    148     ething
    149 
    150 /^[^]cde]/
    151     athing
    152     fthing
    153     *** Failers
    154     ]thing
    155     cthing
    156     dthing
    157     ething
    158 
    159 /^\/
    160     
    161 
    162 /^/
    163     
    164 
    165 /^[0-9]+$/
    166     0
    167     1
    168     2
    169     3
    170     4
    171     5
    172     6
    173     7
    174     8
    175     9
    176     10
    177     100
    178     *** Failers
    179     abc
    180 
    181 /^.*nter/
    182     enter
    183     inter
    184     uponter
    185 
    186 /^xxx[0-9]+$/
    187     xxx0
    188     xxx1234
    189     *** Failers
    190     xxx
    191 
    192 /^.+[0-9][0-9][0-9]$/
    193     x123
    194     xx123
    195     123456
    196     *** Failers
    197     123
    198     x1234
    199 
    200 /^.+?[0-9][0-9][0-9]$/
    201     x123
    202     xx123
    203     123456
    204     *** Failers
    205     123
    206     x1234
    207 
    208 /^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
    209     abc!pqr=apquxz.ixr.zzz.ac.uk
    210     *** Failers
    211     !pqr=apquxz.ixr.zzz.ac.uk
    212     abc!=apquxz.ixr.zzz.ac.uk
    213     abc!pqr=apquxz:ixr.zzz.ac.uk
    214     abc!pqr=apquxz.ixr.zzz.ac.ukk
    215 
    216 /:/
    217     Well, we need a colon: somewhere
    218     *** Fail if we don't
    219 
    220 /([\da-f:]+)$/i
    221     0abc
    222     abc
    223     fed
    224     E
    225     ::
    226     5f03:12C0::932e
    227     fed def
    228     Any old stuff
    229     *** Failers
    230     0zzz
    231     gzzz
    232     fed\x20
    233     Any old rubbish
    234 
    235 /^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
    236     .1.2.3
    237     A.12.123.0
    238     *** Failers
    239     .1.2.3333
    240     1.2.3
    241     1234.2.3
    242 
    243 /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
    244     1 IN SOA non-sp1 non-sp2(
    245     1    IN    SOA    non-sp1    non-sp2   (
    246     *** Failers
    247     1IN SOA non-sp1 non-sp2(
    248 
    249 /^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
    250     a.
    251     Z.
    252     2.
    253     ab-c.pq-r.
    254     sxk.zzz.ac.uk.
    255     x-.y-.
    256     *** Failers
    257     -abc.peq.
    258 
    259 /^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
    260     *.a
    261     *.b0-a
    262     *.c3-b.c
    263     *.c-a.b-c
    264     *** Failers
    265     *.0
    266     *.a-
    267     *.a-b.c-
    268     *.c-a.0-c
    269 
    270 /^(?=ab(de))(abd)(e)/
    271     abde
    272 
    273 /^(?!(ab)de|x)(abd)(f)/
    274     abdf
    275 
    276 /^(?=(ab(cd)))(ab)/
    277     abcd
    278 
    279 /^[\da-f](\.[\da-f])*$/i
    280     a.b.c.d
    281     A.B.C.D
    282     a.b.c.1.2.3.C
    283 
    284 /^\".*\"\s*(;.*)?$/
    285     \"1234\"
    286     \"abcd\" ;
    287     \"\" ; rhubarb
    288     *** Failers
    289     \"1234\" : things
    290 
    291 /^$/
    292     \
    293     *** Failers
    294 
    295 /   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/x
    296     ab c
    297     *** Failers
    298     abc
    299     ab cde
    300 
    301 /(?x)   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/
    302     ab c
    303     *** Failers
    304     abc
    305     ab cde
    306 
    307 /^   a\ b[c ]d       $/x
    308     a bcd
    309     a b d
    310     *** Failers
    311     abcd
    312     ab d
    313 
    314 /^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
    315     abcdefhijklm
    316 
    317 /^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
    318     abcdefhijklm
    319 
    320 /^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
    321     a+ Z0+\x08\n\x1d\x12
    322 
    323 /^[.^$|()*+?{,}]+/
    324     .^\$(*+)|{?,?}
    325 
    326 /^a*\w/
    327     z
    328     az
    329     aaaz
    330     a
    331     aa
    332     aaaa
    333     a+
    334     aa+
    335 
    336 /^a*?\w/
    337     z
    338     az
    339     aaaz
    340     a
    341     aa
    342     aaaa
    343     a+
    344     aa+
    345 
    346 /^a+\w/
    347     az
    348     aaaz
    349     aa
    350     aaaa
    351     aa+
    352 
    353 /^a+?\w/
    354     az
    355     aaaz
    356     aa
    357     aaaa
    358     aa+
    359 
    360 /^\d{8}\w{2,}/
    361     1234567890
    362     12345678ab
    363     12345678__
    364     *** Failers
    365     1234567
    366 
    367 /^[aeiou\d]{4,5}$/
    368     uoie
    369     1234
    370     12345
    371     aaaaa
    372     *** Failers
    373     123456
    374 
    375 /^[aeiou\d]{4,5}?/
    376     uoie
    377     1234
    378     12345
    379     aaaaa
    380     123456
    381 
    382 /\A(abc|def)=(\1){2,3}\Z/
    383     abc=abcabc
    384     def=defdefdef
    385     *** Failers
    386     abc=defdef
    387 
    388 /^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
    389     abcdefghijkcda2
    390     abcdefghijkkkkcda2
    391 
    392 /(cat(a(ract|tonic)|erpillar)) \1()2(3)/
    393     cataract cataract23
    394     catatonic catatonic23
    395     caterpillar caterpillar23
    396 
    397 
    398 /^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]/
    399     From abcd  Mon Sep 01 12:33:02 1997
    400 
    401 /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
    402     From abcd  Mon Sep 01 12:33:02 1997
    403     From abcd  Mon Sep  1 12:33:02 1997
    404     *** Failers
    405     From abcd  Sep 01 12:33:02 1997
    406 
    407 /^12.34/s
    408     12\n34
    409     12\r34
    410 
    411 /\w+(?=\t)/
    412     the quick brown\t fox
    413 
    414 /foo(?!bar)(.*)/
    415     foobar is foolish see?
    416 
    417 /(?:(?!foo)...|^.{0,2})bar(.*)/
    418     foobar crowbar etc
    419     barrel
    420     2barrel
    421     A barrel
    422 
    423 /^(\D*)(?=\d)(?!123)/
    424     abc456
    425     *** Failers
    426     abc123
    427 
    428 /^1234(?# test newlines
    429   inside)/
    430     1234
    431 
    432 /^1234 #comment in extended re
    433   /x
    434     1234
    435 
    436 /#rhubarb
    437   abcd/x
    438     abcd
    439 
    440 /^abcd#rhubarb/x
    441     abcd
    442 
    443 /^(a)\1{2,3}(.)/
    444     aaab
    445     aaaab
    446     aaaaab
    447     aaaaaab
    448 
    449 /(?!^)abc/
    450     the abc
    451     *** Failers
    452     abc
    453 
    454 /(?=^)abc/
    455     abc
    456     *** Failers
    457     the abc
    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 /^[ab]{1,3}(ab*?|b)/
    469     aabbbbb
    470 
    471 /  (?: [\040\t] |  \(
    472 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    473 \)  )*                          # optional leading comment
    474 (?:    (?:
    475 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    476 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    477 |
    478 " (?:                      # opening quote...
    479 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    480 |                     #    or
    481 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    482 )* "  # closing quote
    483 )                    # initial word
    484 (?:  (?: [\040\t] |  \(
    485 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    486 \)  )*  \.  (?: [\040\t] |  \(
    487 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    488 \)  )*   (?:
    489 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    490 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    491 |
    492 " (?:                      # opening quote...
    493 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    494 |                     #    or
    495 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    496 )* "  # closing quote
    497 )  )* # further okay, if led by a period
    498 (?: [\040\t] |  \(
    499 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    500 \)  )*  @  (?: [\040\t] |  \(
    501 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    502 \)  )*    (?:
    503 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    504 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    505 |   \[                         # [
    506 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    507 \]                        #           ]
    508 )                           # initial subdomain
    509 (?:                                  #
    510 (?: [\040\t] |  \(
    511 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    512 \)  )*  \.                        # if led by a period...
    513 (?: [\040\t] |  \(
    514 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    515 \)  )*   (?:
    516 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    517 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    518 |   \[                         # [
    519 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    520 \]                        #           ]
    521 )                     #   ...further okay
    522 )*
    523 # address
    524 |                     #  or
    525 (?:
    526 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    527 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    528 |
    529 " (?:                      # opening quote...
    530 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    531 |                     #    or
    532 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    533 )* "  # closing quote
    534 )             # one word, optionally followed by....
    535 (?:
    536 [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]  |  # atom and space parts, or...
    537 \(
    538 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    539 \)       |  # comments, or...
    540 
    541 " (?:                      # opening quote...
    542 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    543 |                     #    or
    544 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    545 )* "  # closing quote
    546 # quoted strings
    547 )*
    548 <  (?: [\040\t] |  \(
    549 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    550 \)  )*                     # leading <
    551 (?:  @  (?: [\040\t] |  \(
    552 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    553 \)  )*    (?:
    554 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    555 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    556 |   \[                         # [
    557 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    558 \]                        #           ]
    559 )                           # initial subdomain
    560 (?:                                  #
    561 (?: [\040\t] |  \(
    562 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    563 \)  )*  \.                        # if led by a period...
    564 (?: [\040\t] |  \(
    565 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    566 \)  )*   (?:
    567 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    568 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    569 |   \[                         # [
    570 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    571 \]                        #           ]
    572 )                     #   ...further okay
    573 )*
    574 
    575 (?:  (?: [\040\t] |  \(
    576 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    577 \)  )*  ,  (?: [\040\t] |  \(
    578 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    579 \)  )*  @  (?: [\040\t] |  \(
    580 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    581 \)  )*    (?:
    582 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    583 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    584 |   \[                         # [
    585 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    586 \]                        #           ]
    587 )                           # initial subdomain
    588 (?:                                  #
    589 (?: [\040\t] |  \(
    590 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    591 \)  )*  \.                        # if led by a period...
    592 (?: [\040\t] |  \(
    593 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    594 \)  )*   (?:
    595 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    596 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    597 |   \[                         # [
    598 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    599 \]                        #           ]
    600 )                     #   ...further okay
    601 )*
    602 )* # further okay, if led by comma
    603 :                                # closing colon
    604 (?: [\040\t] |  \(
    605 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    606 \)  )*  )? #       optional route
    607 (?:
    608 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    609 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    610 |
    611 " (?:                      # opening quote...
    612 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    613 |                     #    or
    614 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    615 )* "  # closing quote
    616 )                    # initial word
    617 (?:  (?: [\040\t] |  \(
    618 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    619 \)  )*  \.  (?: [\040\t] |  \(
    620 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    621 \)  )*   (?:
    622 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    623 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    624 |
    625 " (?:                      # opening quote...
    626 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
    627 |                     #    or
    628 \\ [^\x80-\xff]           #   Escaped something (something != CR)
    629 )* "  # closing quote
    630 )  )* # further okay, if led by a period
    631 (?: [\040\t] |  \(
    632 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    633 \)  )*  @  (?: [\040\t] |  \(
    634 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    635 \)  )*    (?:
    636 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    637 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    638 |   \[                         # [
    639 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    640 \]                        #           ]
    641 )                           # initial subdomain
    642 (?:                                  #
    643 (?: [\040\t] |  \(
    644 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    645 \)  )*  \.                        # if led by a period...
    646 (?: [\040\t] |  \(
    647 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    648 \)  )*   (?:
    649 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    650 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    651 |   \[                         # [
    652 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
    653 \]                        #           ]
    654 )                     #   ...further okay
    655 )*
    656 #       address spec
    657 (?: [\040\t] |  \(
    658 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    659 \)  )*  > #                  trailing >
    660 # name and address
    661 )  (?: [\040\t] |  \(
    662 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
    663 \)  )*                       # optional trailing comment
    664 /x
    665     Alan Other <user\@dom.ain>
    666     <user\@dom.ain>
    667     user\@dom.ain
    668     \"A. Other\" <user.1234\@dom.ain> (a comment)
    669     A. Other <user.1234\@dom.ain> (a comment)
    670     \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
    671     A missing angle <user\@some.where
    672     *** Failers
    673     The quick brown fox
    674 
    675 /[\040\t]*                    # Nab whitespace.
    676 (?:
    677 \(                              #  (
    678 [^\\\x80-\xff\n\015()] *                             #     normal*
    679 (?:                                 #       (
    680 (?:  \\ [^\x80-\xff]  |
    681 \(                            #  (
    682 [^\\\x80-\xff\n\015()] *                            #     normal*
    683 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    684 \)                           #                       )
    685 )    #         special
    686 [^\\\x80-\xff\n\015()] *                         #         normal*
    687 )*                                  #            )*
    688 \)                             #                )
    689 [\040\t]* )*    # If comment found, allow more spaces.
    690 # optional leading comment
    691 (?:
    692 (?:
    693 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    694 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    695 # Atom
    696 |                       #  or
    697 "                                     # "
    698 [^\\\x80-\xff\n\015"] *                            #   normal
    699 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
    700 "                                     #        "
    701 # Quoted string
    702 )
    703 [\040\t]*                    # Nab whitespace.
    704 (?:
    705 \(                              #  (
    706 [^\\\x80-\xff\n\015()] *                             #     normal*
    707 (?:                                 #       (
    708 (?:  \\ [^\x80-\xff]  |
    709 \(                            #  (
    710 [^\\\x80-\xff\n\015()] *                            #     normal*
    711 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    712 \)                           #                       )
    713 )    #         special
    714 [^\\\x80-\xff\n\015()] *                         #         normal*
    715 )*                                  #            )*
    716 \)                             #                )
    717 [\040\t]* )*    # If comment found, allow more spaces.
    718 (?:
    719 \.
    720 [\040\t]*                    # Nab whitespace.
    721 (?:
    722 \(                              #  (
    723 [^\\\x80-\xff\n\015()] *                             #     normal*
    724 (?:                                 #       (
    725 (?:  \\ [^\x80-\xff]  |
    726 \(                            #  (
    727 [^\\\x80-\xff\n\015()] *                            #     normal*
    728 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    729 \)                           #                       )
    730 )    #         special
    731 [^\\\x80-\xff\n\015()] *                         #         normal*
    732 )*                                  #            )*
    733 \)                             #                )
    734 [\040\t]* )*    # If comment found, allow more spaces.
    735 (?:
    736 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    737 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    738 # Atom
    739 |                       #  or
    740 "                                     # "
    741 [^\\\x80-\xff\n\015"] *                            #   normal
    742 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
    743 "                                     #        "
    744 # Quoted string
    745 )
    746 [\040\t]*                    # Nab whitespace.
    747 (?:
    748 \(                              #  (
    749 [^\\\x80-\xff\n\015()] *                             #     normal*
    750 (?:                                 #       (
    751 (?:  \\ [^\x80-\xff]  |
    752 \(                            #  (
    753 [^\\\x80-\xff\n\015()] *                            #     normal*
    754 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    755 \)                           #                       )
    756 )    #         special
    757 [^\\\x80-\xff\n\015()] *                         #         normal*
    758 )*                                  #            )*
    759 \)                             #                )
    760 [\040\t]* )*    # If comment found, allow more spaces.
    761 # additional words
    762 )*
    763 @
    764 [\040\t]*                    # Nab whitespace.
    765 (?:
    766 \(                              #  (
    767 [^\\\x80-\xff\n\015()] *                             #     normal*
    768 (?:                                 #       (
    769 (?:  \\ [^\x80-\xff]  |
    770 \(                            #  (
    771 [^\\\x80-\xff\n\015()] *                            #     normal*
    772 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    773 \)                           #                       )
    774 )    #         special
    775 [^\\\x80-\xff\n\015()] *                         #         normal*
    776 )*                                  #            )*
    777 \)                             #                )
    778 [\040\t]* )*    # If comment found, allow more spaces.
    779 (?:
    780 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    781 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    782 |
    783 \[                            # [
    784 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
    785 \]                           #           ]
    786 )
    787 [\040\t]*                    # Nab whitespace.
    788 (?:
    789 \(                              #  (
    790 [^\\\x80-\xff\n\015()] *                             #     normal*
    791 (?:                                 #       (
    792 (?:  \\ [^\x80-\xff]  |
    793 \(                            #  (
    794 [^\\\x80-\xff\n\015()] *                            #     normal*
    795 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    796 \)                           #                       )
    797 )    #         special
    798 [^\\\x80-\xff\n\015()] *                         #         normal*
    799 )*                                  #            )*
    800 \)                             #                )
    801 [\040\t]* )*    # If comment found, allow more spaces.
    802 # optional trailing comments
    803 (?:
    804 \.
    805 [\040\t]*                    # Nab whitespace.
    806 (?:
    807 \(                              #  (
    808 [^\\\x80-\xff\n\015()] *                             #     normal*
    809 (?:                                 #       (
    810 (?:  \\ [^\x80-\xff]  |
    811 \(                            #  (
    812 [^\\\x80-\xff\n\015()] *                            #     normal*
    813 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    814 \)                           #                       )
    815 )    #         special
    816 [^\\\x80-\xff\n\015()] *                         #         normal*
    817 )*                                  #            )*
    818 \)                             #                )
    819 [\040\t]* )*    # If comment found, allow more spaces.
    820 (?:
    821 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    822 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    823 |
    824 \[                            # [
    825 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
    826 \]                           #           ]
    827 )
    828 [\040\t]*                    # Nab whitespace.
    829 (?:
    830 \(                              #  (
    831 [^\\\x80-\xff\n\015()] *                             #     normal*
    832 (?:                                 #       (
    833 (?:  \\ [^\x80-\xff]  |
    834 \(                            #  (
    835 [^\\\x80-\xff\n\015()] *                            #     normal*
    836 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    837 \)                           #                       )
    838 )    #         special
    839 [^\\\x80-\xff\n\015()] *                         #         normal*
    840 )*                                  #            )*
    841 \)                             #                )
    842 [\040\t]* )*    # If comment found, allow more spaces.
    843 # optional trailing comments
    844 )*
    845 # address
    846 |                             #  or
    847 (?:
    848 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    849 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    850 # Atom
    851 |                       #  or
    852 "                                     # "
    853 [^\\\x80-\xff\n\015"] *                            #   normal
    854 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
    855 "                                     #        "
    856 # Quoted string
    857 )
    858 # leading word
    859 [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *               # "normal" atoms and or spaces
    860 (?:
    861 (?:
    862 \(                              #  (
    863 [^\\\x80-\xff\n\015()] *                             #     normal*
    864 (?:                                 #       (
    865 (?:  \\ [^\x80-\xff]  |
    866 \(                            #  (
    867 [^\\\x80-\xff\n\015()] *                            #     normal*
    868 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    869 \)                           #                       )
    870 )    #         special
    871 [^\\\x80-\xff\n\015()] *                         #         normal*
    872 )*                                  #            )*
    873 \)                             #                )
    874 |
    875 "                                     # "
    876 [^\\\x80-\xff\n\015"] *                            #   normal
    877 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
    878 "                                     #        "
    879 ) # "special" comment or quoted string
    880 [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *            #  more "normal"
    881 )*
    882 <
    883 [\040\t]*                    # Nab whitespace.
    884 (?:
    885 \(                              #  (
    886 [^\\\x80-\xff\n\015()] *                             #     normal*
    887 (?:                                 #       (
    888 (?:  \\ [^\x80-\xff]  |
    889 \(                            #  (
    890 [^\\\x80-\xff\n\015()] *                            #     normal*
    891 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    892 \)                           #                       )
    893 )    #         special
    894 [^\\\x80-\xff\n\015()] *                         #         normal*
    895 )*                                  #            )*
    896 \)                             #                )
    897 [\040\t]* )*    # If comment found, allow more spaces.
    898 # <
    899 (?:
    900 @
    901 [\040\t]*                    # Nab whitespace.
    902 (?:
    903 \(                              #  (
    904 [^\\\x80-\xff\n\015()] *                             #     normal*
    905 (?:                                 #       (
    906 (?:  \\ [^\x80-\xff]  |
    907 \(                            #  (
    908 [^\\\x80-\xff\n\015()] *                            #     normal*
    909 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    910 \)                           #                       )
    911 )    #         special
    912 [^\\\x80-\xff\n\015()] *                         #         normal*
    913 )*                                  #            )*
    914 \)                             #                )
    915 [\040\t]* )*    # If comment found, allow more spaces.
    916 (?:
    917 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    918 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    919 |
    920 \[                            # [
    921 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
    922 \]                           #           ]
    923 )
    924 [\040\t]*                    # Nab whitespace.
    925 (?:
    926 \(                              #  (
    927 [^\\\x80-\xff\n\015()] *                             #     normal*
    928 (?:                                 #       (
    929 (?:  \\ [^\x80-\xff]  |
    930 \(                            #  (
    931 [^\\\x80-\xff\n\015()] *                            #     normal*
    932 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    933 \)                           #                       )
    934 )    #         special
    935 [^\\\x80-\xff\n\015()] *                         #         normal*
    936 )*                                  #            )*
    937 \)                             #                )
    938 [\040\t]* )*    # If comment found, allow more spaces.
    939 # optional trailing comments
    940 (?:
    941 \.
    942 [\040\t]*                    # Nab whitespace.
    943 (?:
    944 \(                              #  (
    945 [^\\\x80-\xff\n\015()] *                             #     normal*
    946 (?:                                 #       (
    947 (?:  \\ [^\x80-\xff]  |
    948 \(                            #  (
    949 [^\\\x80-\xff\n\015()] *                            #     normal*
    950 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    951 \)                           #                       )
    952 )    #         special
    953 [^\\\x80-\xff\n\015()] *                         #         normal*
    954 )*                                  #            )*
    955 \)                             #                )
    956 [\040\t]* )*    # If comment found, allow more spaces.
    957 (?:
    958 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
    959 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
    960 |
    961 \[                            # [
    962 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
    963 \]                           #           ]
    964 )
    965 [\040\t]*                    # Nab whitespace.
    966 (?:
    967 \(                              #  (
    968 [^\\\x80-\xff\n\015()] *                             #     normal*
    969 (?:                                 #       (
    970 (?:  \\ [^\x80-\xff]  |
    971 \(                            #  (
    972 [^\\\x80-\xff\n\015()] *                            #     normal*
    973 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    974 \)                           #                       )
    975 )    #         special
    976 [^\\\x80-\xff\n\015()] *                         #         normal*
    977 )*                                  #            )*
    978 \)                             #                )
    979 [\040\t]* )*    # If comment found, allow more spaces.
    980 # optional trailing comments
    981 )*
    982 (?: ,
    983 [\040\t]*                    # Nab whitespace.
    984 (?:
    985 \(                              #  (
    986 [^\\\x80-\xff\n\015()] *                             #     normal*
    987 (?:                                 #       (
    988 (?:  \\ [^\x80-\xff]  |
    989 \(                            #  (
    990 [^\\\x80-\xff\n\015()] *                            #     normal*
    991 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
    992 \)                           #                       )
    993 )    #         special
    994 [^\\\x80-\xff\n\015()] *                         #         normal*
    995 )*                                  #            )*
    996 \)                             #                )
    997 [\040\t]* )*    # If comment found, allow more spaces.
    998 @
    999 [\040\t]*                    # Nab whitespace.
   1000 (?:
   1001 \(                              #  (
   1002 [^\\\x80-\xff\n\015()] *                             #     normal*
   1003 (?:                                 #       (
   1004 (?:  \\ [^\x80-\xff]  |
   1005 \(                            #  (
   1006 [^\\\x80-\xff\n\015()] *                            #     normal*
   1007 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1008 \)                           #                       )
   1009 )    #         special
   1010 [^\\\x80-\xff\n\015()] *                         #         normal*
   1011 )*                                  #            )*
   1012 \)                             #                )
   1013 [\040\t]* )*    # If comment found, allow more spaces.
   1014 (?:
   1015 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1016 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1017 |
   1018 \[                            # [
   1019 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
   1020 \]                           #           ]
   1021 )
   1022 [\040\t]*                    # Nab whitespace.
   1023 (?:
   1024 \(                              #  (
   1025 [^\\\x80-\xff\n\015()] *                             #     normal*
   1026 (?:                                 #       (
   1027 (?:  \\ [^\x80-\xff]  |
   1028 \(                            #  (
   1029 [^\\\x80-\xff\n\015()] *                            #     normal*
   1030 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1031 \)                           #                       )
   1032 )    #         special
   1033 [^\\\x80-\xff\n\015()] *                         #         normal*
   1034 )*                                  #            )*
   1035 \)                             #                )
   1036 [\040\t]* )*    # If comment found, allow more spaces.
   1037 # optional trailing comments
   1038 (?:
   1039 \.
   1040 [\040\t]*                    # Nab whitespace.
   1041 (?:
   1042 \(                              #  (
   1043 [^\\\x80-\xff\n\015()] *                             #     normal*
   1044 (?:                                 #       (
   1045 (?:  \\ [^\x80-\xff]  |
   1046 \(                            #  (
   1047 [^\\\x80-\xff\n\015()] *                            #     normal*
   1048 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1049 \)                           #                       )
   1050 )    #         special
   1051 [^\\\x80-\xff\n\015()] *                         #         normal*
   1052 )*                                  #            )*
   1053 \)                             #                )
   1054 [\040\t]* )*    # If comment found, allow more spaces.
   1055 (?:
   1056 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1057 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1058 |
   1059 \[                            # [
   1060 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
   1061 \]                           #           ]
   1062 )
   1063 [\040\t]*                    # Nab whitespace.
   1064 (?:
   1065 \(                              #  (
   1066 [^\\\x80-\xff\n\015()] *                             #     normal*
   1067 (?:                                 #       (
   1068 (?:  \\ [^\x80-\xff]  |
   1069 \(                            #  (
   1070 [^\\\x80-\xff\n\015()] *                            #     normal*
   1071 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1072 \)                           #                       )
   1073 )    #         special
   1074 [^\\\x80-\xff\n\015()] *                         #         normal*
   1075 )*                                  #            )*
   1076 \)                             #                )
   1077 [\040\t]* )*    # If comment found, allow more spaces.
   1078 # optional trailing comments
   1079 )*
   1080 )*  # additional domains
   1081 :
   1082 [\040\t]*                    # Nab whitespace.
   1083 (?:
   1084 \(                              #  (
   1085 [^\\\x80-\xff\n\015()] *                             #     normal*
   1086 (?:                                 #       (
   1087 (?:  \\ [^\x80-\xff]  |
   1088 \(                            #  (
   1089 [^\\\x80-\xff\n\015()] *                            #     normal*
   1090 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1091 \)                           #                       )
   1092 )    #         special
   1093 [^\\\x80-\xff\n\015()] *                         #         normal*
   1094 )*                                  #            )*
   1095 \)                             #                )
   1096 [\040\t]* )*    # If comment found, allow more spaces.
   1097 # optional trailing comments
   1098 )?     #       optional route
   1099 (?:
   1100 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1101 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1102 # Atom
   1103 |                       #  or
   1104 "                                     # "
   1105 [^\\\x80-\xff\n\015"] *                            #   normal
   1106 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
   1107 "                                     #        "
   1108 # Quoted string
   1109 )
   1110 [\040\t]*                    # Nab whitespace.
   1111 (?:
   1112 \(                              #  (
   1113 [^\\\x80-\xff\n\015()] *                             #     normal*
   1114 (?:                                 #       (
   1115 (?:  \\ [^\x80-\xff]  |
   1116 \(                            #  (
   1117 [^\\\x80-\xff\n\015()] *                            #     normal*
   1118 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1119 \)                           #                       )
   1120 )    #         special
   1121 [^\\\x80-\xff\n\015()] *                         #         normal*
   1122 )*                                  #            )*
   1123 \)                             #                )
   1124 [\040\t]* )*    # If comment found, allow more spaces.
   1125 (?:
   1126 \.
   1127 [\040\t]*                    # Nab whitespace.
   1128 (?:
   1129 \(                              #  (
   1130 [^\\\x80-\xff\n\015()] *                             #     normal*
   1131 (?:                                 #       (
   1132 (?:  \\ [^\x80-\xff]  |
   1133 \(                            #  (
   1134 [^\\\x80-\xff\n\015()] *                            #     normal*
   1135 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1136 \)                           #                       )
   1137 )    #         special
   1138 [^\\\x80-\xff\n\015()] *                         #         normal*
   1139 )*                                  #            )*
   1140 \)                             #                )
   1141 [\040\t]* )*    # If comment found, allow more spaces.
   1142 (?:
   1143 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1144 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1145 # Atom
   1146 |                       #  or
   1147 "                                     # "
   1148 [^\\\x80-\xff\n\015"] *                            #   normal
   1149 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
   1150 "                                     #        "
   1151 # Quoted string
   1152 )
   1153 [\040\t]*                    # Nab whitespace.
   1154 (?:
   1155 \(                              #  (
   1156 [^\\\x80-\xff\n\015()] *                             #     normal*
   1157 (?:                                 #       (
   1158 (?:  \\ [^\x80-\xff]  |
   1159 \(                            #  (
   1160 [^\\\x80-\xff\n\015()] *                            #     normal*
   1161 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1162 \)                           #                       )
   1163 )    #         special
   1164 [^\\\x80-\xff\n\015()] *                         #         normal*
   1165 )*                                  #            )*
   1166 \)                             #                )
   1167 [\040\t]* )*    # If comment found, allow more spaces.
   1168 # additional words
   1169 )*
   1170 @
   1171 [\040\t]*                    # Nab whitespace.
   1172 (?:
   1173 \(                              #  (
   1174 [^\\\x80-\xff\n\015()] *                             #     normal*
   1175 (?:                                 #       (
   1176 (?:  \\ [^\x80-\xff]  |
   1177 \(                            #  (
   1178 [^\\\x80-\xff\n\015()] *                            #     normal*
   1179 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1180 \)                           #                       )
   1181 )    #         special
   1182 [^\\\x80-\xff\n\015()] *                         #         normal*
   1183 )*                                  #            )*
   1184 \)                             #                )
   1185 [\040\t]* )*    # If comment found, allow more spaces.
   1186 (?:
   1187 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1188 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1189 |
   1190 \[                            # [
   1191 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
   1192 \]                           #           ]
   1193 )
   1194 [\040\t]*                    # Nab whitespace.
   1195 (?:
   1196 \(                              #  (
   1197 [^\\\x80-\xff\n\015()] *                             #     normal*
   1198 (?:                                 #       (
   1199 (?:  \\ [^\x80-\xff]  |
   1200 \(                            #  (
   1201 [^\\\x80-\xff\n\015()] *                            #     normal*
   1202 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1203 \)                           #                       )
   1204 )    #         special
   1205 [^\\\x80-\xff\n\015()] *                         #         normal*
   1206 )*                                  #            )*
   1207 \)                             #                )
   1208 [\040\t]* )*    # If comment found, allow more spaces.
   1209 # optional trailing comments
   1210 (?:
   1211 \.
   1212 [\040\t]*                    # Nab whitespace.
   1213 (?:
   1214 \(                              #  (
   1215 [^\\\x80-\xff\n\015()] *                             #     normal*
   1216 (?:                                 #       (
   1217 (?:  \\ [^\x80-\xff]  |
   1218 \(                            #  (
   1219 [^\\\x80-\xff\n\015()] *                            #     normal*
   1220 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1221 \)                           #                       )
   1222 )    #         special
   1223 [^\\\x80-\xff\n\015()] *                         #         normal*
   1224 )*                                  #            )*
   1225 \)                             #                )
   1226 [\040\t]* )*    # If comment found, allow more spaces.
   1227 (?:
   1228 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
   1229 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
   1230 |
   1231 \[                            # [
   1232 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
   1233 \]                           #           ]
   1234 )
   1235 [\040\t]*                    # Nab whitespace.
   1236 (?:
   1237 \(                              #  (
   1238 [^\\\x80-\xff\n\015()] *                             #     normal*
   1239 (?:                                 #       (
   1240 (?:  \\ [^\x80-\xff]  |
   1241 \(                            #  (
   1242 [^\\\x80-\xff\n\015()] *                            #     normal*
   1243 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
   1244 \)                           #                       )
   1245 )    #         special
   1246 [^\\\x80-\xff\n\015()] *                         #         normal*
   1247 )*                                  #            )*
   1248 \)                             #                )
   1249 [\040\t]* )*    # If comment found, allow more spaces.
   1250 # optional trailing comments
   1251 )*
   1252 #       address spec
   1253 >                    #                 >
   1254 # name and address
   1255 )
   1256 /x
   1257     Alan Other <user\@dom.ain>
   1258     <user\@dom.ain>
   1259     user\@dom.ain
   1260     \"A. Other\" <user.1234\@dom.ain> (a comment)
   1261     A. Other <user.1234\@dom.ain> (a comment)
   1262     \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
   1263     A missing angle <user\@some.where
   1264     *** Failers
   1265     The quick brown fox
   1266 
   1267 /abc\0def\00pqr\000xyz\0000AB/
   1268     abc\0def\00pqr\000xyz\0000AB
   1269     abc456 abc\0def\00pqr\000xyz\0000ABCDE
   1270 
   1271 /abc\x0def\x00pqr\x000xyz\x0000AB/
   1272     abc\x0def\x00pqr\x000xyz\x0000AB
   1273     abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
   1274 
   1275 /^[\000-\037]/
   1276     \0A
   1277     \01B
   1278     \037C
   1279 
   1280 /\0*/
   1281     \0\0\0\0
   1282 
   1283 /A\x0{2,3}Z/
   1284     The A\x0\x0Z
   1285     An A\0\x0\0Z
   1286     *** Failers
   1287     A\0Z
   1288     A\0\x0\0\x0Z
   1289 
   1290 /^(cow|)\1(bell)/
   1291     cowcowbell
   1292     bell
   1293     *** Failers
   1294     cowbell
   1295 
   1296 /^\s/
   1297     \040abc
   1298     \x0cabc
   1299     \nabc
   1300     \rabc
   1301     \tabc
   1302     *** Failers
   1303     abc
   1304 
   1305 /^a	b
   1306       c/x
   1308     abc
   1309 
   1310 /^(a|)\1*b/
   1311     ab
   1312     aaaab
   1313     b
   1314     *** Failers
   1315     acb
   1316 
   1317 /^(a|)\1+b/
   1318     aab
   1319     aaaab
   1320     b
   1321     *** Failers
   1322     ab
   1323 
   1324 /^(a|)\1?b/
   1325     ab
   1326     aab
   1327     b
   1328     *** Failers
   1329     acb
   1330 
   1331 /^(a|)\1{2}b/
   1332     aaab
   1333     b
   1334     *** Failers
   1335     ab
   1336     aab
   1337     aaaab
   1338 
   1339 /^(a|)\1{2,3}b/
   1340     aaab
   1341     aaaab
   1342     b
   1343     *** Failers
   1344     ab
   1345     aab
   1346     aaaaab
   1347 
   1348 /ab{1,3}bc/
   1349     abbbbc
   1350     abbbc
   1351     abbc
   1352     *** Failers
   1353     abc
   1354     abbbbbc
   1355 
   1356 /([^.]*)\.([^:]*):[T ]+(.*)/
   1357     track1.title:TBlah blah blah
   1358 
   1359 /([^.]*)\.([^:]*):[T ]+(.*)/i
   1360     track1.title:TBlah blah blah
   1361 
   1362 /([^.]*)\.([^:]*):[t ]+(.*)/i
   1363     track1.title:TBlah blah blah
   1364 
   1365 /^[W-c]+$/
   1366     WXY_^abc
   1367     *** Failers
   1368     wxy
   1369 
   1370 /^[W-c]+$/i
   1371     WXY_^abc
   1372     wxy_^ABC
   1373 
   1374 /^[\x3f-\x5F]+$/i
   1375     WXY_^abc
   1376     wxy_^ABC
   1377 
   1378 /^abc$/m
   1379     abc
   1380     qqq\nabc
   1381     abc\nzzz
   1382     qqq\nabc\nzzz
   1383 
   1384 /^abc$/
   1385     abc
   1386     *** Failers
   1387     qqq\nabc
   1388     abc\nzzz
   1389     qqq\nabc\nzzz
   1390 
   1391 /\Aabc\Z/m
   1392     abc
   1393     abc\n 
   1394     *** Failers
   1395     qqq\nabc
   1396     abc\nzzz
   1397     qqq\nabc\nzzz
   1398     
   1399 /\A(.)*\Z/s
   1400     abc\ndef
   1401 
   1402 /\A(.)*\Z/m
   1403     *** Failers
   1404     abc\ndef
   1405 
   1406 /(?:b)|(?::+)/
   1407     b::c
   1408     c::b
   1409 
   1410 /[-az]+/
   1411     az-
   1412     *** Failers
   1413     b
   1414 
   1415 /[az-]+/
   1416     za-
   1417     *** Failers
   1418     b
   1419 
   1420 /[a\-z]+/
   1421     a-z
   1422     *** Failers
   1423     b
   1424 
   1425 /[a-z]+/
   1426     abcdxyz
   1427 
   1428 /[\d-]+/
   1429     12-34
   1430     *** Failers
   1431     aaa
   1432 
   1433 /[\d-z]+/
   1434     12-34z
   1435     *** Failers
   1436     aaa
   1437 
   1438 /\x5c/
   1439     \\
   1440 
   1441 /\x20Z/
   1442     the Zoo
   1443     *** Failers
   1444     Zulu
   1445 
   1446 /(abc)\1/i
   1447     abcabc
   1448     ABCabc
   1449     abcABC
   1450 
   1451 /ab{3cd/
   1452     ab{3cd
   1453 
   1454 /ab{3,cd/
   1455     ab{3,cd
   1456 
   1457 /ab{3,4a}cd/
   1458     ab{3,4a}cd
   1459 
   1460 /{4,5a}bc/
   1461     {4,5a}bc
   1462 
   1463 /abc$/
   1464     abc
   1465     abc\n
   1466     *** Failers
   1467     abc\ndef
   1468 
   1469 /(abc)\123/
   1470     abc\x53
   1471 
   1472 /(abc)\223/
   1473     abc\x93
   1474 
   1475 /(abc)\323/
   1476     abc\xd3
   1477 
   1478 /(abc)\100/
   1479     abc\x40
   1480     abc\100
   1481 
   1482 /(abc)\1000/
   1483     abc\x400
   1484     abc\x40\x30
   1485     abc\1000
   1486     abc\100\x30
   1487     abc\100\060
   1488     abc\100\60
   1489     
   1490 /^A\8B\9C$/
   1491     A8B9C
   1492     *** Failers
   1493     A\08B\09C  
   1494     
   1495 /^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/
   1496     ABCDEFGHIHI 
   1497 
   1498 /^[A\8B\9C]+$/
   1499     A8B9C
   1500     *** Failers 
   1501     A8B9C\x00
   1502 
   1503 /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
   1504     abcdefghijkllS
   1505 
   1506 /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
   1507     abcdefghijk\12S
   1508 
   1509 /ab\idef/
   1510     abidef
   1511 
   1512 /a{0}bc/
   1513     bc
   1514 
   1515 /(a|(bc)){0,0}?xyz/
   1516     xyz
   1517 
   1518 /abc[\10]de/
   1519     abc\010de
   1520 
   1521 /abc[\1]de/
   1522     abc\1de
   1523 
   1524 /(abc)[\1]de/
   1525     abc\1de
   1526 
   1527 /(?s)a.b/
   1528     a\nb
   1529 
   1530 /^([^a])([^\b])([^c]*)([^d]{3,4})/
   1531     baNOTccccd
   1532     baNOTcccd
   1533     baNOTccd
   1534     bacccd
   1535     *** Failers
   1536     anything
   1537     b\bc   
   1538     baccd
   1539 
   1540 /[^a]/
   1541     Abc
   1542   
   1543 /[^a]/i
   1544     Abc 
   1545 
   1546 /[^a]+/
   1547     AAAaAbc
   1548   
   1549 /[^a]+/i
   1550     AAAaAbc 
   1551 
   1552 /[^a]+/
   1553     bbb\nccc
   1554    
   1555 /[^k]$/
   1556     abc
   1557     *** Failers
   1558     abk   
   1559    
   1560 /[^k]{2,3}$/
   1561     abc
   1562     kbc
   1563     kabc 
   1564     *** Failers
   1565     abk
   1566     akb
   1567     akk 
   1568 
   1569 /^\d{8,}\@.+[^k]$/
   1570     12345678\@a.b.c.d
   1571     123456789\@x.y.z
   1572     *** Failers
   1573     12345678\@x.y.uk
   1574     1234567\@a.b.c.d       
   1575 
   1576 /(a)\1{8,}/
   1577     aaaaaaaaa
   1578     aaaaaaaaaa
   1579     *** Failers
   1580     aaaaaaa   
   1581 
   1582 /[^a]/
   1583     aaaabcd
   1584     aaAabcd 
   1585 
   1586 /[^a]/i
   1587     aaaabcd
   1588     aaAabcd 
   1589 
   1590 /[^az]/
   1591     aaaabcd
   1592     aaAabcd 
   1593 
   1594 /[^az]/i
   1595     aaaabcd
   1596     aaAabcd 
   1597 
   1598 /\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/
   1599  \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
   1600 
   1601 /P[^*]TAIRE[^*]{1,6}?LL/
   1602     xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
   1603 
   1604 /P[^*]TAIRE[^*]{1,}?LL/
   1605     xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
   1606 
   1607 /(\.\d\d[1-9]?)\d+/
   1608     1.230003938
   1609     1.875000282   
   1610     1.235  
   1611                   
   1612 /(\.\d\d((?=0)|\d(?=\d)))/
   1613     1.230003938      
   1614     1.875000282
   1615     *** Failers 
   1616     1.235 
   1617     
   1618 /a(?)b/
   1619     ab 
   1620  
   1621 /\b(foo)\s+(\w+)/i
   1622     Food is on the foo table
   1623     
   1624 /foo(.*)bar/
   1625     The food is under the bar in the barn.
   1626     
   1627 /foo(.*?)bar/  
   1628     The food is under the bar in the barn.
   1629 
   1630 /(.*)(\d*)/
   1631     I have 2 numbers: 53147
   1632     
   1633 /(.*)(\d+)/
   1634     I have 2 numbers: 53147
   1635  
   1636 /(.*?)(\d*)/
   1637     I have 2 numbers: 53147
   1638 
   1639 /(.*?)(\d+)/
   1640     I have 2 numbers: 53147
   1641 
   1642 /(.*)(\d+)$/
   1643     I have 2 numbers: 53147
   1644 
   1645 /(.*?)(\d+)$/
   1646     I have 2 numbers: 53147
   1647 
   1648 /(.*)\b(\d+)$/
   1649     I have 2 numbers: 53147
   1650 
   1651 /(.*\D)(\d+)$/
   1652     I have 2 numbers: 53147
   1653 
   1654 /^\D*(?!123)/
   1655     ABC123
   1656      
   1657 /^(\D*)(?=\d)(?!123)/
   1658     ABC445
   1659     *** Failers
   1660     ABC123
   1661     
   1662 /^[W-]46]/
   1663     W46]789 
   1664     -46]789
   1665     *** Failers
   1666     Wall
   1667     Zebra
   1668     42
   1669     [abcd] 
   1670     ]abcd[
   1671        
   1672 /^[W-\]46]/
   1673     W46]789 
   1674     Wall
   1675     Zebra
   1676     Xylophone  
   1677     42
   1678     [abcd] 
   1679     ]abcd[
   1680     \\backslash 
   1681     *** Failers
   1682     -46]789
   1683     well
   1684     
   1685 /\d\d\/\d\d\/\d\d\d\d/
   1686     01/01/2000
   1687 
   1688 /word (?:[a-zA-Z0-9]+ ){0,10}otherword/
   1689   word cat dog elephant mussel cow horse canary baboon snake shark otherword
   1690   word cat dog elephant mussel cow horse canary baboon snake shark
   1691 
   1692 /word (?:[a-zA-Z0-9]+ ){0,300}otherword/
   1693   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
   1694 
   1695 /^(a){0,0}/
   1696     bcd
   1697     abc
   1698     aab     
   1699 
   1700 /^(a){0,1}/
   1701     bcd
   1702     abc
   1703     aab  
   1704 
   1705 /^(a){0,2}/
   1706     bcd
   1707     abc
   1708     aab  
   1709 
   1710 /^(a){0,3}/
   1711     bcd
   1712     abc
   1713     aab
   1714     aaa   
   1715 
   1716 /^(a){0,}/
   1717     bcd
   1718     abc
   1719     aab
   1720     aaa
   1721     aaaaaaaa    
   1722 
   1723 /^(a){1,1}/
   1724     bcd
   1725     abc
   1726     aab  
   1727 
   1728 /^(a){1,2}/
   1729     bcd
   1730     abc
   1731     aab  
   1732 
   1733 /^(a){1,3}/
   1734     bcd
   1735     abc
   1736     aab
   1737     aaa   
   1738 
   1739 /^(a){1,}/
   1740     bcd
   1741     abc
   1742     aab
   1743     aaa
   1744     aaaaaaaa    
   1745 
   1746 /.*\.gif/
   1747     borfle\nbib.gif\nno
   1748 
   1749 /.{0,}\.gif/
   1750     borfle\nbib.gif\nno
   1751 
   1752 /.*\.gif/m
   1753     borfle\nbib.gif\nno
   1754 
   1755 /.*\.gif/s
   1756     borfle\nbib.gif\nno
   1757 
   1758 /.*\.gif/ms
   1759     borfle\nbib.gif\nno
   1760     
   1761 /.*$/
   1762     borfle\nbib.gif\nno
   1763 
   1764 /.*$/m
   1765     borfle\nbib.gif\nno
   1766 
   1767 /.*$/s
   1768     borfle\nbib.gif\nno
   1769 
   1770 /.*$/ms
   1771     borfle\nbib.gif\nno
   1772     
   1773 /.*$/
   1774     borfle\nbib.gif\nno\n
   1775 
   1776 /.*$/m
   1777     borfle\nbib.gif\nno\n
   1778 
   1779 /.*$/s
   1780     borfle\nbib.gif\nno\n
   1781 
   1782 /.*$/ms
   1783     borfle\nbib.gif\nno\n
   1784     
   1785 /(.*X|^B)/
   1786     abcde\n1234Xyz
   1787     BarFoo 
   1788     *** Failers
   1789     abcde\nBar  
   1790 
   1791 /(.*X|^B)/m
   1792     abcde\n1234Xyz
   1793     BarFoo 
   1794     abcde\nBar  
   1795 
   1796 /(.*X|^B)/s
   1797     abcde\n1234Xyz
   1798     BarFoo 
   1799     *** Failers
   1800     abcde\nBar  
   1801 
   1802 /(.*X|^B)/ms
   1803     abcde\n1234Xyz
   1804     BarFoo 
   1805     abcde\nBar  
   1806 
   1807 /(?s)(.*X|^B)/
   1808     abcde\n1234Xyz
   1809     BarFoo 
   1810     *** Failers 
   1811     abcde\nBar  
   1812 
   1813 /(?s:.*X|^B)/
   1814     abcde\n1234Xyz
   1815     BarFoo 
   1816     *** Failers 
   1817     abcde\nBar  
   1818 
   1819 /^.*B/
   1820     **** Failers
   1821     abc\nB
   1822      
   1823 /(?s)^.*B/
   1824     abc\nB
   1825 
   1826 /(?m)^.*B/
   1827     abc\nB
   1828      
   1829 /(?ms)^.*B/
   1830     abc\nB
   1831 
   1832 /(?ms)^B/
   1833     abc\nB
   1834 
   1835 /(?s)B$/
   1836     B\n
   1837 
   1838 /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
   1839     123456654321
   1840   
   1841 /^\d\d\d\d\d\d\d\d\d\d\d\d/
   1842     123456654321 
   1843 
   1844 /^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
   1845     123456654321
   1846   
   1847 /^[abc]{12}/
   1848     abcabcabcabc
   1849     
   1850 /^[a-c]{12}/
   1851     abcabcabcabc
   1852     
   1853 /^(a|b|c){12}/
   1854     abcabcabcabc 
   1855 
   1856 /^[abcdefghijklmnopqrstuvwxy0123456789]/
   1857     n
   1858     *** Failers 
   1859     z 
   1860 
   1861 /abcde{0,0}/
   1862     abcd
   1863     *** Failers
   1864     abce  
   1865 
   1866 /ab[cd]{0,0}e/
   1867     abe
   1868     *** Failers
   1869     abcde 
   1870     
   1871 /ab(c){0,0}d/
   1872     abd
   1873     *** Failers
   1874     abcd   
   1875 
   1876 /a(b*)/
   1877     a
   1878     ab
   1879     abbbb
   1880     *** Failers
   1881     bbbbb    
   1882     
   1883 /ab\d{0}e/
   1884     abe
   1885     *** Failers
   1886     ab1e   
   1887     
   1888 /"([^\\"]+|\\.)*"/
   1889     the \"quick\" brown fox
   1890     \"the \\\"quick\\\" brown fox\" 
   1891 
   1892 /.*?/g+
   1893     abc
   1894   
   1895 /\b/g+
   1896     abc 
   1897 
   1898 /\b/+g
   1899     abc 
   1900 
   1901 //g
   1902     abc
   1903 
   1904 /<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
   1905   <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>
   1906 
   1907 /a[^a]b/
   1908     acb
   1909     a\nb
   1910     
   1911 /a.b/
   1912     acb
   1913     *** Failers 
   1914     a\nb   
   1915     
   1916 /a[^a]b/s
   1917     acb
   1918     a\nb  
   1919     
   1920 /a.b/s
   1921     acb
   1922     a\nb  
   1923 
   1924 /^(b+?|a){1,2}?c/
   1925     bac
   1926     bbac
   1927     bbbac
   1928     bbbbac
   1929     bbbbbac 
   1930 
   1931 /^(b+|a){1,2}?c/
   1932     bac
   1933     bbac
   1934     bbbac
   1935     bbbbac
   1936     bbbbbac 
   1937     
   1938 /(?!\A)x/m
   1939     x\nb\n
   1940     a\bx\n  
   1941     
   1942 /\x0{ab}/
   1943     \0{ab} 
   1944 
   1945 /(A|B)*?CD/
   1946     CD 
   1947     
   1948 /(A|B)*CD/
   1949     CD 
   1950 
   1951 /(AB)*?\1/
   1952     ABABAB
   1953 
   1954 /(AB)*\1/
   1955     ABABAB
   1956     
   1957 /(?<!bar)foo/
   1958     foo
   1959     catfood
   1960     arfootle
   1961     rfoosh
   1962     *** Failers
   1963     barfoo
   1964     towbarfoo
   1965 
   1966 /\w{3}(?<!bar)foo/
   1967     catfood
   1968     *** Failers
   1969     foo
   1970     barfoo
   1971     towbarfoo
   1972 
   1973 /(?<=(foo)a)bar/
   1974     fooabar
   1975     *** Failers
   1976     bar
   1977     foobbar
   1978       
   1979 /\Aabc\z/m
   1980     abc
   1981     *** Failers
   1982     abc\n   
   1983     qqq\nabc
   1984     abc\nzzz
   1985     qqq\nabc\nzzz
   1986 
   1987 "(?>.*/)foo"
   1988     /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
   1989 
   1990 "(?>.*/)foo"
   1991     /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
   1992 
   1993 /(?>(\.\d\d[1-9]?))\d+/
   1994     1.230003938
   1995     1.875000282
   1996     *** Failers 
   1997     1.235 
   1998 
   1999 /^((?>\w+)|(?>\s+))*$/
   2000     now is the time for all good men to come to the aid of the party
   2001     *** Failers
   2002     this is not a line with only words and spaces!
   2003     
   2004 /(\d+)(\w)/
   2005     12345a
   2006     12345+ 
   2007 
   2008 /((?>\d+))(\w)/
   2009     12345a
   2010     *** Failers
   2011     12345+ 
   2012 
   2013 /(?>a+)b/
   2014     aaab
   2015 
   2016 /((?>a+)b)/
   2017     aaab
   2018 
   2019 /(?>(a+))b/
   2020     aaab
   2021 
   2022 /(?>b)+/
   2023     aaabbbccc
   2024 
   2025 /(?>a+|b+|c+)*c/
   2026     aaabbbbccccd
   2027 
   2028 /((?>[^()]+)|\([^()]*\))+/
   2029     ((abc(ade)ufh()()x
   2030     
   2031 /\(((?>[^()]+)|\([^()]+\))+\)/ 
   2032     (abc)
   2033     (abc(def)xyz)
   2034     *** Failers
   2035     ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa   
   2036 
   2037 /a(?-i)b/i
   2038     ab
   2039     Ab
   2040     *** Failers 
   2041     aB
   2042     AB
   2043         
   2044 /(a (?x)b c)d e/
   2045     a bcd e
   2046     *** Failers
   2047     a b cd e
   2048     abcd e   
   2049     a bcde 
   2050  
   2051 /(a b(?x)c d (?-x)e f)/
   2052     a bcde f
   2053     *** Failers
   2054     abcdef  
   2055 
   2056 /(a(?i)b)c/
   2057     abc
   2058     aBc
   2059     *** Failers
   2060     abC
   2061     aBC  
   2062     Abc
   2063     ABc
   2064     ABC
   2065     AbC
   2066     
   2067 /a(?i:b)c/
   2068     abc
   2069     aBc
   2070     *** Failers 
   2071     ABC
   2072     abC
   2073     aBC
   2074     
   2075 /a(?i:b)*c/
   2076     aBc
   2077     aBBc
   2078     *** Failers 
   2079     aBC
   2080     aBBC
   2081     
   2082 /a(?=b(?i)c)\w\wd/
   2083     abcd
   2084     abCd
   2085     *** Failers
   2086     aBCd
   2087     abcD     
   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 /(?:(?s-i)more.*than).*million/i
   2098     more than million
   2099     more than MILLION
   2100     more \n than Million 
   2101     *** Failers
   2102     MORE THAN MILLION    
   2103     more \n than \n million 
   2104     
   2105 /(?>a(?i)b+)+c/ 
   2106     abc
   2107     aBbc
   2108     aBBc 
   2109     *** Failers
   2110     Abc
   2111     abAb    
   2112     abbC 
   2113     
   2114 /(?=a(?i)b)\w\wc/
   2115     abc
   2116     aBc
   2117     *** Failers
   2118     Ab 
   2119     abC
   2120     aBC     
   2121     
   2122 /(?<=a(?i)b)(\w\w)c/
   2123     abxxc
   2124     aBxxc
   2125     *** Failers
   2126     Abxxc
   2127     ABxxc
   2128     abxxC      
   2129 
   2130 /(?:(a)|b)(?(1)A|B)/
   2131     aA
   2132     bB
   2133     *** Failers
   2134     aB
   2135     bA    
   2136 
   2137 /^(a)?(?(1)a|b)+$/
   2138     aa
   2139     b
   2140     bb  
   2141     *** Failers
   2142     ab   
   2143 
   2144 /^(?(?=abc)\w{3}:|\d\d)$/
   2145     abc:
   2146     12
   2147     *** Failers
   2148     123
   2149     xyz    
   2150 
   2151 /^(?(?!abc)\d\d|\w{3}:)$/
   2152     abc:
   2153     12
   2154     *** Failers
   2155     123
   2156     xyz    
   2157     
   2158 /(?(?<=foo)bar|cat)/
   2159     foobar
   2160     cat
   2161     fcat
   2162     focat   
   2163     *** Failers
   2164     foocat  
   2165 
   2166 /(?(?<!foo)cat|bar)/
   2167     foobar
   2168     cat
   2169     fcat
   2170     focat   
   2171     *** Failers
   2172     foocat  
   2173 
   2174 /( \( )? [^()]+ (?(1) \) |) /x
   2175     abcd
   2176     (abcd)
   2177     the quick (abcd) fox
   2178     (abcd   
   2179 
   2180 /( \( )? [^()]+ (?(1) \) ) /x
   2181     abcd
   2182     (abcd)
   2183     the quick (abcd) fox
   2184     (abcd   
   2185 
   2186 /^(?(2)a|(1)(2))+$/
   2187     12
   2188     12a
   2189     12aa
   2190     *** Failers
   2191     1234    
   2192 
   2193 /((?i)blah)\s+\1/
   2194     blah blah
   2195     BLAH BLAH
   2196     Blah Blah
   2197     blaH blaH
   2198     *** Failers
   2199     blah BLAH
   2200     Blah blah      
   2201     blaH blah 
   2202 
   2203 /((?i)blah)\s+(?i:\1)/
   2204     blah blah
   2205     BLAH BLAH
   2206     Blah Blah
   2207     blaH blaH
   2208     blah BLAH
   2209     Blah blah      
   2210     blaH blah 
   2211 
   2212 /(?>a*)*/
   2213     a
   2214     aa
   2215     aaaa
   2216     
   2217 /(abc|)+/
   2218     abc
   2219     abcabc
   2220     abcabcabc
   2221     xyz      
   2222 
   2223 /([a]*)*/
   2224     a
   2225     aaaaa 
   2226  
   2227 /([ab]*)*/
   2228     a
   2229     b
   2230     ababab
   2231     aaaabcde
   2232     bbbb    
   2233  
   2234 /([^a]*)*/
   2235     b
   2236     bbbb
   2237     aaa   
   2238  
   2239 /([^ab]*)*/
   2240     cccc
   2241     abab  
   2242  
   2243 /([a]*?)*/
   2244     a
   2245     aaaa 
   2246  
   2247 /([ab]*?)*/
   2248     a
   2249     b
   2250     abab
   2251     baba   
   2252  
   2253 /([^a]*?)*/
   2254     b
   2255     bbbb
   2256     aaa   
   2257  
   2258 /([^ab]*?)*/
   2259     c
   2260     cccc
   2261     baba   
   2262  
   2263 /(?>a*)*/
   2264     a
   2265     aaabcde 
   2266  
   2267 /((?>a*))*/
   2268     aaaaa
   2269     aabbaa 
   2270  
   2271 /((?>a*?))*/
   2272     aaaaa
   2273     aabbaa 
   2274 
   2275 /(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
   2276     12-sep-98
   2277     12-09-98
   2278     *** Failers
   2279     sep-12-98
   2280         
   2281 /(?<=(foo))bar\1/
   2282     foobarfoo
   2283     foobarfootling 
   2284     *** Failers
   2285     foobar
   2286     barfoo   
   2287 
   2288 /(?i:saturday|sunday)/
   2289     saturday
   2290     sunday
   2291     Saturday
   2292     Sunday
   2293     SATURDAY
   2294     SUNDAY
   2295     SunDay
   2296     
   2297 /(a(?i)bc|BB)x/
   2298     abcx
   2299     aBCx
   2300     bbx
   2301     BBx
   2302     *** Failers
   2303     abcX
   2304     aBCX
   2305     bbX
   2306     BBX               
   2307 
   2308 /^([ab](?i)[cd]|[ef])/
   2309     ac
   2310     aC
   2311     bD
   2312     elephant
   2313     Europe 
   2314     frog
   2315     France
   2316     *** Failers
   2317     Africa     
   2318 
   2319 /^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
   2320     ab
   2321     aBd
   2322     xy
   2323     xY
   2324     zebra
   2325     Zambesi
   2326     *** Failers
   2327     aCD  
   2328     XY  
   2329 
   2330 /(?<=foo\n)^bar/m
   2331     foo\nbar
   2332     *** Failers
   2333     bar
   2334     baz\nbar   
   2335 
   2336 /(?<=(?<!foo)bar)baz/
   2337     barbaz
   2338     barbarbaz 
   2339     koobarbaz 
   2340     *** Failers
   2341     baz
   2342     foobarbaz 
   2343 
   2344 /The cases of aaaa and aaaaaa are missed out below because Perl does things/
   2345 /differently. We know that odd, and maybe incorrect, things happen with/
   2346 /recursive references in Perl, as far as 5.11.3 - see some stuff in test #2./
   2347 
   2348 /^(a\1?){4}$/
   2349     a
   2350     aa
   2351     aaa
   2352     aaaaa
   2353     aaaaaaa
   2354     aaaaaaaa
   2355     aaaaaaaaa
   2356     aaaaaaaaaa
   2357     aaaaaaaaaaa
   2358     aaaaaaaaaaaa
   2359     aaaaaaaaaaaaa
   2360     aaaaaaaaaaaaaa
   2361     aaaaaaaaaaaaaaa
   2362     aaaaaaaaaaaaaaaa               
   2363 
   2364 /^(a\1?)(a\1?)(a\2?)(a\3?)$/
   2365     a
   2366     aa
   2367     aaa
   2368     aaaa
   2369     aaaaa
   2370     aaaaaa
   2371     aaaaaaa
   2372     aaaaaaaa
   2373     aaaaaaaaa
   2374     aaaaaaaaaa
   2375     aaaaaaaaaaa
   2376     aaaaaaaaaaaa
   2377     aaaaaaaaaaaaa
   2378     aaaaaaaaaaaaaa
   2379     aaaaaaaaaaaaaaa
   2380     aaaaaaaaaaaaaaaa               
   2381 
   2382 /The following tests are taken from the Perl 5.005 test suite; some of them/
   2383 /are compatible with 5.004, but I'd rather not have to sort them out./
   2384 
   2385 /abc/
   2386     abc
   2387     xabcy
   2388     ababc
   2389     *** Failers
   2390     xbc
   2391     axc
   2392     abx
   2393 
   2394 /ab*c/
   2395     abc
   2396 
   2397 /ab*bc/
   2398     abc
   2399     abbc
   2400     abbbbc
   2401 
   2402 /.{1}/
   2403     abbbbc
   2404 
   2405 /.{3,4}/
   2406     abbbbc
   2407 
   2408 /ab{0,}bc/
   2409     abbbbc
   2410 
   2411 /ab+bc/
   2412     abbc
   2413     *** Failers
   2414     abc
   2415     abq
   2416 
   2417 /ab{1,}bc/
   2418 
   2419 /ab+bc/
   2420     abbbbc
   2421 
   2422 /ab{1,}bc/
   2423     abbbbc
   2424 
   2425 /ab{1,3}bc/
   2426     abbbbc
   2427 
   2428 /ab{3,4}bc/
   2429     abbbbc
   2430 
   2431 /ab{4,5}bc/
   2432     *** Failers
   2433     abq
   2434     abbbbc
   2435 
   2436 /ab?bc/
   2437     abbc
   2438     abc
   2439 
   2440 /ab{0,1}bc/
   2441     abc
   2442 
   2443 /ab?bc/
   2444 
   2445 /ab?c/
   2446     abc
   2447 
   2448 /ab{0,1}c/
   2449     abc
   2450 
   2451 /^abc$/
   2452     abc
   2453     *** Failers
   2454     abbbbc
   2455     abcc
   2456 
   2457 /^abc/
   2458     abcc
   2459 
   2460 /^abc$/
   2461 
   2462 /abc$/
   2463     aabc
   2464     *** Failers
   2465     aabc
   2466     aabcd
   2467 
   2468 /^/
   2469     abc
   2470 
   2471 /$/
   2472     abc
   2473 
   2474 /a.c/
   2475     abc
   2476     axc
   2477 
   2478 /a.*c/
   2479     axyzc
   2480 
   2481 /a[bc]d/
   2482     abd
   2483     *** Failers
   2484     axyzd
   2485     abc
   2486 
   2487 /a[b-d]e/
   2488     ace
   2489 
   2490 /a[b-d]/
   2491     aac
   2492 
   2493 /a[-b]/
   2494     a-
   2495 
   2496 /a[b-]/
   2497     a-
   2498 
   2499 /a]/
   2500     a]
   2501 
   2502 /a[]]b/
   2503     a]b
   2504 
   2505 /a[^bc]d/
   2506     aed
   2507     *** Failers
   2508     abd
   2509     abd
   2510 
   2511 /a[^-b]c/
   2512     adc
   2513 
   2514 /a[^]b]c/
   2515     adc
   2516     *** Failers
   2517     a-c
   2518     a]c
   2519 
   2520 /\ba\b/
   2521     a-
   2522     -a
   2523     -a-
   2524 
   2525 /\by\b/
   2526     *** Failers
   2527     xy
   2528     yz
   2529     xyz
   2530 
   2531 /\Ba\B/
   2532     *** Failers
   2533     a-
   2534     -a
   2535     -a-
   2536 
   2537 /\By\b/
   2538     xy
   2539 
   2540 /\by\B/
   2541     yz
   2542 
   2543 /\By\B/
   2544     xyz
   2545 
   2546 /\w/
   2547     a
   2548 
   2549 /\W/
   2550     -
   2551     *** Failers
   2552     -
   2553     a
   2554 
   2555 /a\sb/
   2556     a b
   2557 
   2558 /a\Sb/
   2559     a-b
   2560     *** Failers
   2561     a-b
   2562     a b
   2563 
   2564 /\d/
   2565     1
   2566 
   2567 /\D/
   2568     -
   2569     *** Failers
   2570     -
   2571     1
   2572 
   2573 /[\w]/
   2574     a
   2575 
   2576 /[\W]/
   2577     -
   2578     *** Failers
   2579     -
   2580     a
   2581 
   2582 /a[\s]b/
   2583     a b
   2584 
   2585 /a[\S]b/
   2586     a-b
   2587     *** Failers
   2588     a-b
   2589     a b
   2590 
   2591 /[\d]/
   2592     1
   2593 
   2594 /[\D]/
   2595     -
   2596     *** Failers
   2597     -
   2598     1
   2599 
   2600 /ab|cd/
   2601     abc
   2602     abcd
   2603 
   2604 /()ef/
   2605     def
   2606 
   2607 /$b/
   2608 
   2609 /a\(b/
   2610     a(b
   2611 
   2612 /a\(*b/
   2613     ab
   2614     a((b
   2615 
   2616 /a\\b/
   2617     a\b
   2618 
   2619 /((a))/
   2620     abc
   2621 
   2622 /(a)b(c)/
   2623     abc
   2624 
   2625 /a+b+c/
   2626     aabbabc
   2627 
   2628 /a{1,}b{1,}c/
   2629     aabbabc
   2630 
   2631 /a.+?c/
   2632     abcabc
   2633 
   2634 /(a+|b)*/
   2635     ab
   2636 
   2637 /(a+|b){0,}/
   2638     ab
   2639 
   2640 /(a+|b)+/
   2641     ab
   2642 
   2643 /(a+|b){1,}/
   2644     ab
   2645 
   2646 /(a+|b)?/
   2647     ab
   2648 
   2649 /(a+|b){0,1}/
   2650     ab
   2651 
   2652 /[^ab]*/
   2653     cde
   2654 
   2655 /abc/
   2656     *** Failers
   2657     b
   2658     
   2659 
   2660 /a*/
   2661     
   2662 
   2663 /([abc])*d/
   2664     abbbcd
   2665 
   2666 /([abc])*bcd/
   2667     abcd
   2668 
   2669 /a|b|c|d|e/
   2670     e
   2671 
   2672 /(a|b|c|d|e)f/
   2673     ef
   2674 
   2675 /abcd*efg/
   2676     abcdefg
   2677 
   2678 /ab*/
   2679     xabyabbbz
   2680     xayabbbz
   2681 
   2682 /(ab|cd)e/
   2683     abcde
   2684 
   2685 /[abhgefdc]ij/
   2686     hij
   2687 
   2688 /^(ab|cd)e/
   2689 
   2690 /(abc|)ef/
   2691     abcdef
   2692 
   2693 /(a|b)c*d/
   2694     abcd
   2695 
   2696 /(ab|ab*)bc/
   2697     abc
   2698 
   2699 /a([bc]*)c*/
   2700     abc
   2701 
   2702 /a([bc]*)(c*d)/
   2703     abcd
   2704 
   2705 /a([bc]+)(c*d)/
   2706     abcd
   2707 
   2708 /a([bc]*)(c+d)/
   2709     abcd
   2710 
   2711 /a[bcd]*dcdcde/
   2712     adcdcde
   2713 
   2714 /a[bcd]+dcdcde/
   2715     *** Failers
   2716     abcde
   2717     adcdcde
   2718 
   2719 /(ab|a)b*c/
   2720     abc
   2721 
   2722 /((a)(b)c)(d)/
   2723     abcd
   2724 
   2725 /[a-zA-Z_][a-zA-Z0-9_]*/
   2726     alpha
   2727 
   2728 /^a(bc+|b[eh])g|.h$/
   2729     abh
   2730 
   2731 /(bc+d$|ef*g.|h?i(j|k))/
   2732     effgz
   2733     ij
   2734     reffgz
   2735     *** Failers
   2736     effg
   2737     bcdd
   2738 
   2739 /((((((((((a))))))))))/
   2740     a
   2741 
   2742 /((((((((((a))))))))))\10/
   2743     aa
   2744 
   2745 /(((((((((a)))))))))/
   2746     a
   2747 
   2748 /multiple words of text/
   2749     *** Failers
   2750     aa
   2751     uh-uh
   2752 
   2753 /multiple words/
   2754     multiple words, yeah
   2755 
   2756 /(.*)c(.*)/
   2757     abcde
   2758 
   2759 /\((.*), (.*)\)/
   2760     (a, b)
   2761 
   2762 /[k]/
   2763 
   2764 /abcd/
   2765     abcd
   2766 
   2767 /a(bc)d/
   2768     abcd
   2769 
   2770 /a[-]?c/
   2771     ac
   2772 
   2773 /(abc)\1/
   2774     abcabc
   2775 
   2776 /([a-c]*)\1/
   2777     abcabc
   2778 
   2779 /(a)|\1/
   2780     a
   2781     *** Failers
   2782     ab
   2783     x
   2784 
   2785 /(([a-c])b*?\2)*/
   2786     ababbbcbc
   2787 
   2788 /(([a-c])b*?\2){3}/
   2789     ababbbcbc
   2790 
   2791 /((\3|b)\2(a)x)+/
   2792     aaaxabaxbaaxbbax
   2793 
   2794 /((\3|b)\2(a)){2,}/
   2795     bbaababbabaaaaabbaaaabba
   2796 
   2797 /abc/i
   2798     ABC
   2799     XABCY
   2800     ABABC
   2801     *** Failers
   2802     aaxabxbaxbbx
   2803     XBC
   2804     AXC
   2805     ABX
   2806 
   2807 /ab*c/i
   2808     ABC
   2809 
   2810 /ab*bc/i
   2811     ABC
   2812     ABBC
   2813 
   2814 /ab*?bc/i
   2815     ABBBBC
   2816 
   2817 /ab{0,}?bc/i
   2818     ABBBBC
   2819 
   2820 /ab+?bc/i
   2821     ABBC
   2822 
   2823 /ab+bc/i
   2824     *** Failers
   2825     ABC
   2826     ABQ
   2827 
   2828 /ab{1,}bc/i
   2829 
   2830 /ab+bc/i
   2831     ABBBBC
   2832 
   2833 /ab{1,}?bc/i
   2834     ABBBBC
   2835 
   2836 /ab{1,3}?bc/i
   2837     ABBBBC
   2838 
   2839 /ab{3,4}?bc/i
   2840     ABBBBC
   2841 
   2842 /ab{4,5}?bc/i
   2843     *** Failers
   2844     ABQ
   2845     ABBBBC
   2846 
   2847 /ab??bc/i
   2848     ABBC
   2849     ABC
   2850 
   2851 /ab{0,1}?bc/i
   2852     ABC
   2853 
   2854 /ab??bc/i
   2855 
   2856 /ab??c/i
   2857     ABC
   2858 
   2859 /ab{0,1}?c/i
   2860     ABC
   2861 
   2862 /^abc$/i
   2863     ABC
   2864     *** Failers
   2865     ABBBBC
   2866     ABCC
   2867 
   2868 /^abc/i
   2869     ABCC
   2870 
   2871 /^abc$/i
   2872 
   2873 /abc$/i
   2874     AABC
   2875 
   2876 /^/i
   2877     ABC
   2878 
   2879 /$/i
   2880     ABC
   2881 
   2882 /a.c/i
   2883     ABC
   2884     AXC
   2885 
   2886 /a.*?c/i
   2887     AXYZC
   2888 
   2889 /a.*c/i
   2890     *** Failers
   2891     AABC
   2892     AXYZD
   2893 
   2894 /a[bc]d/i
   2895     ABD
   2896 
   2897 /a[b-d]e/i
   2898     ACE
   2899     *** Failers
   2900     ABC
   2901     ABD
   2902 
   2903 /a[b-d]/i
   2904     AAC
   2905 
   2906 /a[-b]/i
   2907     A-
   2908 
   2909 /a[b-]/i
   2910     A-
   2911 
   2912 /a]/i
   2913     A]
   2914 
   2915 /a[]]b/i
   2916     A]B
   2917 
   2918 /a[^bc]d/i
   2919     AED
   2920 
   2921 /a[^-b]c/i
   2922     ADC
   2923     *** Failers
   2924     ABD
   2925     A-C
   2926 
   2927 /a[^]b]c/i
   2928     ADC
   2929 
   2930 /ab|cd/i
   2931     ABC
   2932     ABCD
   2933 
   2934 /()ef/i
   2935     DEF
   2936 
   2937 /$b/i
   2938     *** Failers
   2939     A]C
   2940     B
   2941 
   2942 /a\(b/i
   2943     A(B
   2944 
   2945 /a\(*b/i
   2946     AB
   2947     A((B
   2948 
   2949 /a\\b/i
   2950     A\B
   2951 
   2952 /((a))/i
   2953     ABC
   2954 
   2955 /(a)b(c)/i
   2956     ABC
   2957 
   2958 /a+b+c/i
   2959     AABBABC
   2960 
   2961 /a{1,}b{1,}c/i
   2962     AABBABC
   2963 
   2964 /a.+?c/i
   2965     ABCABC
   2966 
   2967 /a.*?c/i
   2968     ABCABC
   2969 
   2970 /a.{0,5}?c/i
   2971     ABCABC
   2972 
   2973 /(a+|b)*/i
   2974     AB
   2975 
   2976 /(a+|b){0,}/i
   2977     AB
   2978 
   2979 /(a+|b)+/i
   2980     AB
   2981 
   2982 /(a+|b){1,}/i
   2983     AB
   2984 
   2985 /(a+|b)?/i
   2986     AB
   2987 
   2988 /(a+|b){0,1}/i
   2989     AB
   2990 
   2991 /(a+|b){0,1}?/i
   2992     AB
   2993 
   2994 /[^ab]*/i
   2995     CDE
   2996 
   2997 /abc/i
   2998 
   2999 /a*/i
   3000     
   3001 
   3002 /([abc])*d/i
   3003     ABBBCD
   3004 
   3005 /([abc])*bcd/i
   3006     ABCD
   3007 
   3008 /a|b|c|d|e/i
   3009     E
   3010 
   3011 /(a|b|c|d|e)f/i
   3012     EF
   3013 
   3014 /abcd*efg/i
   3015     ABCDEFG
   3016 
   3017 /ab*/i
   3018     XABYABBBZ
   3019     XAYABBBZ
   3020 
   3021 /(ab|cd)e/i
   3022     ABCDE
   3023 
   3024 /[abhgefdc]ij/i
   3025     HIJ
   3026 
   3027 /^(ab|cd)e/i
   3028     ABCDE
   3029 
   3030 /(abc|)ef/i
   3031     ABCDEF
   3032 
   3033 /(a|b)c*d/i
   3034     ABCD
   3035 
   3036 /(ab|ab*)bc/i
   3037     ABC
   3038 
   3039 /a([bc]*)c*/i
   3040     ABC
   3041 
   3042 /a([bc]*)(c*d)/i
   3043     ABCD
   3044 
   3045 /a([bc]+)(c*d)/i
   3046     ABCD
   3047 
   3048 /a([bc]*)(c+d)/i
   3049     ABCD
   3050 
   3051 /a[bcd]*dcdcde/i
   3052     ADCDCDE
   3053 
   3054 /a[bcd]+dcdcde/i
   3055 
   3056 /(ab|a)b*c/i
   3057     ABC
   3058 
   3059 /((a)(b)c)(d)/i
   3060     ABCD
   3061 
   3062 /[a-zA-Z_][a-zA-Z0-9_]*/i
   3063     ALPHA
   3064 
   3065 /^a(bc+|b[eh])g|.h$/i
   3066     ABH
   3067 
   3068 /(bc+d$|ef*g.|h?i(j|k))/i
   3069     EFFGZ
   3070     IJ
   3071     REFFGZ
   3072     *** Failers
   3073     ADCDCDE
   3074     EFFG
   3075     BCDD
   3076 
   3077 /((((((((((a))))))))))/i
   3078     A
   3079 
   3080 /((((((((((a))))))))))\10/i
   3081     AA
   3082 
   3083 /(((((((((a)))))))))/i
   3084     A
   3085 
   3086 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
   3087     A
   3088 
   3089 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
   3090     C
   3091 
   3092 /multiple words of text/i
   3093     *** Failers
   3094     AA
   3095     UH-UH
   3096 
   3097 /multiple words/i
   3098     MULTIPLE WORDS, YEAH
   3099 
   3100 /(.*)c(.*)/i
   3101     ABCDE
   3102 
   3103 /\((.*), (.*)\)/i
   3104     (A, B)
   3105 
   3106 /[k]/i
   3107 
   3108 /abcd/i
   3109     ABCD
   3110 
   3111 /a(bc)d/i
   3112     ABCD
   3113 
   3114 /a[-]?c/i
   3115     AC
   3116 
   3117 /(abc)\1/i
   3118     ABCABC
   3119 
   3120 /([a-c]*)\1/i
   3121     ABCABC
   3122 
   3123 /a(?!b)./
   3124     abad
   3125 
   3126 /a(?=d)./
   3127     abad
   3128 
   3129 /a(?=c|d)./
   3130     abad
   3131 
   3132 /a(?:b|c|d)(.)/
   3133     ace
   3134 
   3135 /a(?:b|c|d)*(.)/
   3136     ace
   3137 
   3138 /a(?:b|c|d)+?(.)/
   3139     ace
   3140     acdbcdbe
   3141 
   3142 /a(?:b|c|d)+(.)/
   3143     acdbcdbe
   3144 
   3145 /a(?:b|c|d){2}(.)/
   3146     acdbcdbe
   3147 
   3148 /a(?:b|c|d){4,5}(.)/
   3149     acdbcdbe
   3150 
   3151 /a(?:b|c|d){4,5}?(.)/
   3152     acdbcdbe
   3153 
   3154 /((foo)|(bar))*/
   3155     foobar
   3156 
   3157 /a(?:b|c|d){6,7}(.)/
   3158     acdbcdbe
   3159 
   3160 /a(?:b|c|d){6,7}?(.)/
   3161     acdbcdbe
   3162 
   3163 /a(?:b|c|d){5,6}(.)/
   3164     acdbcdbe
   3165 
   3166 /a(?:b|c|d){5,6}?(.)/
   3167     acdbcdbe
   3168 
   3169 /a(?:b|c|d){5,7}(.)/
   3170     acdbcdbe
   3171 
   3172 /a(?:b|c|d){5,7}?(.)/
   3173     acdbcdbe
   3174 
   3175 /a(?:b|(c|e){1,2}?|d)+?(.)/
   3176     ace
   3177 
   3178 /^(.+)?B/
   3179     AB
   3180 
   3181 /^([^a-z])|(\^)$/
   3182     .
   3183 
   3184 /^[<>]&/
   3185     <&OUT
   3186 
   3187 /^(a\1?){4}$/
   3188     aaaaaaaaaa
   3189     *** Failers
   3190     AB
   3191     aaaaaaaaa
   3192     aaaaaaaaaaa
   3193 
   3194 /^(a(?(1)\1)){4}$/
   3195     aaaaaaaaaa
   3196     *** Failers
   3197     aaaaaaaaa
   3198     aaaaaaaaaaa
   3199 
   3200 /(?:(f)(o)(o)|(b)(a)(r))*/
   3201     foobar
   3202 
   3203 /(?<=a)b/
   3204     ab
   3205     *** Failers
   3206     cb
   3207     b
   3208 
   3209 /(?<!c)b/
   3210     ab
   3211     b
   3212     b
   3213 
   3214 /(?:..)*a/
   3215     aba
   3216 
   3217 /(?:..)*?a/
   3218     aba
   3219 
   3220 /^(?:b|a(?=(.)))*\1/
   3221     abc
   3222 
   3223 /^(){3,5}/
   3224     abc
   3225 
   3226 /^(a+)*ax/
   3227     aax
   3228 
   3229 /^((a|b)+)*ax/
   3230     aax
   3231 
   3232 /^((a|bc)+)*ax/
   3233     aax
   3234 
   3235 /(a|x)*ab/
   3236     cab
   3237 
   3238 /(a)*ab/
   3239     cab
   3240 
   3241 /(?:(?i)a)b/
   3242     ab
   3243 
   3244 /((?i)a)b/
   3245     ab
   3246 
   3247 /(?:(?i)a)b/
   3248     Ab
   3249 
   3250 /((?i)a)b/
   3251     Ab
   3252 
   3253 /(?:(?i)a)b/
   3254     *** Failers
   3255     cb
   3256     aB
   3257 
   3258 /((?i)a)b/
   3259 
   3260 /(?i:a)b/
   3261     ab
   3262 
   3263 /((?i:a))b/
   3264     ab
   3265 
   3266 /(?i:a)b/
   3267     Ab
   3268 
   3269 /((?i:a))b/
   3270     Ab
   3271 
   3272 /(?i:a)b/
   3273     *** Failers
   3274     aB
   3275     aB
   3276 
   3277 /((?i:a))b/
   3278 
   3279 /(?:(?-i)a)b/i
   3280     ab
   3281 
   3282 /((?-i)a)b/i
   3283     ab
   3284 
   3285 /(?:(?-i)a)b/i
   3286     aB
   3287 
   3288 /((?-i)a)b/i
   3289     aB
   3290 
   3291 /(?:(?-i)a)b/i
   3292     *** Failers
   3293     aB
   3294     Ab
   3295 
   3296 /((?-i)a)b/i
   3297 
   3298 /(?:(?-i)a)b/i
   3299     aB
   3300 
   3301 /((?-i)a)b/i
   3302     aB
   3303 
   3304 /(?:(?-i)a)b/i
   3305     *** Failers
   3306     Ab
   3307     AB
   3308 
   3309 /((?-i)a)b/i
   3310 
   3311 /(?-i:a)b/i
   3312     ab
   3313 
   3314 /((?-i:a))b/i
   3315     ab
   3316 
   3317 /(?-i:a)b/i
   3318     aB
   3319 
   3320 /((?-i:a))b/i
   3321     aB
   3322 
   3323 /(?-i:a)b/i
   3324     *** Failers
   3325     AB
   3326     Ab
   3327 
   3328 /((?-i:a))b/i
   3329 
   3330 /(?-i:a)b/i
   3331     aB
   3332 
   3333 /((?-i:a))b/i
   3334     aB
   3335 
   3336 /(?-i:a)b/i
   3337     *** Failers
   3338     Ab
   3339     AB
   3340 
   3341 /((?-i:a))b/i
   3342 
   3343 /((?-i:a.))b/i
   3344     *** Failers
   3345     AB
   3346     a\nB
   3347 
   3348 /((?s-i:a.))b/i
   3349     a\nB
   3350 
   3351 /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
   3352     cabbbb
   3353 
   3354 /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
   3355     caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
   3356 
   3357 /(ab)\d\1/i
   3358     Ab4ab
   3359     ab4Ab
   3360 
   3361 /foo\w*\d{4}baz/
   3362     foobar1234baz
   3363 
   3364 /x(~~)*(?:(?:F)?)?/
   3365     x~~
   3366 
   3367 /^a(?#xxx){3}c/
   3368     aaac
   3369 
   3370 /^a (?#xxx) (?#yyy) {3}c/x
   3371     aaac
   3372 
   3373 /(?<![cd])b/
   3374     *** Failers
   3375     B\nB
   3376     dbcb
   3377 
   3378 /(?<![cd])[ab]/
   3379     dbaacb
   3380 
   3381 /(?<!(c|d))b/
   3382 
   3383 /(?<!(c|d))[ab]/
   3384     dbaacb
   3385 
   3386 /(?<!cd)[ab]/
   3387     cdaccb
   3388 
   3389 /^(?:a?b?)*$/
   3390     \
   3391     a
   3392     ab
   3393     aaa   
   3394     *** Failers
   3395     dbcb
   3396     a--
   3397     aa-- 
   3398 
   3399 /((?s)^a(.))((?m)^b$)/
   3400     a\nb\nc\n
   3401 
   3402 /((?m)^b$)/
   3403     a\nb\nc\n
   3404 
   3405 /(?m)^b/
   3406     a\nb\n
   3407 
   3408 /(?m)^(b)/
   3409     a\nb\n
   3410 
   3411 /((?m)^b)/
   3412     a\nb\n
   3413 
   3414 /\n((?m)^b)/
   3415     a\nb\n
   3416 
   3417 /((?s).)c(?!.)/
   3418     a\nb\nc\n
   3419     a\nb\nc\n
   3420 
   3421 /((?s)b.)c(?!.)/
   3422     a\nb\nc\n
   3423     a\nb\nc\n
   3424 
   3425 /^b/
   3426 
   3427 /()^b/
   3428     *** Failers
   3429     a\nb\nc\n
   3430     a\nb\nc\n
   3431 
   3432 /((?m)^b)/
   3433     a\nb\nc\n
   3434 
   3435 /(x)?(?(1)a|b)/
   3436     *** Failers
   3437     a
   3438     a
   3439 
   3440 /(x)?(?(1)b|a)/
   3441     a
   3442 
   3443 /()?(?(1)b|a)/
   3444     a
   3445 
   3446 /()(?(1)b|a)/
   3447 
   3448 /()?(?(1)a|b)/
   3449     a
   3450 
   3451 /^(\()?blah(?(1)(\)))$/
   3452     (blah)
   3453     blah
   3454     *** Failers
   3455     a
   3456     blah)
   3457     (blah
   3458 
   3459 /^(\(+)?blah(?(1)(\)))$/
   3460     (blah)
   3461     blah
   3462     *** Failers
   3463     blah)
   3464     (blah
   3465 
   3466 /(?(?!a)a|b)/
   3467 
   3468 /(?(?!a)b|a)/
   3469     a
   3470 
   3471 /(?(?=a)b|a)/
   3472     *** Failers
   3473     a
   3474     a
   3475 
   3476 /(?(?=a)a|b)/
   3477     a
   3478 
   3479 /(?=(a+?))(\1ab)/
   3480     aaab
   3481 
   3482 /^(?=(a+?))\1ab/
   3483 
   3484 /(\w+:)+/
   3485     one:
   3486 
   3487 /$(?<=^(a))/
   3488     a
   3489 
   3490 /(?=(a+?))(\1ab)/
   3491     aaab
   3492 
   3493 /^(?=(a+?))\1ab/
   3494     *** Failers
   3495     aaab
   3496     aaab
   3497 
   3498 /([\w:]+::)?(\w+)$/
   3499     abcd
   3500     xy:z:::abcd
   3501 
   3502 /^[^bcd]*(c+)/
   3503     aexycd
   3504 
   3505 /(a*)b+/
   3506     caab
   3507 
   3508 /([\w:]+::)?(\w+)$/
   3509     abcd
   3510     xy:z:::abcd
   3511     *** Failers
   3512     abcd:
   3513     abcd:
   3514 
   3515 /^[^bcd]*(c+)/
   3516     aexycd
   3517 
   3518 /(>a+)ab/
   3519 
   3520 /(?>a+)b/
   3521     aaab
   3522 
   3523 /([[:]+)/
   3524     a:[b]:
   3525 
   3526 /([[=]+)/
   3527     a=[b]=
   3528 
   3529 /([[.]+)/
   3530     a.[b].
   3531 
   3532 /((?>a+)b)/
   3533     aaab
   3534 
   3535 /(?>(a+))b/
   3536     aaab
   3537 
   3538 /((?>[^()]+)|\([^()]*\))+/
   3539     ((abc(ade)ufh()()x
   3540 
   3541 /a\Z/
   3542     *** Failers
   3543     aaab
   3544     a\nb\n
   3545 
   3546 /b\Z/
   3547     a\nb\n
   3548 
   3549 /b\z/
   3550 
   3551 /b\Z/
   3552     a\nb
   3553 
   3554 /b\z/
   3555     a\nb
   3556     *** Failers
   3557     
   3558 /^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
   3559     a
   3560     abc
   3561     a-b
   3562     0-9 
   3563     a.b
   3564     5.6.7  
   3565     the.quick.brown.fox
   3566     a100.b200.300c  
   3567     12-ab.1245 
   3568     *** Failers
   3569     \
   3570     .a
   3571     -a
   3572     a-
   3573     a.  
   3574     a_b 
   3575     a.-
   3576     a..  
   3577     ab..bc 
   3578     the.quick.brown.fox-
   3579     the.quick.brown.fox.
   3580     the.quick.brown.fox_
   3581     the.quick.brown.fox+       
   3582 
   3583 /(?>.*)(?<=(abcd|wxyz))/
   3584     alphabetabcd
   3585     endingwxyz
   3586     *** Failers
   3587     a rather long string that doesn't end with one of them
   3588 
   3589 /word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
   3590     word cat dog elephant mussel cow horse canary baboon snake shark otherword
   3591     word cat dog elephant mussel cow horse canary baboon snake shark
   3592   
   3593 /word (?>[a-zA-Z0-9]+ ){0,30}otherword/
   3594     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
   3595 
   3596 /(?<=\d{3}(?!999))foo/
   3597     999foo
   3598     123999foo 
   3599     *** Failers
   3600     123abcfoo
   3601     
   3602 /(?<=(?!...999)\d{3})foo/
   3603     999foo
   3604     123999foo 
   3605     *** Failers
   3606     123abcfoo
   3607 
   3608 /(?<=\d{3}(?!999)...)foo/
   3609     123abcfoo
   3610     123456foo 
   3611     *** Failers
   3612     123999foo  
   3613     
   3614 /(?<=\d{3}...)(?<!999)foo/
   3615     123abcfoo   
   3616     123456foo 
   3617     *** Failers
   3618     123999foo  
   3619 
   3620 /<a[\s]+href[\s]*=[\s]*          # find <a href=
   3621  ([\"\'])?                       # find single or double quote
   3622  (?(1) (.*?)\1 | ([^\s]+))       # if quote found, match up to next matching
   3623                                  # quote, otherwise match up to next space
   3624 /isx
   3625     <a href=abcd xyz
   3626     <a href=\"abcd xyz pqr\" cats
   3627     <a href=\'abcd xyz pqr\' cats
   3628 
   3629 /<a\s+href\s*=\s*                # find <a href=
   3630  (["'])?                         # find single or double quote
   3631  (?(1) (.*?)\1 | (\S+))          # if quote found, match up to next matching
   3632                                  # quote, otherwise match up to next space
   3633 /isx
   3634     <a href=abcd xyz
   3635     <a href=\"abcd xyz pqr\" cats
   3636     <a href       =       \'abcd xyz pqr\' cats
   3637 
   3638 /<a\s+href(?>\s*)=(?>\s*)        # find <a href=
   3639  (["'])?                         # find single or double quote
   3640  (?(1) (.*?)\1 | (\S+))          # if quote found, match up to next matching
   3641                                  # quote, otherwise match up to next space
   3642 /isx
   3643     <a href=abcd xyz
   3644     <a href=\"abcd xyz pqr\" cats
   3645     <a href       =       \'abcd xyz pqr\' cats
   3646 
   3647 /((Z)+|A)*/
   3648     ZABCDEFG
   3649 
   3650 /(Z()|A)*/
   3651     ZABCDEFG
   3652 
   3653 /(Z(())|A)*/
   3654     ZABCDEFG
   3655 
   3656 /((?>Z)+|A)*/
   3657     ZABCDEFG
   3658 
   3659 /((?>)+|A)*/
   3660     ZABCDEFG
   3661 
   3662 /a*/g
   3663     abbab
   3664 
   3665 /^[\d-a]/
   3666     abcde
   3667     -things
   3668     0digit
   3669     *** Failers
   3670     bcdef    
   3671     
   3672 /[[:space:]]+/
   3673     > \x09\x0a\x0c\x0d\x0b<
   3674      
   3675 /[[:blank:]]+/
   3676     > \x09\x0a\x0c\x0d\x0b<
   3677      
   3678 /[\s]+/
   3679     > \x09\x0a\x0c\x0d\x0b<
   3680      
   3681 /\s+/
   3682     > \x09\x0a\x0c\x0d\x0b<
   3683      
   3684 /ab/x
   3686     ab
   3687 
   3688 /(?!\A)x/m
   3689   a\nxb\n
   3690 
   3691 /(?!^)x/m
   3692   a\nxb\n
   3693 
   3694 /abc\Qabc\Eabc/
   3695     abcabcabc
   3696     
   3697 /abc\Q(*+|\Eabc/
   3698     abc(*+|abc 
   3699 
   3700 /   abc\Q abc\Eabc/x
   3701     abc abcabc
   3702     *** Failers
   3703     abcabcabc  
   3704     
   3705 /abc#comment
   3706     \Q#not comment
   3707     literal\E/x
   3708     abc#not comment\n    literal     
   3709 
   3710 /abc#comment
   3711     \Q#not comment
   3712     literal/x
   3713     abc#not comment\n    literal     
   3714 
   3715 /abc#comment
   3716     \Q#not comment
   3717     literal\E #more comment
   3718     /x
   3719     abc#not comment\n    literal     
   3720 
   3721 /abc#comment
   3722     \Q#not comment
   3723     literal\E #more comment/x
   3724     abc#not comment\n    literal     
   3725 
   3726 /\Qabc\$xyz\E/
   3727     abc\\\$xyz
   3728 
   3729 /\Qabc\E\$\Qxyz\E/
   3730     abc\$xyz
   3731 
   3732 /\Gabc/
   3733     abc
   3734     *** Failers
   3735     xyzabc  
   3736 
   3737 /\Gabc./g
   3738     abc1abc2xyzabc3
   3739 
   3740 /abc./g
   3741     abc1abc2xyzabc3 
   3742 
   3743 /a(?x: b c )d/
   3744     XabcdY
   3745     *** Failers 
   3746     Xa b c d Y 
   3747 
   3748 /((?x)x y z | a b c)/
   3749     XabcY
   3750     AxyzB 
   3751 
   3752 /(?i)AB(?-i)C/
   3753     XabCY
   3754     *** Failers
   3755     XabcY  
   3756 
   3757 /((?i)AB(?-i)C|D)E/
   3758     abCE
   3759     DE
   3760     *** Failers
   3761     abcE
   3762     abCe  
   3763     dE
   3764     De    
   3765 
   3766 /(.*)\d+\1/
   3767     abc123abc
   3768     abc123bc 
   3769 
   3770 /(.*)\d+\1/s
   3771     abc123abc
   3772     abc123bc 
   3773     
   3774 /((.*))\d+\1/
   3775     abc123abc
   3776     abc123bc  
   3777 
   3778 /-- This tests for an IPv6 address in the form where it can have up to
   3779     eight components, one and only one of which is empty. This must be
   3780     an internal component. --/
   3781 
   3782 /^(?!:)                       # colon disallowed at start
   3783   (?:                         # start of item
   3784     (?: [0-9a-f]{1,4} |       # 1-4 hex digits or
   3785     (?(1)0 | () ) )           # if null previously matched, fail; else null
   3786     :                         # followed by colon
   3787   ){1,7}                      # end item; 1-7 of them required               
   3788   [0-9a-f]{1,4} $             # final hex number at end of string
   3789   (?(1)|.)                    # check that there was an empty component
   3790   /xi
   3791     a123::a123
   3792     a123:b342::abcd
   3793     a123:b342::324e:abcd
   3794     a123:ddde:b342::324e:abcd
   3795     a123:ddde:b342::324e:dcba:abcd
   3796     a123:ddde:9999:b342::324e:dcba:abcd
   3797     *** Failers
   3798     1:2:3:4:5:6:7:8
   3799     a123:bce:ddde:9999:b342::324e:dcba:abcd
   3800     a123::9999:b342::324e:dcba:abcd
   3801     abcde:2:3:4:5:6:7:8
   3802     ::1
   3803     abcd:fee0:123::   
   3804     :1
   3805     1:  
   3806 
   3807 /[z\Qa-d]\E]/
   3808     z
   3809     a
   3810     -
   3811     d
   3812     ] 
   3813     *** Failers
   3814     b     
   3815 
   3816 /[\z\C]/
   3817     z
   3818     C 
   3819     
   3820 /\M/
   3821     M 
   3822     
   3823 /(a+)*b/
   3824     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
   3825     
   3826 /(?i)reg(?:ul(?:[a]|ae)r|ex)/
   3827     REGular
   3828     regulaer
   3829     Regex  
   3830     regulr 
   3831 
   3832 /[--]+/
   3833     
   3834     
   3835     
   3836     
   3837 
   3838 /(?<=Z)X./
   3839   \x84XAZXB
   3840 
   3841 /ab cd (?x) de fg/
   3842     ab cd defg
   3843 
   3844 /ab cd(?x) de fg/
   3845     ab cddefg
   3846     ** Failers 
   3847     abcddefg
   3848 
   3849 /(?<![^f]oo)(bar)/
   3850     foobarX 
   3851     ** Failers 
   3852     boobarX
   3853 
   3854 /(?<![^f])X/
   3855     offX
   3856     ** Failers
   3857     onyX  
   3858 
   3859 /(?<=[^f])X/
   3860     onyX
   3861     ** Failers
   3862     offX 
   3863 
   3864 /^/mg
   3865     a\nb\nc\n
   3866     \ 
   3867     
   3868 /(?<=C\n)^/mg
   3869     A\nC\nC\n 
   3870 
   3871 /(?:(?(1)a|b)(X))+/
   3872     bXaX
   3873 
   3874 /(?:(?(1)\1a|b)(X|Y))+/
   3875     bXXaYYaY
   3876     bXYaXXaX  
   3877 
   3878 /()()()()()()()()()(?:(?(10)\10a|b)(X|Y))+/
   3879     bXXaYYaY
   3880 
   3881 /[[,abc,]+]/
   3882     abc]
   3883     a,b]
   3884     [a,b,c]  
   3885 
   3886 /(?-x: )/x
   3887     A\x20B
   3888     
   3889 "(?x)(?-x: \s*#\s*)"
   3890     A # B
   3891     ** Failers
   3892     #  
   3893 
   3894 "(?x-is)(?:(?-ixs) \s*#\s*) include"
   3895     A #include
   3896     ** Failers
   3897     A#include  
   3898     A #Include
   3899 
   3900 /a*b*\w/
   3901     aaabbbb
   3902     aaaa
   3903     a
   3904 
   3905 /a*b?\w/
   3906     aaabbbb
   3907     aaaa
   3908     a
   3909 
   3910 /a*b{0,4}\w/
   3911     aaabbbb
   3912     aaaa
   3913     a
   3914 
   3915 /a*b{0,}\w/
   3916     aaabbbb
   3917     aaaa
   3918     a
   3919     
   3920 /a*\d*\w/
   3921     0a
   3922     a 
   3923     
   3924 /a*b *\w/x
   3925     a 
   3926 
   3927 /a*b#comment
   3928   *\w/x
   3929     a 
   3930 
   3931 /a* b *\w/x
   3932     a 
   3933 
   3934 /^\w+=.*(\\\n.*)*/
   3935     abc=xyz\\\npqr
   3936 
   3937 /(?=(\w+))\1:/
   3938     abcd:
   3939 
   3940 /^(?=(\w+))\1:/
   3941     abcd:
   3942 
   3943 /^\Eabc/
   3944     abc
   3945     
   3946 /^[\Eabc]/
   3947     a
   3948     ** Failers 
   3949     E 
   3950     
   3951 /^[a-\Ec]/
   3952     b
   3953     ** Failers
   3954     -
   3955     E    
   3956 
   3957 /^[a\E\E-\Ec]/
   3958     b
   3959     ** Failers
   3960     -
   3961     E    
   3962 
   3963 /^[\E\Qa\E-\Qz\E]+/
   3964     b
   3965     ** Failers
   3966     -  
   3967     
   3968 /^[a\Q]bc\E]/
   3969     a
   3970     ]
   3971     c
   3972     
   3973 /^[a-\Q\E]/
   3974     a
   3975     -     
   3976 
   3977 /^(a()*)*/
   3978     aaaa
   3979 
   3980 /^(?:a(?:(?:))*)*/
   3981     aaaa
   3982 
   3983 /^(a()+)+/
   3984     aaaa
   3985 
   3986 /^(?:a(?:(?:))+)+/
   3987     aaaa
   3988 
   3989 /(a){0,3}(?(1)b|(c|))*D/
   3990     abbD
   3991     ccccD
   3992     D  
   3993 
   3994 /(a|)*\d/
   3995   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   3996   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
   3997 
   3998 /(?>a|)*\d/
   3999   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   4000   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
   4001 
   4002 /(?:a|)*\d/
   4003   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   4004   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
   4005 
   4006 /\Z/g
   4007   abc\n
   4008   
   4009 /^(?s)(?>.*)(?<!\n)/
   4010   abc
   4011   abc\n  
   4012 
   4013 /^(?![^\n]*\n\z)/
   4014   abc
   4015   abc\n 
   4016   
   4017 /\z(?<!\n)/
   4018   abc
   4019   abc\n  
   4020 
   4021 /(.*(.)?)*/
   4022     abcd
   4023 
   4024 /( (A | (?(1)0|) )*   )/x
   4025     abcd
   4026 
   4027 /( ( (?(1)0|) )*   )/x
   4028     abcd
   4029 
   4030 /(  (?(1)0|)*   )/x
   4031     abcd
   4032 
   4033 /[[:abcd:xyz]]/
   4034     a]
   4035     :] 
   4036     
   4037 /[abc[:x\]pqr]/
   4038     a
   4039     [
   4040     :
   4041     ]
   4042     p    
   4043 
   4044 /.*[op][xyz]/
   4045     fooabcfoo
   4046 
   4047 /(?(?=.*b)b|^)/
   4048    adc
   4049    abc 
   4050 
   4051 /(?(?=^.*b)b|^)/
   4052    adc
   4053    abc 
   4054 
   4055 /(?(?=.*b)b|^)*/
   4056    adc
   4057    abc 
   4058 
   4059 /(?(?=.*b)b|^)+/
   4060    adc
   4061    abc 
   4062 
   4063 /(?(?=b).*b|^d)/
   4064     abc
   4065 
   4066 /(?(?=.*b).*b|^d)/
   4067     abc
   4068 
   4069 /^%((?(?=[a])[^%])|b)*%$/
   4070     %ab%
   4071 
   4072 /(?i)a(?-i)b|c/
   4073     XabX
   4074     XAbX
   4075     CcC 
   4076     ** Failers
   4077     XABX   
   4078 
   4079 /[\x00-\xff\s]+/
   4080     \x0a\x0b\x0c\x0d
   4081 
   4082 /^\c/
   4083     ?
   4084 
   4085 /(abc)\1/i
   4086    abc
   4087 
   4088 /(abc)\1/
   4089    abc
   4090 
   4091 /[^a]*/i
   4092     12abc
   4093     12ABC
   4094 
   4095 /[^a]*+/i
   4096     12abc
   4097     12ABC
   4098 
   4099 /[^a]*?X/i
   4100     ** Failers
   4101     12abc
   4102     12ABC
   4103     
   4104 /[^a]+?X/i   
   4105     ** Failers
   4106     12abc
   4107     12ABC
   4108 
   4109 /[^a]?X/i
   4110     12aXbcX
   4111     12AXBCX
   4112     BCX 
   4113 
   4114 /[^a]??X/i
   4115     12aXbcX
   4116     12AXBCX
   4117     BCX
   4118     
   4119 /[^a]?+X/i
   4120     12aXbcX
   4121     12AXBCX
   4122     BCX 
   4123 
   4124 /[^a]{2,3}/i
   4125     abcdef
   4126     ABCDEF  
   4127 
   4128 /[^a]{2,3}?/i
   4129     abcdef
   4130     ABCDEF  
   4131 
   4132 /[^a]{2,3}+/i
   4133     abcdef
   4134     ABCDEF  
   4135 
   4136 /((a|)+)+Z/
   4137     Z
   4138 
   4139 /(a)b|(a)c/
   4140     ac
   4141 
   4142 /(?>(a))b|(a)c/
   4143     ac
   4144 
   4145 /(?=(a))ab|(a)c/
   4146     ac
   4147 
   4148 /((?>(a))b|(a)c)/
   4149     ac
   4150 
   4151 /((?>(a))b|(a)c)++/
   4152     ac
   4153 
   4154 /(?:(?>(a))b|(a)c)++/
   4155     ac
   4156 
   4157 /(?=(?>(a))b|(a)c)(..)/
   4158     ac
   4159 
   4160 /(?>(?>(a))b|(a)c)/
   4161     ac
   4162 
   4163 /(?:(?>([ab])))+a=/+
   4164     =ba=
   4165 
   4166 /(?>([ab]))+a=/+
   4167     =ba=
   4168 
   4169 /((?>(a+)b)+(aabab))/
   4170     aaaabaaabaabab
   4171 
   4172 /(?>a+|ab)+?c/
   4173     aabc
   4174 
   4175 /(?>a+|ab)+c/
   4176     aabc
   4177 
   4178 /(?:a+|ab)+c/
   4179     aabc
   4180 
   4181 /(?(?=(a))a)/
   4182     a
   4183 
   4184 /(?(?=(a))a)(b)/
   4185     ab
   4186 
   4187 /^(?:a|ab)++c/
   4188     aaaabc
   4189 
   4190 /^(?>a|ab)++c/
   4191     aaaabc
   4192 
   4193 /^(?:a|ab)+c/
   4194     aaaabc
   4195 
   4196 /(?=abc){3}abc/+
   4197     abcabcabc
   4198     ** Failers
   4199     xyz  
   4200     
   4201 /(?=abc)+abc/+
   4202     abcabcabc
   4203     ** Failers
   4204     xyz  
   4205     
   4206 /(?=abc)++abc/+
   4207     abcabcabc
   4208     ** Failers
   4209     xyz  
   4210     
   4211 /(?=abc){0}xyz/
   4212     xyz 
   4213 
   4214 /(?=abc){1}xyz/
   4215     ** Failers
   4216     xyz 
   4217     
   4218 /(?=(a))?./
   4219     ab
   4220     bc
   4221       
   4222 /(?=(a))??./
   4223     ab
   4224     bc
   4225 
   4226 /^(?=(?1))?[az]([abc])d/
   4227     abd 
   4228     zcdxx 
   4229 
   4230 /^(?!a){0}\w+/
   4231     aaaaa
   4232 
   4233 /(?<=(abc))?xyz/
   4234     abcxyz
   4235     pqrxyz 
   4236 
   4237 /^[\g<a>]+/
   4238     ggg<<<aaa>>>
   4239     ** Failers
   4240     \\ga  
   4241     
   4242 /^[\ga]+/
   4243     gggagagaxyz 
   4244     
   4245 /^[:a[:digit:]]+/
   4246     aaaa444:::Z 
   4247 
   4248 /^[:a[:digit:]:b]+/
   4249     aaaa444:::bbbZ 
   4250 
   4251 /[:a]xxx[b:]/
   4252      :xxx:
   4253      
   4254 /(?<=a{2})b/i
   4255     xaabc
   4256     ** Failers
   4257     xabc  
   4258 
   4259 /(?<!a{2})b/i
   4260     xabc
   4261     ** Failers
   4262     xaabc  
   4263 
   4264 /(?<=a\h)c/
   4265     xa c
   4266     
   4267 /(?<=[^a]{2})b/
   4268     axxbc
   4269     aAAbc 
   4270     ** Failers
   4271     xaabc    
   4272 
   4273 /(?<=[^a]{2})b/i
   4274     axxbc  
   4275     ** Failers
   4276     aAAbc 
   4277     xaabc    
   4278 
   4279 /(?<=a\H)c/
   4280     abc
   4281 
   4282 /(?<=a\V)c/
   4283     abc
   4284     
   4285 /(?<=a\v)c/
   4286     a\nc
   4287 
   4288 /(?(?=c)c|d)++Y/
   4289     XcccddYX
   4290 
   4291 /(?(?=c)c|d)*+Y/
   4292     XcccddYX
   4293 
   4294 /^(a{2,3}){2,}+a/
   4295     aaaaaaa
   4296     ** Failers
   4297     aaaaaa
   4298     aaaaaaaaa 
   4299 
   4300 /^(a{2,3})++a/
   4301     ** Failers
   4302     aaaaaa
   4303 
   4304 /^(a{2,3})*+a/
   4305     ** Failers
   4306     aaaaaa
   4307 
   4308 /ab\Cde/
   4309     abXde
   4310     
   4311 /(?<=ab\Cde)X/
   4312     abZdeX
   4313 
   4314 /a[\CD]b/
   4315     aCb
   4316     aDb 
   4317 
   4318 /a[\C-X]b/
   4319     aJb
   4320 
   4321 /\H\h\V\v/
   4322     X X\x0a
   4323     X\x09X\x0b
   4324     ** Failers
   4325     \xa0 X\x0a   
   4326     
   4327 /\H*\h+\V?\v{3,4}/ 
   4328     \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
   4329     \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
   4330     \x09\x20\xa0\x0a\x0b\x0c
   4331     ** Failers 
   4332     \x09\x20\xa0\x0a\x0b
   4333      
   4334 /\H{3,4}/
   4335     XY  ABCDE
   4336     XY  PQR ST 
   4337     
   4338 /.\h{3,4}./
   4339     XY  AB    PQRS
   4340 
   4341 /\h*X\h?\H+Y\H?Z/
   4342     >XNNNYZ
   4343     >  X NYQZ
   4344     ** Failers
   4345     >XYZ   
   4346     >  X NY Z
   4347 
   4348 /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
   4349     >XY\x0aZ\x0aA\x0bNN\x0c
   4350     >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
   4351 
   4352 /(foo)\Kbar/
   4353     foobar
   4354    
   4355 /(foo)(\Kbar|baz)/
   4356     foobar
   4357     foobaz 
   4358 
   4359 /(foo\Kbar)baz/
   4360     foobarbaz
   4361 
   4362 /abc\K|def\K/g+
   4363     Xabcdefghi
   4364 
   4365 /ab\Kc|de\Kf/g+
   4366     Xabcdefghi
   4367     
   4368 /(?=C)/g+
   4369     ABCDECBA
   4370     
   4371 /^abc\K/+
   4372     abcdef
   4373     ** Failers
   4374     defabcxyz   
   4375 
   4376 /^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
   4377     ababababbbabZXXXX
   4378 
   4379 /(?<A>tom|bon)-\g{A}/
   4380     tom-tom
   4381     bon-bon 
   4382     
   4383 /(^(a|b\g{-1}))/
   4384     bacxxx
   4385 
   4386 /(?|(abc)|(xyz))\1/
   4387     abcabc
   4388     xyzxyz 
   4389     ** Failers
   4390     abcxyz
   4391     xyzabc   
   4392     
   4393 /(?|(abc)|(xyz))(?1)/
   4394     abcabc
   4395     xyzabc 
   4396     ** Failers 
   4397     xyzxyz 
   4398  
   4399 /^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/
   4400     XYabcdY
   4401 
   4402 /^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/
   4403     XYabcdY
   4404 
   4405 /^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/
   4406     XYabcdY
   4407 
   4408 /(?'abc'\w+):\k<abc>{2}/
   4409     a:aaxyz
   4410     ab:ababxyz
   4411     ** Failers
   4412     a:axyz
   4413     ab:abxyz
   4414 
   4415 /(?'abc'\w+):\g{abc}{2}/
   4416     a:aaxyz
   4417     ab:ababxyz
   4418     ** Failers
   4419     a:axyz
   4420     ab:abxyz
   4421 
   4422 /^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
   4423     abd
   4424     ce
   4425 
   4426 /^(a.)\g-1Z/
   4427     aXaXZ
   4428 
   4429 /^(a.)\g{-1}Z/
   4430     aXaXZ
   4431 
   4432 /^(?(DEFINE) (?<A> a) (?<B> b) )  (?&A) (?&B) /x
   4433     abcd
   4434 
   4435 /(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
   4436   (?(DEFINE)
   4437   (?<NAME_PAT>[a-z]+)
   4438   (?<ADDRESS_PAT>\d+)
   4439   )/x
   4440     metcalfe 33
   4441 
   4442 /(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
   4443     1.2.3.4
   4444     131.111.10.206
   4445     10.0.0.0
   4446     ** Failers
   4447     10.6
   4448     455.3.4.5
   4449 
   4450 /\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
   4451     1.2.3.4
   4452     131.111.10.206
   4453     10.0.0.0
   4454     ** Failers
   4455     10.6
   4456     455.3.4.5
   4457 
   4458 /^(\w++|\s++)*$/
   4459     now is the time for all good men to come to the aid of the party
   4460     *** Failers
   4461     this is not a line with only words and spaces!
   4462 
   4463 /(\d++)(\w)/
   4464     12345a
   4465     *** Failers
   4466     12345+
   4467 
   4468 /a++b/
   4469     aaab
   4470 
   4471 /(a++b)/
   4472     aaab
   4473 
   4474 /(a++)b/
   4475     aaab
   4476 
   4477 /([^()]++|\([^()]*\))+/
   4478     ((abc(ade)ufh()()x
   4479 
   4480 /\(([^()]++|\([^()]+\))+\)/
   4481     (abc)
   4482     (abc(def)xyz)
   4483     *** Failers
   4484     ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   4485 
   4486 /^([^()]|\((?1)*\))*$/
   4487     abc
   4488     a(b)c
   4489     a(b(c))d
   4490     *** Failers)
   4491     a(b(c)d
   4492 
   4493 /^>abc>([^()]|\((?1)*\))*<xyz<$/
   4494    >abc>123<xyz<
   4495    >abc>1(2)3<xyz<
   4496    >abc>(1(2)3)<xyz<
   4497 
   4498 /^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i
   4499     1221
   4500     Satanoscillatemymetallicsonatas
   4501     AmanaplanacanalPanama
   4502     AblewasIereIsawElba
   4503     *** Failers
   4504     Thequickbrownfox
   4505 
   4506 /^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
   4507     12
   4508     (((2+2)*-3)-7)
   4509     -12
   4510     *** Failers
   4511     ((2+2)*-3)-7)
   4512 
   4513 /^(x(y|(?1){2})z)/
   4514     xyz
   4515     xxyzxyzz
   4516     *** Failers
   4517     xxyzz
   4518     xxyzxyzxyzz
   4519 
   4520 /((< (?: (?(R) \d++  | [^<>]*+) | (?2)) * >))/x
   4521     <>
   4522     <abcd>
   4523     <abc <123> hij>
   4524     <abc <def> hij>
   4525     <abc<>def>
   4526     <abc<>
   4527     *** Failers
   4528     <abc
   4529 
   4530 /^a+(*FAIL)/
   4531     aaaaaa
   4532     
   4533 /a+b?c+(*FAIL)/
   4534     aaabccc
   4535 
   4536 /a+b?(*PRUNE)c+(*FAIL)/
   4537     aaabccc
   4538 
   4539 /a+b?(*COMMIT)c+(*FAIL)/
   4540     aaabccc
   4541     
   4542 /a+b?(*SKIP)c+(*FAIL)/
   4543     aaabcccaaabccc
   4544 
   4545 /^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
   4546     aaaxxxxxx
   4547     aaa++++++ 
   4548     bbbxxxxx
   4549     bbb+++++ 
   4550     cccxxxx
   4551     ccc++++ 
   4552     dddddddd   
   4553 
   4554 /^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
   4555     aaaxxxxxx
   4556     aaa++++++ 
   4557     bbbxxxxx
   4558     bbb+++++ 
   4559     cccxxxx
   4560     ccc++++ 
   4561     dddddddd   
   4562 
   4563 /a+b?(*THEN)c+(*FAIL)/
   4564     aaabccc
   4565 
   4566 /(A (A|B(*ACCEPT)|C) D)(E)/x
   4567     AB
   4568     ABX
   4569     AADE
   4570     ACDE
   4571     ** Failers
   4572     AD 
   4573         
   4574 /^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i
   4575     1221
   4576     Satan, oscillate my metallic sonatas!
   4577     A man, a plan, a canal: Panama!
   4578     Able was I ere I saw Elba.
   4579     *** Failers
   4580     The quick brown fox
   4581 
   4582 /^((.)(?1)\2|.)$/
   4583     a
   4584     aba
   4585     aabaa  
   4586     abcdcba 
   4587     pqaabaaqp  
   4588     ablewasiereisawelba
   4589     rhubarb
   4590     the quick brown fox  
   4591 
   4592 /(a)(?<=b(?1))/
   4593     baz
   4594     ** Failers
   4595     caz  
   4596     
   4597 /(?<=b(?1))(a)/
   4598     zbaaz
   4599     ** Failers
   4600     aaa  
   4601     
   4602 /(?<X>a)(?<=b(?&X))/
   4603     baz
   4604 
   4605 /^(?|(abc)|(def))\1/
   4606     abcabc
   4607     defdef 
   4608     ** Failers
   4609     abcdef
   4610     defabc   
   4611     
   4612 /^(?|(abc)|(def))(?1)/
   4613     abcabc
   4614     defabc
   4615     ** Failers
   4616     defdef
   4617     abcdef    
   4618 
   4619 /(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/xJ
   4620     a\"aaaaa
   4621     b\"aaaaa 
   4622     ** Failers 
   4623     b\"11111
   4624 
   4625 /(?:(?1)|B)(A(*F)|C)/
   4626     ABCD
   4627     CCD
   4628     ** Failers
   4629     CAD   
   4630 
   4631 /^(?:(?1)|B)(A(*F)|C)/
   4632     CCD
   4633     BCD 
   4634     ** Failers
   4635     ABCD
   4636     CAD
   4637     BAD    
   4638 
   4639 /(?:(?1)|B)(A(*ACCEPT)XX|C)D/
   4640     AAD
   4641     ACD
   4642     BAD
   4643     BCD
   4644     BAX  
   4645     ** Failers
   4646     ACX
   4647     ABC   
   4648 
   4649 /(?(DEFINE)(A))B(?1)C/
   4650     BAC
   4651 
   4652 /(?(DEFINE)((A)\2))B(?1)C/
   4653     BAAC
   4654 
   4655 /(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x
   4656     (ab(cd)ef)
   4657 
   4658 /^(?=a(*SKIP)b|ac)/
   4659     ** Failers
   4660     ac
   4661     
   4662 /^(?=a(*PRUNE)b)/
   4663     ab  
   4664     ** Failers 
   4665     ac
   4666 
   4667 /^(?=a(*ACCEPT)b)/
   4668     ac
   4669 
   4670 /(?>a\Kb)/
   4671     ab
   4672 
   4673 /((?>a\Kb))/
   4674     ab
   4675 
   4676 /(a\Kb)/
   4677     ab
   4678     
   4679 /^a\Kcz|ac/
   4680     ac
   4681     
   4682 /(?>a\Kbz|ab)/
   4683     ab 
   4684 
   4685 /^(?&t)(?(DEFINE)(?<t>a\Kb))$/
   4686     ab
   4687 
   4688 /^([^()]|\((?1)*\))*$/
   4689     a(b)c
   4690     a(b(c)d)e 
   4691 
   4692 /(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/
   4693     0
   4694     00
   4695     0000  
   4696 
   4697 /(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/
   4698     0
   4699     00
   4700     0000  
   4701 
   4702 /--- This one does fail, as expected, in Perl. It needs the complex item at the
   4703      end of the pattern. A single letter instead of (B|D) makes it not fail,
   4704      which I think is a Perl bug. --- /
   4705 
   4706 /A(*COMMIT)(B|D)/
   4707     ACABX
   4708 
   4709 /--- Check the use of names for failure ---/
   4710 
   4711 /^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
   4712     ** Failers
   4713     AC
   4714     CB    
   4715     
   4716 /--- Force no study, otherwise mark is not seen. The studied version is in
   4717      test 2 because it isn't Perl-compatible. ---/
   4718 
   4719 /(*MARK:A)(*SKIP:B)(C|X)/KSS
   4720     C
   4721     D
   4722      
   4723 /^(A(*THEN:A)B|C(*THEN:B)D)/K
   4724     ** Failers
   4725     CB    
   4726 
   4727 /^(?:A(*THEN:A)B|C(*THEN:B)D)/K
   4728     CB    
   4729     
   4730 /^(?>A(*THEN:A)B|C(*THEN:B)D)/K
   4731     CB    
   4732     
   4733 /--- This should succeed, as the skip causes bump to offset 1 (the mark). Note
   4734 that we have to have something complicated such as (B|Z) at the end because,
   4735 for Perl, a simple character somehow causes an unwanted optimization to mess
   4736 with the handling of backtracking verbs. ---/
   4737 
   4738 /A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/xK
   4739     AAAC
   4740     
   4741 /--- Test skipping over a non-matching mark. ---/
   4742 
   4743 /A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/xK
   4744     AAAC
   4745     
   4746 /--- Check shorthand for MARK ---/
   4747 
   4748 /A(*:A)A+(*SKIP:A)(B|Z) | AC/xK
   4749     AAAC
   4750 
   4751 /--- Don't loop! Force no study, otherwise mark is not seen. ---/
   4752 
   4753 /(*:A)A+(*SKIP:A)(B|Z)/KSS
   4754     AAAC
   4755 
   4756 /--- This should succeed, as a non-existent skip name disables the skip ---/ 
   4757 
   4758 /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
   4759     AAAC
   4760 
   4761 /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/xK
   4762     AAAC
   4763 
   4764 /--- COMMIT at the start of a pattern should act like an anchor. Again, 
   4765 however, we need the complication for Perl. ---/
   4766 
   4767 /(*COMMIT)(A|P)(B|P)(C|P)/
   4768     ABCDEFG
   4769     ** Failers
   4770     DEFGABC  
   4771 
   4772 /--- COMMIT inside an atomic group can't stop backtracking over the group. ---/
   4773 
   4774 /(\w+)(?>b(*COMMIT))\w{2}/
   4775     abbb
   4776 
   4777 /(\w+)b(*COMMIT)\w{2}/
   4778     abbb
   4779 
   4780 /--- Check opening parens in comment when seeking forward reference. ---/ 
   4781 
   4782 /(?&t)(?#()(?(DEFINE)(?<t>a))/
   4783     bac
   4784 
   4785 /--- COMMIT should override THEN ---/
   4786 
   4787 /(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?/
   4788   yes
   4789 
   4790 /(?>(*COMMIT)(yes|no)(*THEN)(*F))?/
   4791   yes
   4792 
   4793 /b?(*SKIP)c/
   4794     bc
   4795     abc
   4796    
   4797 /(*SKIP)bc/
   4798     a
   4799 
   4800 /(*SKIP)b/
   4801     a 
   4802 
   4803 /(?P<abn>(?P=abn)xxx|)+/
   4804     xxx
   4805 
   4806 /(?i:([^b]))(?1)/
   4807     aa
   4808     aA     
   4809     ** Failers
   4810     ab
   4811     aB
   4812     Ba
   4813     ba
   4814 
   4815 /^(?&t)*+(?(DEFINE)(?<t>a))\w$/
   4816     aaaaaaX
   4817     ** Failers 
   4818     aaaaaa 
   4819 
   4820 /^(?&t)*(?(DEFINE)(?<t>a))\w$/
   4821     aaaaaaX
   4822     aaaaaa 
   4823 
   4824 /^(a)*+(\w)/
   4825     aaaaX
   4826     YZ 
   4827     ** Failers 
   4828     aaaa
   4829 
   4830 /^(?:a)*+(\w)/
   4831     aaaaX
   4832     YZ 
   4833     ** Failers 
   4834     aaaa
   4835 
   4836 /^(a)++(\w)/
   4837     aaaaX
   4838     ** Failers 
   4839     aaaa
   4840     YZ 
   4841 
   4842 /^(?:a)++(\w)/
   4843     aaaaX
   4844     ** Failers 
   4845     aaaa
   4846     YZ 
   4847 
   4848 /^(a)?+(\w)/
   4849     aaaaX
   4850     YZ 
   4851 
   4852 /^(?:a)?+(\w)/
   4853     aaaaX
   4854     YZ 
   4855 
   4856 /^(a){2,}+(\w)/
   4857     aaaaX
   4858     ** Failers
   4859     aaa
   4860     YZ 
   4861 
   4862 /^(?:a){2,}+(\w)/
   4863     aaaaX
   4864     ** Failers
   4865     aaa
   4866     YZ 
   4867 
   4868 /(a|)*(?1)b/
   4869     b
   4870     ab
   4871     aab  
   4872 
   4873 /(a)++(?1)b/
   4874     ** Failers
   4875     ab 
   4876     aab
   4877 
   4878 /(a)*+(?1)b/
   4879     ** Failers
   4880     ab
   4881     aab  
   4882 
   4883 /(?1)(?:(b)){0}/
   4884     b
   4885 
   4886 /(foo ( \( ((?:(?> [^()]+ )|(?2))*) \) ) )/x
   4887     foo(bar(baz)+baz(bop))
   4888 
   4889 /(A (A|B(*ACCEPT)|C) D)(E)/x
   4890     AB
   4891 
   4892 /\A.*?(a|bc)/
   4893     ba
   4894 
   4895 /\A.*?(?:a|bc)++/
   4896     ba
   4897 
   4898 /\A.*?(a|bc)++/
   4899     ba
   4900 
   4901 /\A.*?(?:a|bc|d)/
   4902     ba
   4903 
   4904 /(?:(b))++/
   4905     beetle
   4906 
   4907 /(?(?=(a(*ACCEPT)z))a)/
   4908     a
   4909 
   4910 /^(a)(?1)+ab/
   4911     aaaab
   4912     
   4913 /^(a)(?1)++ab/
   4914     aaaab
   4915 
   4916 /^(?=a(*:M))aZ/K
   4917     aZbc
   4918 
   4919 /^(?!(*:M)b)aZ/K
   4920     aZbc
   4921 
   4922 /(?(DEFINE)(a))?b(?1)/
   4923     backgammon
   4924 
   4925 /^\N+/
   4926     abc\ndef
   4927     
   4928 /^\N{1,}/
   4929     abc\ndef 
   4930 
   4931 /(?(R)a+|(?R)b)/
   4932     aaaabcde
   4933 
   4934 /(?(R)a+|((?R))b)/
   4935     aaaabcde
   4936 
   4937 /((?(R)a+|(?1)b))/
   4938     aaaabcde
   4939 
   4940 /((?(R1)a+|(?1)b))/
   4941     aaaabcde
   4942     
   4943 /((?(R)a|(?1)))*/
   4944     aaa
   4945 
   4946 /((?(R)a|(?1)))+/
   4947     aaa
   4948 
   4949 /a(*:any 
   4950 name)/K
   4951     abc
   4952     
   4953 /(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/
   4954     a
   4955     ba
   4956     bba 
   4957     
   4958 /--- Checking revised (*THEN) handling ---/ 
   4959 
   4960 /--- Capture ---/
   4961 
   4962 /^.*? (a(*THEN)b) c/x
   4963     aabc
   4964 
   4965 /^.*? (a(*THEN)b|(*F)) c/x
   4966     aabc
   4967 
   4968 /^.*? ( (a(*THEN)b) | (*F) ) c/x
   4969     aabc
   4970 
   4971 /^.*? ( (a(*THEN)b) ) c/x
   4972     aabc
   4973 
   4974 /--- Non-capture ---/
   4975 
   4976 /^.*? (?:a(*THEN)b) c/x
   4977     aabc
   4978 
   4979 /^.*? (?:a(*THEN)b|(*F)) c/x
   4980     aabc
   4981 
   4982 /^.*? (?: (?:a(*THEN)b) | (*F) ) c/x
   4983     aabc
   4984 
   4985 /^.*? (?: (?:a(*THEN)b) ) c/x
   4986     aabc
   4987 
   4988 /--- Atomic ---/
   4989 
   4990 /^.*? (?>a(*THEN)b) c/x
   4991     aabc
   4992 
   4993 /^.*? (?>a(*THEN)b|(*F)) c/x
   4994     aabc
   4995 
   4996 /^.*? (?> (?>a(*THEN)b) | (*F) ) c/x
   4997     aabc
   4998 
   4999 /^.*? (?> (?>a(*THEN)b) ) c/x
   5000     aabc
   5001 
   5002 /--- Possessive capture ---/
   5003 
   5004 /^.*? (a(*THEN)b)++ c/x
   5005     aabc
   5006 
   5007 /^.*? (a(*THEN)b|(*F))++ c/x
   5008     aabc
   5009 
   5010 /^.*? ( (a(*THEN)b)++ | (*F) )++ c/x
   5011     aabc
   5012 
   5013 /^.*? ( (a(*THEN)b)++ )++ c/x
   5014     aabc
   5015 
   5016 /--- Possessive non-capture ---/
   5017 
   5018 /^.*? (?:a(*THEN)b)++ c/x
   5019     aabc
   5020 
   5021 /^.*? (?:a(*THEN)b|(*F))++ c/x
   5022     aabc
   5023 
   5024 /^.*? (?: (?:a(*THEN)b)++ | (*F) )++ c/x
   5025     aabc
   5026 
   5027 /^.*? (?: (?:a(*THEN)b)++ )++ c/x
   5028     aabc
   5029     
   5030 /--- Condition assertion ---/
   5031 
   5032 /^(?(?=a(*THEN)b)ab|ac)/
   5033     ac
   5034  
   5035 /--- Condition ---/
   5036 
   5037 /^.*?(?(?=a)a|b(*THEN)c)/
   5038     ba
   5039 
   5040 /^.*?(?:(?(?=a)a|b(*THEN)c)|d)/
   5041     ba
   5042 
   5043 /^.*?(?(?=a)a(*THEN)b|c)/
   5044     ac
   5045 
   5046 /--- Assertion ---/
   5047 
   5048 /^.*(?=a(*THEN)b)/ 
   5049     aabc
   5050 
   5051 /------------------------------/
   5052 
   5053 /(?>a(*:m))/imsxSK 
   5054     a
   5055 
   5056 /(?>(a)(*:m))/imsxSK 
   5057     a
   5058 
   5059 /(?<=a(*ACCEPT)b)c/
   5060     xacd
   5061 
   5062 /(?<=(a(*ACCEPT)b))c/
   5063     xacd
   5064 
   5065 /(?<=(a(*COMMIT)b))c/
   5066     xabcd
   5067     ** Failers 
   5068     xacd
   5069     
   5070 /(?<!a(*FAIL)b)c/
   5071     xcd
   5072     acd 
   5073 
   5074 /(?<=a(*:N)b)c/K
   5075     xabcd
   5076     
   5077 /(?<=a(*PRUNE)b)c/
   5078     xabcd 
   5079 
   5080 /(?<=a(*SKIP)b)c/
   5081     xabcd 
   5082 
   5083 /(?<=a(*THEN)b)c/
   5084     xabcd 
   5085 
   5086 /(a)(?2){2}(.)/
   5087     abcd
   5088 
   5089 /(*MARK:A)(*PRUNE:B)(C|X)/KS
   5090     C
   5091     D 
   5092 
   5093 /(*MARK:A)(*PRUNE:B)(C|X)/KSS
   5094     C
   5095     D 
   5096 
   5097 /(*MARK:A)(*THEN:B)(C|X)/KS
   5098     C
   5099     D 
   5100 
   5101 /(*MARK:A)(*THEN:B)(C|X)/KSY
   5102     C
   5103     D 
   5104 
   5105 /(*MARK:A)(*THEN:B)(C|X)/KSS
   5106     C
   5107     D 
   5108 
   5109 /--- This should fail, as the skip causes a bump to offset 3 (the skip) ---/
   5110 
   5111 /A(*MARK:A)A+(*SKIP)(B|Z) | AC/xK
   5112     AAAC
   5113 
   5114 /--- Same --/
   5115 
   5116 /A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/xK
   5117     AAAC
   5118 
   5119 /A(*:A)A+(*SKIP)(B|Z) | AC/xK
   5120     AAAC
   5121 
   5122 /--- This should fail, as a null name is the same as no name ---/
   5123 
   5124 /A(*MARK:A)A+(*SKIP:)(B|Z) | AC/xK
   5125     AAAC
   5126 
   5127 /--- A check on what happens after hitting a mark and them bumping along to
   5128 something that does not even start. Perl reports tags after the failures here, 
   5129 though it does not when the individual letters are made into something 
   5130 more complicated. ---/
   5131 
   5132 /A(*:A)B|XX(*:B)Y/K
   5133     AABC
   5134     XXYZ 
   5135     ** Failers
   5136     XAQQ  
   5137     XAQQXZZ  
   5138     AXQQQ 
   5139     AXXQQQ 
   5140     
   5141 /^(A(*THEN:A)B|C(*THEN:B)D)/K
   5142     AB
   5143     CD
   5144     ** Failers
   5145     AC
   5146     CB    
   5147     
   5148 /^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
   5149     AB
   5150     CD
   5151     ** Failers
   5152     AC
   5153     CB    
   5154     
   5155 /--- An empty name does not pass back an empty string. It is the same as if no
   5156 name were given. ---/ 
   5157 
   5158 /^(A(*PRUNE:)B|C(*PRUNE:B)D)/K
   5159     AB
   5160     CD 
   5161 
   5162 /--- PRUNE goes to next bumpalong; COMMIT does not. ---/
   5163     
   5164 /A(*PRUNE:A)B/K
   5165     ACAB
   5166 
   5167 /--- Mark names can be duplicated ---/
   5168 
   5169 /A(*:A)B|X(*:A)Y/K
   5170     AABC
   5171     XXYZ 
   5172     
   5173 /b(*:m)f|a(*:n)w/K
   5174     aw 
   5175     ** Failers 
   5176     abc
   5177 
   5178 /b(*:m)f|aw/K
   5179     abaw
   5180     ** Failers 
   5181     abc
   5182     abax 
   5183 
   5184 /A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/xK
   5185     AAAC
   5186 
   5187 /a(*PRUNE:X)bc|qq/KY
   5188     ** Failers
   5189     axy
   5190 
   5191 /a(*THEN:X)bc|qq/KY
   5192     ** Failers
   5193     axy
   5194 
   5195 /(?=a(*MARK:A)b)..x/K
   5196     abxy
   5197     ** Failers
   5198     abpq  
   5199 
   5200 /(?=a(*MARK:A)b)..(*:Y)x/K
   5201     abxy
   5202     ** Failers
   5203     abpq  
   5204 
   5205 /(?=a(*PRUNE:A)b)..x/K
   5206     abxy
   5207     ** Failers
   5208     abpq  
   5209 
   5210 /(?=a(*PRUNE:A)b)..(*:Y)x/K
   5211     abxy
   5212     ** Failers
   5213     abpq  
   5214 
   5215 /(?=a(*THEN:A)b)..x/K
   5216     abxy
   5217     ** Failers
   5218     abpq  
   5219 
   5220 /(?=a(*THEN:A)b)..(*:Y)x/K
   5221     abxy
   5222     ** Failers
   5223     abpq  
   5224 
   5225 /(another)?(\1?)test/
   5226     hello world test
   5227 
   5228 /(another)?(\1+)test/
   5229     hello world test
   5230 
   5231 /(a(*COMMIT)b){0}a(?1)|aac/
   5232     aac
   5233 
   5234 /((?:a?)*)*c/
   5235   aac   
   5236 
   5237 /((?>a?)*)*c/
   5238   aac   
   5239 
   5240 /(?>.*?a)(?<=ba)/
   5241     aba
   5242 
   5243 /(?:.*?a)(?<=ba)/
   5244     aba
   5245 
   5246 /.*?a(*PRUNE)b/
   5247     aab
   5248 
   5249 /.*?a(*PRUNE)b/s
   5250     aab
   5251 
   5252 /^a(*PRUNE)b/s
   5253     aab
   5254 
   5255 /.*?a(*SKIP)b/
   5256     aab
   5257 
   5258 /(?>.*?a)b/s
   5259     aab
   5260 
   5261 /(?>.*?a)b/
   5262     aab
   5263 
   5264 /(?>^a)b/s
   5265     aab
   5266 
   5267 /(?>.*?)(?<=(abcd)|(wxyz))/
   5268     alphabetabcd
   5269     endingwxyz 
   5270 
   5271 /(?>.*)(?<=(abcd)|(wxyz))/
   5272     alphabetabcd
   5273     endingwxyz 
   5274 
   5275 "(?>.*)foo"
   5276     abcdfooxyz
   5277     
   5278 "(?>.*?)foo"
   5279     abcdfooxyz
   5280 
   5281 /(?:(a(*PRUNE)b)){0}(?:(?1)|ac)/
   5282     ac
   5283     
   5284 /(?:(a(*SKIP)b)){0}(?:(?1)|ac)/
   5285     ac 
   5286 
   5287 /(?<=(*SKIP)ac)a/
   5288     aa
   5289 
   5290 /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
   5291     AAAC
   5292 
   5293 /a(*SKIP:m)x|ac(*:n)(*SKIP:n)d|ac/K
   5294     acacd
   5295 
   5296 /A(*SKIP:m)x|A(*SKIP:n)x|AB/K
   5297     AB
   5298 
   5299 /((*SKIP:r)d){0}a(*SKIP:m)x|ac(*:n)|ac/K
   5300     acacd
   5301 
   5302 /-- Tests that try to figure out how Perl works. My hypothesis is that the
   5303     first verb that is backtracked onto is the one that acts. This seems to be
   5304     the case almost all the time, but there is one exception that is perhaps a 
   5305     bug. --/
   5306 
   5307 /-- This matches "aaaac"; each PRUNE advances one character until the subject
   5308     no longer starts with 5 'a's. --/
   5309 
   5310 /aaaaa(*PRUNE)b|a+c/
   5311     aaaaaac
   5312 
   5313 /-- Putting SKIP in front of PRUNE makes no difference, as it is never 
   5314 backtracked onto, whether or not it has a label. --/
   5315 
   5316 /aaaaa(*SKIP)(*PRUNE)b|a+c/
   5317     aaaaaac
   5318 
   5319 /aaaaa(*SKIP:N)(*PRUNE)b|a+c/
   5320     aaaaaac
   5321 
   5322 /aaaa(*:N)a(*SKIP:N)(*PRUNE)b|a+c/
   5323     aaaaaac
   5324 
   5325 /-- Putting THEN in front makes no difference. */
   5326     
   5327 /aaaaa(*THEN)(*PRUNE)b|a+c/
   5328     aaaaaac
   5329  
   5330 /-- However, putting COMMIT in front of the prune changes it to "no match". I 
   5331     think this is inconsistent and possibly a bug. For the moment, running this
   5332     test is moved out of the Perl-compatible file. --/
   5333 
   5334 /aaaaa(*COMMIT)(*PRUNE)b|a+c/
   5335     
   5336 
   5337 /---- OK, lets play the same game again using SKIP instead of PRUNE. ----/
   5338 
   5339 /-- This matches "ac" because SKIP forces the next match to start on the
   5340     sixth "a". --/
   5341 
   5342 /aaaaa(*SKIP)b|a+c/
   5343     aaaaaac
   5344  
   5345 /-- Putting PRUNE in front makes no difference. --/
   5346 
   5347 /aaaaa(*PRUNE)(*SKIP)b|a+c/
   5348     aaaaaac
   5349 
   5350 /-- Putting THEN in front makes no difference. --/
   5351 
   5352 /aaaaa(*THEN)(*SKIP)b|a+c/
   5353     aaaaaac
   5354 
   5355 /-- In this case, neither does COMMIT. This still matches "ac". --/
   5356 
   5357 /aaaaa(*COMMIT)(*SKIP)b|a+c/
   5358     aaaaaac
   5359     
   5360 /-- This gives "no match", as expected. --/
   5361 
   5362 /aaaaa(*COMMIT)b|a+c/
   5363     aaaaaac
   5364     
   5365 
   5366 /------ Tests using THEN ------/
   5367 
   5368 /-- This matches "aaaaaac", as expected. --/
   5369 
   5370 /aaaaa(*THEN)b|a+c/
   5371     aaaaaac
   5372 
   5373 /-- Putting SKIP in front makes no difference. --/
   5374 
   5375 /aaaaa(*SKIP)(*THEN)b|a+c/
   5376     aaaaaac
   5377     
   5378 /-- Putting PRUNE in front makes no difference. --/
   5379 
   5380 /aaaaa(*PRUNE)(*THEN)b|a+c/
   5381     aaaaaac
   5382     
   5383 /-- Putting COMMIT in front makes no difference. --/
   5384 
   5385 /aaaaa(*COMMIT)(*THEN)b|a+c/
   5386     aaaaaac
   5387     
   5388 /-- End of "priority" tests --/ 
   5389 
   5390 /aaaaa(*:m)(*PRUNE:m)(*SKIP:m)m|a+/
   5391     aaaaaa
   5392 
   5393 /aaaaa(*:m)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/
   5394     aaaaaa
   5395 
   5396 /aaaaa(*:n)(*PRUNE:m)(*SKIP:m)m|a+/
   5397     aaaaaa
   5398 
   5399 /aaaaa(*:n)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/
   5400     aaaaaa
   5401 
   5402 /a(*MARK:A)aa(*PRUNE:A)a(*SKIP:A)b|a+c/
   5403     aaaac
   5404 
   5405 /a(*MARK:A)aa(*MARK:A)a(*SKIP:A)b|a+c/
   5406     aaaac
   5407 
   5408 /aaa(*PRUNE:A)a(*SKIP:A)b|a+c/
   5409     aaaac
   5410 
   5411 /aaa(*MARK:A)a(*SKIP:A)b|a+c/
   5412     aaaac
   5413 
   5414 /a(*:m)a(*COMMIT)(*SKIP:m)b|a+c/K
   5415     aaaaaac
   5416 
   5417 /.?(a|b(*THEN)c)/
   5418     ba
   5419 
   5420 /(a(*COMMIT)b)c|abd/
   5421     abc
   5422     abd
   5423 
   5424 /(?=a(*COMMIT)b)abc|abd/
   5425     abc
   5426     abd
   5427 
   5428 /(?>a(*COMMIT)b)c|abd/
   5429     abc
   5430     abd
   5431 
   5432 /a(?=b(*COMMIT)c)[^d]|abd/
   5433     abd
   5434     abc 
   5435 
   5436 /a(?=bc).|abd/
   5437     abd
   5438     abc 
   5439     
   5440 /a(?>b(*COMMIT)c)d|abd/
   5441     abceabd 
   5442 
   5443 /a(?>bc)d|abd/
   5444     abceabd 
   5445 
   5446 /(?>a(*COMMIT)b)c|abd/
   5447     abd
   5448 
   5449 /(?>a(*COMMIT)c)d|abd/
   5450     abd
   5451 
   5452 /((?=a(*COMMIT)b)ab|ac){0}(?:(?1)|a(c))/
   5453     ac 
   5454     
   5455 /-- These tests were formerly in test 2, but changes in PCRE and Perl have
   5456     made them compatible. --/
   5457     
   5458 /^(a)?(?(1)a|b)+$/
   5459     *** Failers
   5460     a
   5461 
   5462 /(?=a\Kb)ab/
   5463     ab 
   5464 
   5465 /(?!a\Kb)ac/
   5466     ac 
   5467     
   5468 /^abc(?<=b\Kc)d/
   5469     abcd
   5470 
   5471 /^abc(?<!b\Kq)d/
   5472     abcd
   5473 
   5474 
   5475 /A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xK
   5476     AAAC
   5477 
   5478 /^((abc|abcx)(*THEN)y|abcd)/
   5479     abcd
   5480     *** Failers 
   5481     abcxy 
   5482     
   5483 /^((yes|no)(*THEN)(*F))?/
   5484   yes
   5485 
   5486 /(A (.*)   C? (*THEN)  | A D) (*FAIL)/x
   5487 AbcdCBefgBhiBqz
   5488 
   5489 /(A (.*)   C? (*THEN)  | A D) z/x
   5490 AbcdCBefgBhiBqz
   5491 
   5492 /(A (.*)   C? (*THEN)  | A D) \s* (*FAIL)/x
   5493 AbcdCBefgBhiBqz
   5494 
   5495 /(A (.*)   C? (*THEN)  | A D) \s* z/x
   5496 AbcdCBefgBhiBqz
   5497 
   5498 /(A (.*)   (?:C|) (*THEN)  | A D) (*FAIL)/x
   5499 AbcdCBefgBhiBqz
   5500 
   5501 /(A (.*)   (?:C|) (*THEN)  | A D) z/x
   5502 AbcdCBefgBhiBqz
   5503 
   5504 /(A (.*)   C{0,6} (*THEN)  | A D) (*FAIL)/x
   5505 AbcdCBefgBhiBqz
   5506 
   5507 /(A (.*)   C{0,6} (*THEN)  | A D) z/x
   5508 AbcdCBefgBhiBqz
   5509 
   5510 /(A (.*)   (CE){0,6} (*THEN)  | A D) (*FAIL)/x
   5511 AbcdCEBefgBhiBqz
   5512 
   5513 /(A (.*)   (CE){0,6} (*THEN)  | A D) z/x
   5514 AbcdCEBefgBhiBqz
   5515 
   5516 /(A (.*)   (CE*){0,6} (*THEN)  | A D) (*FAIL)/x
   5517 AbcdCBefgBhiBqz
   5518 
   5519 /(A (.*)   (CE*){0,6} (*THEN)  | A D) z/x
   5520 AbcdCBefgBhiBqz
   5521 
   5522 /(?=a(*COMMIT)b|ac)ac|ac/
   5523     ac
   5524 
   5525 /(?=a(*COMMIT)b|(ac)) ac | (a)c/x
   5526     ac
   5527 
   5528 /--------/
   5529 
   5530 /(?(?!b(*THEN)a)bn|bnn)/
   5531    bnn 
   5532 
   5533 /(?!b(*SKIP)a)bn|bnn/
   5534     bnn
   5535     
   5536 /(?(?!b(*SKIP)a)bn|bnn)/
   5537    bnn 
   5538 
   5539 /(?!b(*PRUNE)a)bn|bnn/
   5540     bnn
   5541     
   5542 /(?(?!b(*PRUNE)a)bn|bnn)/
   5543    bnn 
   5544    
   5545 /(?!b(*COMMIT)a)bn|bnn/
   5546     bnn
   5547     
   5548 /(?(?!b(*COMMIT)a)bn|bnn)/
   5549    bnn 
   5550 
   5551 /(?=b(*SKIP)a)bn|bnn/
   5552     bnn
   5553 
   5554 /(?=b(*THEN)a)bn|bnn/
   5555     bnn
   5556     
   5557  /^(?!a(*SKIP)b)/
   5558      ac
   5559 
   5560  /^(?!a(*SKIP)b)../
   5561      acd
   5562 
   5563 /(?!a(*SKIP)b)../
   5564      acd
   5565 
   5566 /^(?(?!a(*SKIP)b))/
   5567      ac
   5568 
   5569 /^(?!a(*PRUNE)b)../
   5570      acd
   5571 
   5572 /(?!a(*PRUNE)b)../
   5573      acd
   5574 
   5575  /(?!a(*COMMIT)b)ac|cd/
   5576      ac
   5577 
   5578 /\A.*?(?:a|bc)/
   5579     ba
   5580 
   5581 /^(A(*THEN)B|C(*THEN)D)/
   5582     CD           
   5583 
   5584 /(*:m(m)(?&y)(?(DEFINE)(?<y>b))/K
   5585     abc
   5586 
   5587 /(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/K
   5588     abc
   5589 
   5590 /(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/K
   5591     abc
   5592 
   5593 /(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/K
   5594     abc
   5595 
   5596 /^\d*\w{4}/
   5597     1234
   5598     123 
   5599 
   5600 /^[^b]*\w{4}/
   5601     aaaa
   5602     aaa     
   5603 
   5604 /^[^b]*\w{4}/i
   5605     aaaa
   5606     aaa     
   5607 
   5608 /^a*\w{4}/
   5609     aaaa
   5610     aaa     
   5611 
   5612 /^a*\w{4}/i
   5613     aaaa
   5614     aaa     
   5615 
   5616 /(?(?=ab)ab)/+
   5617     ca
   5618     cd 
   5619 
   5620 /(?:(?<n>foo)|(?<n>bar))\k<n>/J
   5621     foofoo
   5622     barbar
   5623 
   5624 /(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/J
   5625     AfooA
   5626     AbarA  
   5627     ** Failers 
   5628     Afoofoo
   5629     Abarbar
   5630 
   5631 /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
   5632     1 IN SOA non-sp1 non-sp2(
   5633 
   5634 /^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?('A')x) (?(<B>)y)$/xJ
   5635     Ax
   5636     BAxy 
   5637     
   5638 /^A\xZ/
   5639     A\0Z 
   5640 
   5641 /^A\o{123}B/
   5642     A\123B
   5643 
   5644 / ^ a + + b $ /x
   5645     aaaab
   5646     
   5647 / ^ a + #comment
   5648   + b $ /x
   5649     aaaab
   5650     
   5651 / ^ a + #comment
   5652   #comment
   5653   + b $ /x
   5654     aaaab
   5655     
   5656 / ^ (?> a + ) b $ /x
   5657     aaaab 
   5658 
   5659 / ^ ( a + ) + + \w $ /x
   5660     aaaab 
   5661 
   5662 /(?:a\Kb)*+/+
   5663     ababc
   5664 
   5665 /(?>a\Kb)*/+
   5666     ababc
   5667 
   5668 /(?:a\Kb)*/+
   5669     ababc
   5670 
   5671 /(a\Kb)*+/+
   5672     ababc
   5673 
   5674 /(a\Kb)*/+
   5675     ababc
   5676 
   5677 /(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/
   5678     acb
   5679 
   5680 '\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++'
   5681     NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
   5682 
   5683 '\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
   5684     NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
   5685 
   5686 '\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++'
   5687     NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
   5688 
   5689 '\A([^\"1]++|[\"2]([^\"3]*+|[\"4][\"5])*+[\"6])++'
   5690     NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
   5691 
   5692 /^\w+(?>\s*)(?<=\w)/
   5693   test test
   5694 
   5695 /(?P<same>a)(?P<same>b)/gJ
   5696     abbaba
   5697 
   5698 /(?P<same>a)(?P<same>b)(?P=same)/gJ
   5699     abbaba
   5700 
   5701 /(?P=same)?(?P<same>a)(?P<same>b)/gJ
   5702     abbaba
   5703 
   5704 /(?:(?P=same)?(?:(?P<same>a)|(?P<same>b))(?P=same))+/gJ
   5705     bbbaaabaabb
   5706 
   5707 /(?:(?P=same)?(?:(?P=same)(?P<same>a)(?P=same)|(?P=same)?(?P<same>b)(?P=same)){2}(?P=same)(?P<same>c)(?P=same)){2}(?P<same>z)?/gJ
   5708     bbbaaaccccaaabbbcc
   5709 
   5710 /(?P<Name>a)?(?P<Name2>b)?(?(<Name>)c|d)*l/
   5711     acl
   5712     bdl
   5713     adl
   5714     bcl    
   5715 
   5716 /\sabc/
   5717     \x{0b}abc
   5718 
   5719 /[\Qa]\E]+/
   5720     aa]]
   5721 
   5722 /[\Q]a\E]+/
   5723     aa]]
   5724 
   5725 /-- End of testinput1 --/
   5726