REGEXVAULTv2.0
Localization/Phone Numbers
Verified Safe

Australian Phone Number Regex for PHP

/^(?:\+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 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
<?php
// Australian Phone Number
// ReDoS-safe | RegexVault — Localization > Phone Numbers

define('AUSTRALIAN_PHONE_NUMBER_PATTERN', '/^(?:\+61|0)(?:\s|-)?(?:[2-578])(?:[\s.-]?[0-9]{4}){2}$|^(?:\+61|0)4[0-9]{2}(?:[\s.-]?[0-9]{3}){2}$/');

function validate_australian_phone_number(string $input): bool {
    return (bool) preg_match(AUSTRALIAN_PHONE_NUMBER_PATTERN, $input);
}

// Example
var_dump(validate_australian_phone_number("+61 2 9374 4000")); // bool(true)

Test Cases

Matches (Valid)
Rejects (Invalid)
+61 2 9374 4000+61 0 1234 5678
02 9374 40000192 345 678
+61412345678+61 2 1234 567
0412 345 67802 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 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

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