is($re->matched, '^cat', "match pattern-6 {$target} re"); $target = 'CATFOOD'; ok($re->match($target), "match pattern-6 {$target}"); is($re->matched, '^cat', "match pattern-6 {$target} re"); $target = 'candle'; ok($re->match($target), "match pattern-6 {$target}"); is($re->matched, '^candle$', "match pattern-6 {$target} re"); $target = 'Candlestick'; ok(!$re->match($target), "match pattern-6 {$target}"); // } $re = new Regexp_Assemble(['track' => 1]); $re->add('^ab-(\\d+)-(\\d+)')->add('^ac-(\\d+)')->add('^nothing')->add('^ad-((\\d+)-(\\d+))'); // SKIP: { // skip( "/?{...}/ and \\d+ cause a panic in this version of perl ($])", 15 ) if $PERL_VERSION_5_005; ok(!$re->capture(), 'match p7 no prior capture'); ok($re->match('nothing captured'), 'match p7-1'); is(count($re->capture()), 0, 'match p7-1 no capture'); ok($re->match('ac-417 captured'), 'match p7-2'); $capture = $re->capture(); is(count($capture), 1, 'match p7-2 capture'); is($capture[0], 417, "match p7-2 value 0 ok"); ok($re->match('ab-21-17 captured'), 'match p7-3'); $capture = $re->capture(); is(count($capture), 2, 'match p7-3 capture'); is($capture[0], 21, "match p7-3 value 0 ok"); is($capture[1], 17, "match p7-3 value 1 ok"); ok($re->match('ad-808-245 captured'), 'match p7-4'); $capture = $re->capture(); is(count($capture), 3, 'match p7-4 capture'); is($capture[0], '808-245', "match p7-4 value 0 ok"); is($capture[1], 808, "match p7-4 value 1 ok");