Regex for Indian mobile number (+91)
Indian mobile numbers have 10 digits and start with 6, 7, 8 or 9. People often add +91, 91 or a leading 0. This pattern accepts those prefixes and rejects numbers that are too short or too long.
The pattern
/(?<!\d)(?:\+91[\s-]?|91[\s-]?|0)?[6-9]\d{9}(?!\d)/gThe tester opens with this pattern and the examples below already loaded. Nothing you type is uploaded.
How it works
(?<!\d)- Lookbehind: the number must not be preceded by another digit.
(?:\+91[\s-]?|91[\s-]?|0)?- Optional prefix: +91, 91 (each with an optional space or dash) or a leading 0.
[6-9]- First digit of the mobile number, 6 to 9.
\d{9}- The remaining nine digits.
(?!\d)- Lookahead: the number must not be followed by another digit.
Examples
Matches
9876543210+91 9876543210+91-987654321091987654321009876543210
Does not match
58765432109876598765432101
Use it in JavaScript
const re = /(?<!\d)(?:\+91[\s-]?|91[\s-]?|0)?[6-9]\d{9}(?!\d)/g;
// Find every match in a block of text
const found = text.match(re);
// Validate that a whole value matches (no stray characters around it)
const exact = new RegExp('^(?:' + re.source + ')$', re.flags.replace('g', ''));
const isValid = exact.test(value);Limits and tips
- This version does not accept spaces inside the number, such as 98765 43210. To allow that, replace [6-9]\d{9} with [6-9]\d{4}[\s-]?\d{5}.
- Lookbehind (?<!...) works in current versions of Chrome, Edge, Firefox and Safari. If you must support very old browsers, replace it with a leading \b or capture the digit before the number.
- This checks the format only. It cannot tell whether a number is active.
Frequently asked questions
Which digit does an Indian mobile number start with?
Six, seven, eight or nine, which is why the pattern uses [6-9].
Does it match numbers with +91?
Yes. It accepts +91, 91 or a leading 0 before the 10 digits, with an optional space or dash after +91 and 91.