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