regular expression for Indian mobile numbers

Viewed 221086

I want regular expression for indian mobile numbers which consists of 10 digits.
The numbers which should match start with 9 or 8 or 7.

For example:

9882223456
8976785768
7986576783

It should not match the numbers starting with 1 to 6 or 0.

18 Answers

You may use this

/^(?:(?:\+|0{0,2})91(\s*|[\-])?|[0]?)?([6789]\d{2}([ -]?)\d{3}([ -]?)\d{4})$/

Valid Entries:

6856438922
7856128945
8945562713
9998564723
+91-9883443344
09883443344
919883443344
0919883443344
+919883443344
+91-9883443344
0091-9883443344
+91 9883443344
+91-785-612-8945
+91 999 856 4723

Invalid Entries:

WAQU9876567892
ABCD9876541212
0226-895623124
0924645236
0222-895612
098-8956124
022-2413184

Validate it at https://regex101.com/

i have used this regex in my projects and this works fine.

pattern="[6-9]{1}[0-9]{9}"

In Swift

 extension String {
    var isPhoneNumber: Bool {
      let PHONE_REGEX = "^[7-9][0-9]{9}$";
      let phoneTest = NSPredicate(format: "SELF MATCHES %@", PHONE_REGEX)
      let result =  phoneTest.evaluate(with: self)
      return result
   }
}

For Laravel 5.4+

'mobile_number_1' => 'required|numeric|min:0|regex:/^[789]\d{9}$/' should do the trick

for Indian mobile number use this reg expression

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