• (cs)

    \a\w\e\s\o\m\e

  • AH (unregistered)

    Did I get first?

  • Chronomium (unregistered)

    Not bad, it not only recognizes the Canadian A1A 1A1 format, but it doesn't accept illegal letters for the first digit for it.

    Now if only whoever coded the American half did any testing whatsoever. (Or even saw the [0-9]s in the Canadian half, which may be techncially narrower than \d, but what keyboard uses digits outside the 0-9 range?)

  • PZ (unregistered) in reply to Chronomium
    Chronomium:
    ..., but what keyboard uses digits outside the 0-9 range?)

    My keyboard has A to F for when I want to write hex.

  • (cs)

    Perfect example of why regular expressions are NOT for everything.

    Seriously, you really aren't validating a zip code, that would take a lookup into a zip code list or somethign and matching it against the city entered. What you are really doing is simply limiting input, should be an easy task even with regex.

  • pantsman (unregistered)

    TRWTF is entering 'ddddd' instead of just disabling JavaScript.

  • pantsman (unregistered)

    The Other Real WTF is this being a Feature Article instead of a CodeSOD.

  • Aaron M. Greenberg (unregistered)

    That is what you get for using DotNetNuke for your CMS.

  • (cs)

    Ah, zip codes. Sometimes I long for those days where you could enter an international address on site from an American company, but you still needed to provide a zip code. And a state.

    In fact, the hλlf-wits at Valve insist to this very day that I fill in a state, which I dutifully fill in as 'n/a'. Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.

  • Brent (unregistered) in reply to PZ
    PZ:
    Chronomium:
    ..., but what keyboard uses digits outside the 0-9 range?)

    My keyboard has A to F for when I want to write hex.

    Those would be xdigits, not digits.

    Also note that the regex allows for the Canadian postal code of |0|-0|0.

  • Cbuttius (unregistered)

    But my zip code is 908765

  • A (unregistered) in reply to Severity One

    So... you're from the Nation of Brunei, the Abode of Peace?

  • Chronomium (unregistered) in reply to Brent
    Brent:
    Also note that the regex allows for the Canadian postal code of |0|-0|0.
    Right you are, so it looks like both coders were a bit out to lunch here (presumably two people did this, or we wouldn't have the \d attempt in one half and [0-9] in the other half).

    Actually, I keep seeing more errors in the Canadian half the more I look at it. It correctly blocks D, F, I, O, Q, and U out of the first letter (because those letters look too much like other letters), but doesn't do so for the other two letter positions. Yet the first letter can still be "d" - wait, why is lowercase allowed at all?

  • (cs) in reply to Chronomium
    Chronomium:
    Brent:
    Also note that the regex allows for the Canadian postal code of |0|-0|0.
    Right you are, so it looks like both coders were a bit out to lunch here (presumably two people did this, or we wouldn't have the \d attempt in one half and [0-9] in the other half).

    Actually, I keep seeing more errors in the Canadian half the more I look at it. It correctly blocks D, F, I, O, Q, and U out of the first letter (because those letters look too much like other letters), but doesn't do so for the other two letter positions. Yet the first letter can still be "d" - wait, why is lowercase allowed at all?

    I gave up. I'm not that good at regex but this made my eyes bleed.

  • (cs) in reply to Brent
    Brent:
    PZ:
    Chronomium:
    ..., but what keyboard uses digits outside the 0-9 range?)

    My keyboard has A to F for when I want to write hex.

    Those would be xdigits, not digits.

    http://en.wikipedia.org/wiki/Thai_numerals (as a representative sample)
  • Dave (unregistered) in reply to A
    A:
    So... you're from the Nation of Brunei, the Abode of Peace?

    I thought that too. Brunei does of course have districts, he could use that instead.

  • foo (unregistered) in reply to KattMan
    KattMan:
    Perfect example of why regular expressions are NOT for everyone.
    FTFY
    Seriously, you really aren't validating a zip code, that would take a lookup into a zip code list or somethign and matching it against the city entered. What you are really doing is simply limiting input, should be an easy task even with regex.
    Which is what you can reasonably do client-side if you want a quick response (no additional server connection). Sure, it's possible without regex, but the corresponding code (esp. for the Canadian case) would fill a page and thus wouldn't be easier to understand (to someone who has bothered to learn regex syntax).
  • Brad (unregistered)

    Pet peeve of mine; over-validation. Who friggin cares what they enter for zip? If you intend to send out spam mail later; clean addresses then.

  • dogmatic (unregistered)

    TRWTF is not changing your own oil! They use crap oil sometimes recycled at quickie oil change places. Plus it's good for us nerds to get our hands dirty once in a while.

  • dignissim (unregistered) in reply to A
    A:
    So... you're from the Nation of Brunei, the Abode of Peace?
    My bet would be more on Malta.
  • Techpaul (unregistered) in reply to Severity One
    Severity One:
    Ah, zip codes. Sometimes I long for those days where you could enter an international address on site from an American company, but you still needed to provide a zip code. And a state.

    In fact, the hλlf-wits at Valve insist to this very day that I fill in a state, which I dutifully fill in as 'n/a'. Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.

    Post code so accurate they even go down to each dog kennel.

    Possibly with extension for each flea as well

  • (cs)

    In my country, if you want oil change, you go to place you have make purchase of car. Once YOU GIVE them your car, all thing are fixed if you want or not.

    No zip code bull crap.

  • Chelloveck (unregistered) in reply to Brad
    Brad:
    Pet peeve of mine; over-validation. Who friggin cares what they enter for zip? If you intend to send out spam mail later; clean addresses then.

    The ones which really grind me are digit-only phone number and credit card fields. Really, can't the programmer figure out how how strip non-digits out of a text string so I can enter '(123)456-7890' or '1234 5678 9012 3456'?

  • Ross Presser (unregistered) in reply to Techpaul

    Who needs IPv6? Let's just give every device a post code!

  • (cs) in reply to Nagesh
    Nagesh:
    In my country, if you want oil change, you go to place you have make purchase of car. Once YOU GIVE them your car, all thing are fixed if you want or not.

    No zip code bull crap.

    I know you ride a camel to work. You don't gotta lie to kick it.

  • foo (unregistered) in reply to Techpaul
    Techpaul:
    Severity One:
    Ah, zip codes. Sometimes I long for those days where you could enter an international address on site from an American company, but you still needed to provide a zip code. And a state.

    In fact, the hλlf-wits at Valve insist to this very day that I fill in a state, which I dutifully fill in as 'n/a'. Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.

    Post code so accurate they even go down to each dog kennel.

    Possibly with extension for each flea as well

    AKA PostCodev6

  • Chelloveck (unregistered) in reply to foo
    foo:
    Techpaul:
    Post code so accurate they even go down to each dog kennel.

    Possibly with extension for each flea as well

    AKA PostCodev6

    I was really impressed to learn that the postal barcode you see on letters (in the USA, anyway) contains a planet code. "Wow, that's some really progressive future-proofing!" I thought. Imagine my disappointment when I learned that it was something quite more mundane than sending postcards to Mars.

  • Some Jerk (unregistered)

    WTF 1: the developer didn't test it. WTF 2: QA didn't test it. WTF 3: IT IS STILL THERE!

  • genitus (unregistered) in reply to AH
    AH:
    Did I get first?
    No. And you're an arse for trying.
  • OldCoder (unregistered) in reply to dignissim
    dignissim:
    A:
    So... you're from the Nation of Brunei, the Abode of Peace?
    My bet would be more on Malta.
    Almost certainly Iceland.
  • Kevin (unregistered) in reply to Aaron M. Greenberg

    It's also what you get for hiring DotNetNuke developers to do your website. sigh

  • Some Jerk (unregistered) in reply to Kevin

    I still don't even know what DotNetNuke is

  • Cbuttius (unregistered)

    I just tried their form. Lol, they got a booking from a Fred Bloggs...

    I had to enter a valid phone number. They didn't accept 123 456 7890 or some random digits so I just entered their number.

    I tried 12302 as a zip which was their zip and it got rejected. I tried ddddd and it worked.

  • (cs) in reply to Severity One
    Severity One:
    Ah, zip codes. Sometimes I long for those days where you could enter an international address on site from an American company, but you still needed to provide a zip code. And a state.

    In fact, the hλlf-wits at Valve insist to this very day that I fill in a state, which I dutifully fill in as 'n/a'. Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.

    I enter 00000 as the zip code, and if the state is drop-down, I pick CA. Then I put in the street as per normal with the postal code at the end:

    1234 Fake Street V8V 8V8 Fake City, BC, Canada CA 00000

    If they give you two lines for the address: 1234 Fake Street (address one) Fake City, BC (address two) V8V 8V8 (city) CA 00000

    Of course, it's dumb to do this because the shippers will ream you at the border. I bought a $49 housing for my camera and paid a total of $33 in shipping after FedEx was done with it.

  • (cs) in reply to PiisAWheeL
    PiisAWheeL:
    Nagesh:
    In my country, if you want oil change, you go to place you have make purchase of car. Once YOU GIVE them your car, all thing are fixed if you want or not.

    No zip code bull crap.

    I know you ride a camel to work. You don't gotta lie to kick it.

    I bow to your supreme knowledge of geography, Jahanpanah! Tussi great ho! Camels are part of Rajasthan not Andhra Pradesh, you buffoon!

  • (cs) in reply to OldCoder
    OldCoder:
    dignissim:
    A:
    So... you're from the Nation of Brunei, the Abode of Peace?
    My bet would be more on Malta.
    Almost certainly Iceland.
    Definitely not India, then.
  • Anon (unregistered) in reply to dogmatic
    dogmatic:
    TRWTF is not changing your own oil! They use crap oil sometimes recycled at quickie oil change places. Plus it's good for us nerds to get our hands dirty once in a while.

    TRWTF is assholes who think changing their own oil somehow makes them superior.

    My time is worth more than the cost of having somebody else do it.

  • (cs)

    just enter a real address, just not yours but theirs.

  • (cs) in reply to Ross Presser
    Ross Presser:
    Who needs IPv6? Let's just give every device a post code!
    Wrong! Who needs post code? Give every house an IPv6 address.

    FTFY

  • null (unregistered) in reply to Chelloveck
    Chelloveck:
    foo:
    Techpaul:
    Post code so accurate they even go down to each dog kennel.

    Possibly with extension for each flea as well

    AKA PostCodev6

    I was really impressed to learn that the postal barcode you see on letters (in the USA, anyway) contains a planet code. "Wow, that's some really progressive future-proofing!" I thought. Imagine my disappointment when I learned that it was something quite more mundane than sending postcards to Mars.

    the 'planet' you are referring to is actually an acronym PLANET that stands for: 'Postal Alpha Numeric Encoding Technique' and encodes digits 0-9 much as the now deprecated POSTNET (i.e. also an acronym and not a planet, or a galaxy, or a black hole) did.

    CAPTCHA: EARTH is a Planet; PLANET is an acronym

  • (cs) in reply to Anon

    When you consider the time it takes to drive to the Qwiklube and wait for them to get around to changing it, it is probably faster to change your own oil than to have someone else do it. That is assuming you know what you are doing, of course.

  • AN AMAZING CODER (unregistered) in reply to jnewton
    jnewton:
    When you consider the time it takes to drive to the Qwiklube and wait for them to get around to changing it, it is probably faster to change your own oil than to have someone else do it. That is assuming you know what you are doing, of course.

    I work on my own cars: swapping engines, adding performance parts, etc.

    But I DO NOT change the oil in my daily drivers. (I change it on my car with big mods because I don't trust them enough.)

    It's not worth the time and effort. I'll make an appointment, drop it off, work on a project or read a book while they're dealing with it, and then drive back to what I was doing.

  • Zecc when not signed on (unregistered) in reply to pantsman
    pantsman:
    TRWTF is entering 'ddddd' instead of just disabling JavaScript.
    Or fixing the code with Firebug, for bonus points.
  • Neveralull (unregistered)

    The real WTF is taking a car to Midas.

  • Anonymous. (unregistered)

    Two observations.

    1. I don't know if this got fixed since the story went live or the code varies for different browsers, Midas locations, etc, but I've checked appointment booking pages for two locations next to me and they both contained regexp's starting with "(^[0-9]{5}(-[0-9]{4})", not "(^d{5}(-d{4})".

    2. I'm not familiar with modern web development tools, but that code did not look to me like it was written by a person. Maybe the regexp was somehow autogenerated too? What would the original human programmer input look like? Any experts here?

  • Jay (unregistered) in reply to Severity One
    Severity One:
    Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.

    What?! So if two people live in the same house, you have to share a postal code?

  • a cursive recronym (unregistered) in reply to Severity One
    Severity One:
    Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.

    Go back to your side of the Atlantic, Lëtzebuergian, and take your funny ümlauts with you! ;-)

  • (cs) in reply to Brad
    Brad:
    Pet peeve of mine; over-validation. Who friggin cares what they enter for zip? If you intend to send out spam mail later; clean addresses then.

    I agree. This is what's so great about Agile. A minor feature such as zip code validation would probably never even make the product backlog, and if it did, it would receive the proper attention to have it done right.

  • OccupyWallStreet (unregistered) in reply to themagni
    themagni:
    Of course, it's dumb to do this because the shippers will ream you at the border. I bought a $49 housing for my camera and paid a total of $33 in shipping after FedEx was done with it.

    FedEx's reaming is at least $25+tax. UPS' is much worse. That $49 item you bought would've been $50 from UPS, minimum (I've seen it higher).

    The best shipment is via DHL (if supported) or USPS - $5+tax, and sometimes Canada Post doesn't even bother charging you!

    Unless you really need it, if they only offer UPS, go to a competitor. UPS is popular because they make up for their low-cost service by gouging the recipient with various fees and taxes.

    FedEx's is $25 flat, UPS is anywhere from 30-200% from experience (yes, 200%...).

    pantsman:
    TRWTF is entering 'ddddd' instead of just disabling JavaScript.

    That doesn't work if the form requires javascript to submit it. Some onSubmit handlers work that way, annoyingly. Other forms require it or other form things break, horrendously.

    It's one of the nicer things with Chrome - you can easily manipulate the stuff live and make changes. I'm sure firefox can do it, but I haven't figured out how.

  • (cs) in reply to Nagesh
    Nagesh:
    PiisAWheeL:
    Nagesh:
    In my country, if you want oil change, you go to place you have make purchase of car. Once YOU GIVE them your car, all thing are fixed if you want or not.

    No zip code bull crap.

    I know you ride a camel to work. You don't gotta lie to kick it.

    I bow to your supreme knowledge of geography, Jahanpanah! Tussi great ho! Camels are part of Rajasthan not Andhra Pradesh, you buffoon!

    Hey hey hey! My ignorance began the moment I hit the border. Its all India. Camels are used. And you are Nagesh... The shining example of Indian stereotypes. Why are you in such a bad mood? Camel break down?

    On a side note, does that mean I have successfully Trolled Nagesh?

Leave a comment on “Midaslocator.com Zip Codddde Validation”

Log In or post as a guest

Replying to comment #:

« Return to Article