REGEXVAULTv2.0
Localization/Phone Numbers
Verified Safe

Australian Phone Number Regex for Python

/^(?:\+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 Python. A rigorously tested regex reduces debugging time and protects your application from edge-case failures. The snippet below is ready to drop into your Python project — whether you're validating in a Django view, a FastAPI endpoint, or a standalone data processing script.

Python Implementation

Python
# Australian Phone Number
# ReDoS-safe | RegexVault — Localization > Phone Numbers

import re

australian_phone_number_pattern = re.compile(r'^(?:\+61|0)(?:\s|-)?(?:[2-578])(?:[\s.-]?[0-9]{4}){2}$|^(?:\+61|0)4[0-9]{2}(?:[\s.-]?[0-9]{3}){2}$')

def validate_australian_phone_number(value: str) -> bool:
    return bool(australian_phone_number_pattern.fullmatch(value))

# Example
print(validate_australian_phone_number("+61 2 9374 4000"))  # 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 Python developers because particularly important in Python web servers where CPU-bound regex operations can stall concurrent request handling. 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