The regex
The failure explanation
validateRegex(
/^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})$/u,
"Not a yyyy-mm-dd date",
) >>
{
valid: true,
input: "1234-12-12",
parsed: {
match: "1234-12-12",
index: 0,
captured: ["1234", "12", "12"],
named: { year: "1234", month: "12", day: "12" },
},
error: null,
};
Validate an input given a regex