I'm using this regex to match for zip codes, but it's also matching for 00000 and plus 4. I've been looking into and not topics for regex but have bee
^\d{5}(?:[-\s]\d{4})?$
I'm using this regex to match for zip codes, but it's also matching for 00000 and plus 4. I've been looking into and not topics for regex but have bee
^\d{5}(?:[-\s]\d{4})?$
You could use a negative lookahead to assert that the ZIP code is not 00000
:
^(?!00000\b)\d{5}(?:[-\s]\d{4})?$