Forgiving format
Accept input in whatever shape people type it, then quietly clean it up, instead of rejecting it over spaces and dashes.
See it
What it is
A forgiving format accepts input in whatever shape a human types it and normalizes it behind the scenes. Card numbers with spaces, phone numbers with or without the country code, 'example.com' in a URL field, 'next tue' in a date field. Stripe's card inputs and calendar apps that parse natural-language dates are the reference implementations.
Reach for it any time you are about to write a regex that rejects something a person clearly meant. Stripping the spaces and dashes out of a card number is a two-line change and it deletes an entire category of support ticket. Decide it per field, though: the punctuation that is noise in a phone number carries meaning in a password, a coupon code, or an API key. It pairs with constrained input rather than competing with it: constrain what the value can mean, stay loose about how it is typed.
Gotcha: silent normalization is a promise you might break. If the input is ambiguous (11/12/2026 is 11 December in most of the world and 12 November in the US), do not quietly pick one. Echo your reading back in the field or right below it, 'Fri, 11 Dec 2026', so the user can catch you being wrong. And never case-fold or strip a password, an ID, or anything else where the exact bytes are the point.
Ask AI for it
Make these inputs forgiving, defining the normalization separately for each field rather than running one cleanup over everything. Keep the raw text the user typed, normalize at validation time, and never rewrite the field mid-keystroke. Strip only the punctuation that is meaningless for that specific field (spaces and dashes in card and phone numbers, yes; passwords, coupon codes, and case-sensitive identifiers, no), and never case-fold a password or an ID. Parse phone numbers against a known default region instead of guessing a country code, add https:// when a URL arrives without a scheme, and parse dates from several formats including relative phrases like 'tomorrow'. When a value is ambiguous, echo your interpretation back next to the field and get confirmation before saving it.