Catch a US ZIP code (5 digits, optional +4).
Validation⚡⚡⚡⚡⚡
Validation⚡⚡⚡⚡⚡
Catch · 0/5
- 94103-0001Target
- 00501Target
- 90210Target
- 10001-1234Target
- 12345Target
Spare · 0 hit
- 1234Innocent
- 123456Innocent
- ABCDEInnocent
- 9021aInnocent
- 90210-Innocent
Your pattern
About this pack
Intermediate · 8 levels
Format validators covers the inputs real forms ask for: US ZIP codes, dollar prices, emails, phone numbers, ISO dates, passwords, card numbers and hashtags. It suits players who are comfortable with classes and quantifiers and want to combine them.
Each board lists valid values next to the mistakes a validator must turn away. A ZIP code like 90210 is caught and 1234 is spared, a price like $19.99 is caught but $05 isn’t, and an ISO date stops at month 12, so 2026-13-01 is spared. The password board needs lookahead to ask for a letter and a digit at the same time.
Every level also has hidden checks: words you don’t see. Passing the words on screen solves a level; passing the hidden checks too ranks it.
The Real-world validators track explains how to keep these patterns strict without making them unreadable. For validators outside web forms, try Code & identifiers.