Advertisement
Data Processing

The Regex Ladder: The Strictest Date Pattern Rejects 87.5% of Perfectly Good Dates

Every date in the test file was valid. Eight hundred dates, every one of them a real calendar date, written in eight formats that appear constantly in...

Every date in the test file was valid. Eight hundred dates, every one of them a real calendar date, written in eight formats that appear constantly in exported data — and the strictest regular expression in the test, a textbook ISO pattern, accepted only one hundred of them. It rejected 700 of 800, a miss rate of 87.5%, not because the data was dirty but because the pattern was narrow. Loosening the pattern rung by rung recovered the file in stages — 300, 400, 600, finally all 800 — and the two formats that held out longest were not exotic edge cases. They were dates with the month written as a word.

What The Regex Ladder means

The Regex Ladder means the staged recovery curve produced when a validation pattern is loosened step by step over the same fixed set of valid values, with the match rate recorded at each rung. It reframes pattern strictness as a measurable trade: every rung of the ladder buys back a known share of legitimate data, and the bottom rung — the strictest pattern a team is likely to paste from a style guide — has a price that can be stated in numbers. A pattern does not have to be wrong to do damage. It only has to be narrower than the formats its data actually arrives in, and the ladder shows exactly how much narrower, format by format.

The five rungs

The test file held 800 valid dates, 100 in each of eight written forms. Against it stood five patterns of increasing generosity. The strictest, an ISO-only pattern, matched 100 of 800 — 12.5% — accepting only the canonical form and turning away seven valid formats. The second rung matched 300 (37.5%). The third reached 400 (50%). The fourth reached 600 (75%). Only the fifth and broadest rung matched all 800, 100% (Source: SmartDataAI import test U1, run 2026-11-23; script and result JSON filed with this batch's evidence pack).

The Regex Ladder: The Strictest Date Pattern Rejects 87.5% of Perfectly Good Dates

The order in which formats returned is the instructive part. Numeric variations — different separators, different field orders — came back in the middle rungs, each worth a hundred or two hundred dates. The last two hundred, recovered only at the broadest rung, were the two month-name formats, a hundred dates each: the dates a human reads most easily were the ones the patterns handled worst. A validation rule assembled from numeric assumptions does not merely miss the word-based formats by a little; it misses them entirely, at every rung below the top, because no amount of separator-tolerance admits a month spelled "March".

The rungs are not evenly spaced, and their spacing carries information. Moving from the strictest pattern to the second rung recovered 200 dates at once — the single biggest jump on the ladder — while the step from the second rung to the third recovered only 100, and the last two steps recovered 200 each (derived by subtracting the cumulative counts). A team loosening its pattern one notch at a time would feel the returns arrive in lumps, because formats are not a continuum: each rung admits whole families of writing at once. That lumpiness cuts both ways. It means one well-chosen relaxation can rescue a quarter of a file in a single change — and it means the distance between "our pattern is slightly too strict" and "our pattern discards most of the file" can be a single rung, invisible until somebody counts what the filter threw away.

It also suggests a better use for strict patterns than filtering. Run the ladder in reverse — broadest pattern first to admit, strictest patterns afterwards to classify — and the same five patterns stop destroying data and start describing it: every date lands in exactly one rung's bucket, labelled by how canonical its format is, and nothing is lost on the way in. The ladder measures what strictness costs as a gate; used as a classifier, the identical patterns cost nothing at all. The difference between the two designs is not the patterns. It is whether rejection happens before or after the data is safely inside.

Translate the ladder into an import pipeline and the stakes sharpen. A strict pattern used as a filter does not flag the 700 rejected dates for review in most real systems — it drops them, or routes them to an error file nobody opens, or coerces them to null. The data loss is silent precisely because the pattern is doing what it was written to do. The ladder's lesson is that "valid format" is a property of the agreement between pattern and data, not of the data alone: the same 800 dates are 12.5% valid under one rule and 100% valid under another, and nothing about the dates changed.

How this was measured

The test dates were synthetic, generated by the test script itself from known-valid calendar dates and rendered into eight written formats, a hundred of each. The five patterns were fixed in advance, ordered from strictest to broadest, and each was run over the whole file with the script's own deterministic matching logic; the run is reproducible from a fixed seed of 42 and was repeated to a byte-identical result file. The exercise measures the behaviour of patterns against constructed formats — it is not an evaluation of any commercial validation product, and the counts are stated as constructed: 800 values, eight formats, five patterns.

Questions, answered

Were any of the 800 dates actually invalid? No — that is the design of the test. Every value was a genuine calendar date in one of eight formats, so every rejection by a pattern is a false rejection of good data. The ladder measures over-strictness, not dirtiness.

Which formats survived longest against the patterns? The two that spell the month as a word, a hundred dates each. They returned only at the broadest rung, after every numeric variation had already been recovered.

Should every import therefore use the broadest pattern? Not blindly. A broad pattern accepts more, including things a pipeline may genuinely want to refuse. The ladder's point is narrower: choose the rung knowingly, with its recovery rate in view — 12.5% at the strictest rung is a data-loss decision, whether or not anyone realised they were making it.

Does a 100% match rate at the top rung mean the data is clean? It means the data and the pattern agree. The same file is fully valid under the broadest pattern and mostly invalid under the strictest, so a match rate says as much about the rule as about the file it was run over.

Summary

Eight hundred valid dates met five patterns of increasing generosity, and the match rates climbed a ladder: 12.5%, 37.5%, 50%, 75%, 100%. The strictest pattern falsely rejected 87.5% of good data, and the month-name formats — the most human-readable in the file — were the last to be readmitted. The Regex Ladder turns pattern strictness from a matter of taste into a measured quantity: every rung has a recovery rate, and the bottom rung's price is 700 dates in 800.

Sources

Know someone who needs this? Share it.

Advertisement