Australian Phone Number Regex for JavaScript
/^(?:\+61|0)(?:\s|-)?(?:[2-578])(?:[\s.-]?[0-9]{4}){2}$|^(?:\+61|0)4[0-9]{2}(?:[\s.-]?[0-9]{3}){2}$/What this pattern does
This page provides a comprehensive, battle-tested regular expression for matching australian 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
// Australian Phone Number
// ReDoS-safe | RegexVault — Localization > Phone Numbers
const australianPhoneNumberRegex = /^(?:\+61|0)(?:\s|-)?(?:[2-578])(?:[\s.-]?[0-9]{4}){2}$|^(?:\+61|0)4[0-9]{2}(?:[\s.-]?[0-9]{3}){2}$/;
function validateAustralianPhoneNumber(input: string): boolean {
return australianPhoneNumberRegex.test(input);
}
// Example
console.log(validateAustralianPhoneNumber("+61 2 9374 4000")); // trueTest Cases
Matches (Valid) | Rejects (Invalid) |
|---|---|
+61 2 9374 4000 | +61 0 1234 5678 |
02 9374 4000 | 0192 345 678 |
+61412345678 | +61 2 1234 567 |
0412 345 678 | 02 9374 40000 |
+61 8 9321 0000 | — |
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
Australia's 10-digit numbers (2 area code + 8 local) replaced the older variable-length system in the late 1990s. Historical data may have shorter numbers.
Technical Notes
Australian area codes: 02 (NSW/ACT), 03 (VIC/TAS), 07 (QLD), 08 (SA/WA/NT). Mobile numbers start with 04 (04xx = 10-digit mobile). 05 is reserved. +61 replaces the leading 0.
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