In my phone number validation i need to validate only 9,10,14 digit numbers and 11,12,13 numbers are not valid,if phone number start with + then any digit number should be valid.Any preg_match code available? please help. :(
Asked
Active
Viewed 144 times
-2
-
What have you tried with preg match? There are online tools like this: https://www.phpliveregex.com where you can check and see live the results so it's easy for debug. Let us know what you have tried. – Daniel Dudas Apr 03 '19 at 06:19
1 Answers
1
You can try this :
preg_match('/(?=^\d{9,10}$)|(?=^\d{14}$)|(?=^\+\d*)/', '+123456789012', $matches);
print_r($matches);
Shubham Shendage
- 114
- 4