Indian Mobile Number Regex Explained

Indian mobile numbers are 10 digits starting with 6–9, optionally prefixed with +91. Here’s the regex, explained.

AI DevRuns in your browser — nothing uploaded

Flags

What it means

Looks like it matches an Indian mobile number.

  1. ^Start of the text
  2. (?:\+91[- ]?)?Optionally:
  3. \+91The text “+91”
  4. [- ]?Optionally, one of: “-” or space
  5. [6-9]One of: 6–9
  6. \d{9}Exactly 9 × a digit (0–9)
  7. $End of the text

Test cases

Should match

  • 6585706895
  • +91-9244967640
  • +91-6454986641
  • 9205303624
  • +916717620430

Should not match

  • 658570689
  • 6585706895!
  • 585706895
  • x585706895
  • ␣6585706895

How it works

  1. 1

    Parses the pattern

    The regex is broken into its parts — characters, classes, groups, quantifiers, anchors and lookarounds.

  2. 2

    Explains each part

    Every piece is described in plain English, nested the same way as the pattern, so groups and alternatives stay readable.

  3. 3

    Generates test cases

    Random strings are generated from the pattern and checked against it, then mutated to find near-misses that fail.

  4. 4

    Recognises common formats

    If a pattern matches a known format — PAN, GSTIN, email, Indian mobile number, PIN code, IFSC — it says so.

Questions, answered

JavaScript. Most everyday Python, Java and PCRE patterns use the same syntax, so they explain correctly too. Features unique to other flavours (like possessive quantifiers) may not.

Popular uses