Match regex with php -
i 2 results preg_match
, don't understand why. code:
$pattern = "\[precom\]([a-za-z]|\(|\)|[0-9]|\s|\*)*\[\/precom\]"; $data = "[precom](homme) cher monsieur $name[/precom] "; preg_match("/" . $pattern . "/", $data, $m); print_r($m);
this result:
array ( [0] => [precom](homme) cher monsieur *name[/precom] [1] => e )
could me find problem please?
from http://www.php.net//manual/en/function.preg-match.php
matches
if matches provided, filled results of search. $matches[0] contain text matched full pattern, $matches[1] have text matched first captured parenthesized subpattern, , on.
Comments
Post a Comment