Indian Phone Number Regex for JavaScript
/^(?:\+91[\s.-]?)?(?!09)([6-9][0-9]{9}|0[1-9][0-9]{1,2}[\s.-]?[0-9]{7,8})$/What this pattern does
This page provides a comprehensive, battle-tested regular expression for matching indian phone number, ported and verified for JavaScript. A rigorously tested regex reduces debugging time and protects your application from edge-case failures. The snippet below is ready to drop into your JavaScript project — whether you're validating in an Express middleware, a Next.js API route, or a client-side form.
Javascript Implementation
// Indian Phone Number
// ReDoS-safe | RegexVault — Localization > Phone Numbers
const indianPhoneNumberRegex = /^(?:\+91[\s.-]?)?(?!09)([6-9][0-9]{9}|0[1-9][0-9]{1,2}[\s.-]?[0-9]{7,8})$/;
function validateIndianPhoneNumber(input: string): boolean {
return indianPhoneNumberRegex.test(input);
}
// Example
console.log(validateIndianPhoneNumber("+91 9876543210")); // trueTest Cases
Matches (Valid) | Rejects (Invalid) |
|---|---|
+91 9876543210 | +91 5876543210 |
9876543210 | +91 98765432 |
+919876543210 | 98765432100 |
6789012345 | 0987654321 |
011-12345678 | — |
When to use this pattern
This pattern is drawn from the Localization > Phone Numbers category and carries a ReDoS-safe certification. That matters for JavaScript developers because especially critical in long-running Node.js event loops where a ReDoS vulnerability can block the entire process. RegexVault audits patterns against known backtracking attack vectors, ensuring you have the necessary context before using this regex in a high-stakes production environment.
Common Pitfalls
India has a complex telecom numbering plan. Numbers starting with 1, 2, 3, 4, or 5 are not currently assigned for mobile use but may be used for landlines. Validate via TRAI's number plan if precision is needed.
Technical Notes
Indian mobile numbers are 10 digits starting with 6-9 (5 is currently unassigned). Landlines include city code (011 for Delhi, 022 for Mumbai) + 7-8 digit local number. Country code is +91.
Have a pattern that belongs in the vault?
Submit it for review — community-verified patterns get credited to your GitHub handle. Free submissions join the queue. Priority review available for $15.
Submit a Pattern