Regular Expression Validation For Indian Phone Number and Mobile number

前端 未结 12 769
后悔当初
后悔当初 2020-12-01 09:26

I want to validate Indian phone numbers as well as mobile numbers. The format of the phone number and mobile number is as follows:

For land Line number



        
12条回答
  •  庸人自扰
    2020-12-01 10:15

    All mobile numbers in India start with 9, 8, 7 or 6. Now, there is a chance that you are not bothering about the prefixes (+91 or 0). If this is your scenario, then you can take the help from the website regextester.com or you can use r'^(+91[-\s]?)?[0]?(91)?[789]\d{9}$'

    And if you want to validate the Phone number with prefixes(+91 or 0) then use : r'^[9876]\d{9}$'.

提交回复
热议问题