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