Regular Expressions 101

Community Patterns

NSW Residential Zip Code

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^2(([0-5]\d{2})|([6-8](([1][9])|([2-9]\d)))|([9](([2][1-9])|[3-9]\d)))$
/
gm

Description

The convention is found on this: https://en.wikipedia.org/wiki/Postcodes_in_Australia

Values accepted:

  • 2000—2599
  • 2619—2899
  • 2921—2999
Submitted by Minh Dang - 2 years ago