Test, validate and match regular expressions
This regex matches US postal ZIP codes in both standard 5-digit format (e.g., 12345) and extended ZIP+4 format (e.g., 12345-6789). The optional non-capturing group allows the four extension digits to be separated by either a hyphen or a whitespace character. With the global and multiline flags enabled, it finds all ZIP code occurrences across every line of input, making it ideal for extracting or validating postal codes in addresses, shipping forms, and address-parsing applications.