Regular expression for Indian mobile phone numbers?

I am looking for a regular expression that will match the text given the following requirements:

  • contains only 10 digits (numbers only)
  • starts at 9.

These examples should match:

  • 9999999999
  • 9876543210

These examples should not match:

  • 999999999
  • 1234567890
  • 8912456789
  • qwe3456 & ERT

This is mainly for Indian mobile numbers.

Please provide examples, I have already searched Google, and these answers provide excessive validation.

0
source share
10 answers

Try something like this:

^9\d{9}$ 
+13
source

I always prefer REs that can be used on any engine (so the non-fancy stuff "\d" ):

 ^9[0-9]{9}$ 

or, in a crunch,

 ^9[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$ 

if the RE engine does not even have "{}" .

Yes, I know that the C # engine can do both "\d" and "{}" , but this is not always the case.

+4
source

Try to test it.

 ^([7-9]{1})([0-9]{9})$ 
+2
source
 9{1}\d{9} 

or without predefined \d

 9{1}[0-9]{9} 
+1
source

^ 9 [0-9] {9} $

+1
source

Try to test it.

 ^([9]{1})([0-9]{9})$ 
+1
source

Chk is from ....... Expression

 ^((\+){0,1}91(\s){0,1}(\-){0,1}(\s){0,1}){0,1}9[0-9](\s){0,1}(\-){0,1}(\s){0,1}[1-9]{1}[0-9]{7}$ 

Description: This expression should check indian mobile nos

Matches:

9836193498
+919836193498
9745622222

Inconsistencies:

+9197456222222
8745622222
9836193481

+1
source
 ^([1-9]{1})([0-9]{9})$ 

Try this 10-digit mobile number No confirmation = ^ ([1-9] {1}) ([0-9] {9}) $ This expression is very useful for Indian mobile notes. This expression does not allow the first digit of zero (example: 0123456789).

0
source

try it

 ^(((\+?\(91\))|0|((00|\+)?91))-?)?[7-9]\d{9}$ 
0
source

Ok, I wrote this regex to check the Indian mobile number. Basically, the number in India starts from 7-9, with the exception of the country code (+91) and (0). This regular expression will check the mobile number pattern, including the country code. eg

  • + 91-8978989089
  • 09090898978
  • 9909876767
  • 0091-999897678 valid number

regex:

^(?:(?:\+|0{0,2})91(\s*[\-]\s*)?|[0]?)?[789]\d{9}$

you can check / test your input here regex check

0
source

Source: https://habr.com/ru/post/1482808/


All Articles