With php preg_match
, I found this regular expression for phone number code (such as +61)
$res = preg_match('/(\+\d{1,3})/', '+99999999'); // must return false
But it returns true
. Maximum length must be 3. I mean (+999)
Any idea?
With php preg_match
, I found this regular expression for phone number code (such as +61)
$res = preg_match('/(\+\d{1,3})/', '+99999999'); // must return false
But it returns true
. Maximum length must be 3. I mean (+999)
Any idea?
Regex: '/^(\+\d{1,3})$/
Change regex: /(\+\d{1,3})/
to /^(\+\d{1,3})$/
<?php
$res= preg_match('/^(\+\d{1,3})$/', '+99999999',$matches);
print_r($matches);