Validating zip code
^ # Assert position at the beginning of the string.
You can look up cities by ZIP code, or ZIP codes by city and state or address, at https://com/zip4/. Techniques used in the regular expressions in this recipe are discussed in Chapter 2. Both a result set containing the valid codes as a result set containing the invalid codes will be outputted. These codes can be anything: passwords, postalcodes, e-mail addresses, creditcard numbers, and much more.