Holy hell yeah you did. Hour would you go about doing that in a single expression? A bunch of back references to figure out the country? What if that’s not included? Oy.
You wouldn’t. It’s not possible. Which is what I told them.
Some countries have addresses that are literally ‘Last house on the left by the Big Tree. Bumban(Neighborhood). NN (Country)’. Any US Centric validation would fail this but I assure you mail gets delivered just fine.
The only valid regex is (.+). Maybe add a separate country field (especially because some Americans wholeheartedly believe that the entire world should understand that “foobar, TX” means “foobar, Texas, United States”) (don’t get me started on states whose abbreviations are also ISO country codes).
Unfortunately I guess business people only care about getting fewer support calls for missing shipping details, not correctness or a couple of calls from customers who live in the boonies. Then the proper answer is a form with a bunch of fields… which Americans will inevitably fuck up by making the “State” field mandatory despite most countries not having an equivalent.
What I’d really do is use one of those services that automatically fill on the address using google maps or whatever. Not perfect, probably not free, but a whole lot less work for presumably way fewer PEBCAKs from customers.
Patches@sh.itjust.works 11 months ago
Made that joke in an interview once.
They didn’t think it was funny. Truly thought Regex was the solution to, but never the cause of, all problems.
Dodged a bullet
rob64@startrek.website 11 months ago
Holy hell yeah you did. Hour would you go about doing that in a single expression? A bunch of back references to figure out the country? What if that’s not included? Oy.
Patches@sh.itjust.works 11 months ago
You wouldn’t. It’s not possible. Which is what I told them.
Some countries have addresses that are literally ‘Last house on the left by the Big Tree. Bumban(Neighborhood). NN (Country)’. Any US Centric validation would fail this but I assure you mail gets delivered just fine.
azertyfun@sh.itjust.works 11 months ago
The only valid regex is
(.+)
. Maybe add a separate country field (especially because some Americans wholeheartedly believe that the entire world should understand that “foobar, TX” means “foobar, Texas, United States”) (don’t get me started on states whose abbreviations are also ISO country codes).Unfortunately I guess business people only care about getting fewer support calls for missing shipping details, not correctness or a couple of calls from customers who live in the boonies. Then the proper answer is a form with a bunch of fields… which Americans will inevitably fuck up by making the “State” field mandatory despite most countries not having an equivalent.
What I’d really do is use one of those services that automatically fill on the address using google maps or whatever. Not perfect, probably not free, but a whole lot less work for presumably way fewer PEBCAKs from customers.
peter@feddit.uk 11 months ago
/.+(road|street).+/ resigns