Japanese Phone Number Regex for JavaScript
/^(?:(?:\+81[\s.-]?|0)(?!0)(?=[0-9\s.-]{10,13}$)(?:[1-9][0-9]{0,3}[\s.-]?[0-9]{2,4}[\s.-]?[0-9]{4})|(?:\+81[\s.-]?|0)(?!0)(?:[1-9][0-9]{3}[\s.-]?[0-9]{1,2}[\s.-]?[0-9]{4}))$/What this pattern does
This page provides a comprehensive, battle-tested regular expression for matching japanese 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
// Japanese Phone Number
// ReDoS-safe | RegexVault — Localization > Phone Numbers
const japanesePhoneNumberRegex = /^(?:(?:\+81[\s.-]?|0)(?!0)(?=[0-9\s.-]{10,13}$)(?:[1-9][0-9]{0,3}[\s.-]?[0-9]{2,4}[\s.-]?[0-9]{4})|(?:\+81[\s.-]?|0)(?!0)(?:[1-9][0-9]{3}[\s.-]?[0-9]{1,2}[\s.-]?[0-9]{4}))$/;
function validateJapanesePhoneNumber(input: string): boolean {
return japanesePhoneNumberRegex.test(input);
}
// Example
console.log(validateJapanesePhoneNumber("+81 3 1234 5678")); // trueTest Cases
Matches (Valid) | Rejects (Invalid) |
|---|---|
+81 3 1234 5678 | +81 0 1234 5678 |
03-1234-5678 | 031234567 |
+8190-1234-5678 | +82 3 1234 5678 |
090-1234-5678 | 03-12345-5678 |
+81 3-1234-5678 | — |
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
Japanese phone numbers display with hyphens in three groups. Mobile (090-XXXX-XXXX) and landline (03-XXXX-XXXX) have different group sizes. Preserve the grouping format in display.
Technical Notes
Japanese area codes: 03 (Tokyo), 06 (Osaka), 011 (Sapporo). Mobile numbers start with 070, 080, 090 (in domestic format). IP phone (050). +81 replaces the leading 0. Total 10-11 digits.
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