regex - PHP preg_match_all returns empty arrays -
i have preg_match_all
:
$cash = "hi £240"; preg_match_all("/^£?(([1-9]{1,3}(,\d{3})*(\.\d{2})?)|(0\.[1-9]\d)|(0\.0[1-9]))$/", $cash, $matches); print_r($matches);
and print_r returns:
array ( [0] => array ( ) [1] => array ( ) [2] => array ( ) [3] => array ( ) [4] => array ( ) [5] => array ( ) [6] => array ( ) )
when tried preg_match, didnt work @ all, did miss something?
i searching string gb monetary values.
$cash = "hi £240"; preg_match_all("/£(?p<amount>\d*,?\d*\.?\d*)/",$cash,$match); print_r($match['amount']);
php regex
No comments:
Post a Comment