I need a regex to validate a phone number (With country code )which shall follow the below conditions
1 - There should be at max 4 digits in between + and - .
2 - Phone number shall be a combination of +,- and digits
3 - 0 shall not be allowed after -
4 - After - only 10 digits are allowed
E.g
1 - +91234-1234567 - Fail (1st Condition fails)
2 - +9123-1234567 - Pass
3 - + - Fail (2nd condition fails)
4 - - - Fail (2nd condition fails)
5 - 91234545555 - Fail (2nd condition fails)
6 - +91-012345 - Fail (3rd Condition fails)
7 - +91-12345678910 - Fail (4th condition fails)
Please help me in this .Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…