1012
GoOn (programming.dev)
you are viewing a single comment's thread
view the rest of the comments
[-] Patches@sh.itjust.works 20 points 1 year ago* (last edited 1 year ago)

Made that joke in an interview once.

They didn't think it was funny. They truly thought Regex was the solution to, but never the cause of, all problems.

They wanted to make a Regex to verify every single address in the world. Dodged a bullet

[-] rob64@startrek.website 9 points 1 year ago* (last edited 1 year ago)

Holy hell yeah you did. How 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 16 points 1 year ago* (last edited 1 year ago)

You wouldn't. It's not possible. Which is what I told them.

And why would you want to? Legally if you change the given address, and it fails to get delivered - that is on you. Not 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 4 points 1 year 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.

[-] Natanael@slrpnk.net 4 points 1 year ago

If you're using one of those services then PLEASE allow manual entry / override because I've had forms like that which I were blocked from filing in because it didn't acknowledge that my address existed.

[-] peter@feddit.uk 3 points 1 year ago

/.+(road|street).+/ resigns

this post was submitted on 15 Nov 2023
1012 points (95.7% liked)

Programmer Humor

19821 readers
956 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS