REGEXVAULTv2.0
Identity & PII/Driver's License Numbers
Verified Safe

Australian Driver's Licence Number Regex for PHP

/^[0-9A-Z]{6,9}$/

What this pattern does

This page provides a lightweight, single-purpose regular expression for matching australian driver's licence number, ported and verified for PHP. Identity and credential patterns need both correctness and safety, since they're frequent targets for adversarial input. 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 Driver's Licence Number
// ReDoS-safe | RegexVault — Identity & PII > Driver's License Numbers

define('AUSTRALIAN_DRIVERS_LICENCE_NUMBER_PATTERN', '/^[0-9A-Z]{6,9}$/');

function validate_australian_drivers_licence_number(string $input): bool {
    return (bool) preg_match(AUSTRALIAN_DRIVERS_LICENCE_NUMBER_PATTERN, $input);
}

// Example
var_dump(validate_australian_drivers_licence_number("12345678")); // bool(true)

Test Cases

Matches (Valid)
Rejects (Invalid)
1234567812345
AB123456ABCDE12345
123456789123-456-789
A12345

When to use this pattern

This pattern is drawn from the Identity & PII > Driver's License 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

Australian states have separate, non-compatible licence formats. A Victorian licence number (1 letter + 8 digits) may look identical to a NSW number in format but they are structurally different.

Technical Notes

State formats: NSW (6 digits), VIC (1 letter + 8 digits), QLD (8-9 digits), WA (7 digits), SA (6 digits + 1 letter), TAS (6-8 digits), ACT (10 digits), NT (10 digits). Use state-aware validation when the state is known.

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