Indian Phone Number Regex for PHP
/^(?:\+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 PHP. A rigorously tested regex reduces debugging time and protects your application from edge-case failures. The snippet below is ready to drop into your PHP project — whether you're validating in a Laravel validator, a WordPress plugin, or a standalone PHP script.
Php Implementation
<?php
// Indian Phone Number
// ReDoS-safe | RegexVault — Localization > Phone Numbers
define('INDIAN_PHONE_NUMBER_PATTERN', '/^(?:\+91[\s.-]?)?(?!09)([6-9][0-9]{9}|0[1-9][0-9]{1,2}[\s.-]?[0-9]{7,8})$/');
function validate_indian_phone_number(string $input): bool {
return (bool) preg_match(INDIAN_PHONE_NUMBER_PATTERN, $input);
}
// Example
var_dump(validate_indian_phone_number("+91 9876543210")); // bool(true)Test 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 PHP developers because especially relevant in PHP where PCRE backtracking limits can trigger silent failures on malicious input. 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