regex - PHP code with regexp for dutch phone are not working -
i used expression solution given in regular expression dutch phone number php code below, code not working.
the code simple don't see go wrong ?
define("regexp_phone_nl","(^\+[0-9]{2}|^\+[0-9]{2}\(0\)|^\(\+[0-9]{2}\)\(0\)|^00[0-9]{2}|^0)([0-9]{9}$|[0-9\-\s]{10}$)"); $string = "+31123456789"; //based on solution given in https://stackoverflow.com/questions/17949757/regular-expression-for-dutch-phone-number echo(filter_var($string, filter_validate_regexp,array("options"=>array("regexp"=>regexp_phone_nl))));
regex works, forgot put same characters in beginning , in end of pattern (delimeters).
<?php define("regexp_phone_nl","/(^\+[0-9]{2}|^\+[0-9]{2}\(0\)|^\(\+[0-9]{2}\)\(0\)|^00[0-9]{2}|^0)([0-9]{9}$|[0-9\-\s]{10}$)/"); $string = "+316123456789"; //based on solution given in http://stackoverflow.com/questions/17949757/regular-expression-for-dutch-phone-number var_dump(filter_var($string, filter_validate_regexp,array("options"=>array("regexp"=>regexp_phone_nl))));
see working here.
Comments
Post a Comment