Page 1 of 1

simple regular expression problem

Posted: Fri Jul 20, 2007 3:44 pm
by yacahuma

Code: Select all

$pattern = "/\[[0-9]*\]/";
preg_match($pattern, "sdsds[923232] sdsdsds[1112222]", $matches, PREG_OFFSET_CAPTURE);
print_r($matches);
The output
Array ( [0] => Array ( [0] => [923232] [1] => 5 ) )

Why do I only get one match and not 2????

What am I doing wrong??
Thank you

Posted: Fri Jul 20, 2007 3:46 pm
by Benjamin
use preg_match_all()

Thank you that worked(JEJE)

Posted: Fri Jul 20, 2007 3:50 pm
by yacahuma
Thank you that worked.