Skip to content

Instantly share code, notes, and snippets.

@alexeckermann
Last active November 7, 2017 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexeckermann/8b86b8ba378935ec2b79 to your computer and use it in GitHub Desktop.
Save alexeckermann/8b86b8ba378935ec2b79 to your computer and use it in GitHub Desktop.
Australian Postcode regex hellhole
StatePostcodeMatchers = { SA: /^5([0-9]){3}/, ACT: /^[2](?:[6](?:[0][0-9]|[1][0-8])|[9](?:[0-1][0-9]|20))/,
VIC: /^3([0-9]){3}/, QLD: /^4([0-9]){3}/, NT: /^08(?:[0-9]){2}/, TAS: /^7[0-7](?:[0-9]){2}/, WA: /^6(?:[0-6](?:[0-9]){2}|[7](?:[0-8][0-9]|[9][0-7]))/,
NSW: /^2(?:[0-6](?:[0-9]){2}|[6](?:[1][9]|[2-7][0-9])|[7](?:[0-9]{2})|[8](?:[0-8](?:[0-9]){1}|[9][0-8])|[9](?:[2][1-9]|[3-9][0-9]))/ }
# Probably dont do this.
@Sam-Butler
Copy link

Did you get consumed by said hellhole? Just wondering how far you tested this and what it was based on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment