What can I do to comprehensively validate an Australian Phone Number? I need this for an application I'm writing. You can assume it is dialed from within Australia. I want to use a white-list approach.
Here are my rules so far (after removing any whitespace):-
Is there anything I have missed?
Area codes are required as we may be sending a fax from our fax server in one state when the user is in a different state.
(I'm not asking how to make a regexp out of the above rules, but if those rules are correct).
See also:
UK Phone Numbers
US Phone Numbers
I did a similar thing a while ago. The Wikipedia page that unthinkableMayhem mentioned was a great starting point.
As of a year ago, my rules looked something like:
02[3-9]\d{7} NSW/ACT
03[4-9]\d{7} VIC/TAS
07[3-9]\d{7} QLD
08\d{8} SA/NT/WA
04[\d]{8} Moblies 04x[123] = Optus, 04x[456] = Voda, 04x[0789] = Telstra
0500[\d]{6} Find me anywhere server
0550[\d]{6} VoIP
059[\d]{7} Enum
13[\d]{4} Local rate
1300[\d]{6} Local rate
1800[\d]{6} Free call
0198[\d]{2} Data networks (local call anyway I think)
0198[\d]{6}
190[\d]{7} Premium rate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With