I know there are lots of same type of questions posted on stackoverflow but I have something in custom and dont know how to solve this problem.
If any number is prefixed with ‘+’ or 0 (sequence of zero like 00) or ‘91-‘, then it should be removed automatically before group creation. prefixed needs to be removed -
- 0 or sequence of 0 (00, 000, 0000 etc)
- +
- 91-
- +91-
Valid mobile numbers entered by users should be as below:
- If mobile number is 10 digit, it should start with 9,8,7 or 6
- If mobile number is 12 digit, first 2 digits should be 91 and 3rd digit should be 9,8,7 or 6 All other numbers should be considered invalid for domestic group creation.
What will be the php code for above as will be?
phone no ex-
+918877665544 or 0918877665544 or 0000918877665544 will give 918877665544
(length 12)+91-8877665544 or 91-8877665544 or 00008877665544 will give 8877665544
(length 10)+91-88776655440 (length 11) or 91-88-77665544 (- in between) will give gets skip or should giv blank
only digits are allowed after removing the allowed prefixes.
if any other it should skip (should give blank).
Note:- for all the cases it should have only one regex as this regex will be inserted from config settings.