• DaveC (unregistered) in reply to !?

    How about something latin and sexy?

    http://tinyurl.com/yckewje

  • Xythar (unregistered)

    So which travel agent is this, STA? I'm too lazy to actually make up a holiday and go through the booking process to check.

  • Herby (unregistered)

    When dealing with things like Australia and New Zealand, one must remember that Australia thinks of New Zealand as a subsidiary This is how people in the USA think of Canada.

    To which I comment: You mean it isn't?

  • (cs) in reply to spike
    spike:
    Gieron:
    When faced with a problem a lot of people think "I'll use a regexp", now they have two problems.

    No, I don't know what it means either.

    I'm not sure either, but this is the best explanation i could think of.

    By applying regular expressions as a universal solution, all you have done is moved your problem into a new domain, so you have your original problem, and the new problem of writing a regular expression. As far as i can tell, its yet another warning against the golden hammer approach.

    The statement also humorously implies that regular expressions don't solve anything.

    well that's the best i can do. I'm sure if I'm incorrect someone will tell me about it.

    You are wrong.

    The problems are:

    1. people who measure productivity in SLOC
    2. people who use that quote
  • (cs) in reply to John
    John:
    Brillant!

    Do you think maybe Paula wrote it?

  • (cs) in reply to danixdefcon5
    danixdefcon5:
    I think "Australia" has the same name/spelling in most languages. "Nueva Zelanda" does break that regexp though.
    In Soviet Russia Австралия (avstraliya) is called Australia.
  • undefined (unregistered) in reply to julmu

    Вы действительно знаете русский язык или притворяетесь с помощью словаря/википедии/гугла/etc?

  • (cs) in reply to undefined
    undefined:
    Вы действительно знаете русский язык или притворяетесь с помощью словаря/википедии/гугла/etc?
    С помощью википедии. Я русский язык семь лет в школе училься а большинству уже забыл.
  • Burpy (unregistered)

    Why are you guys writing in Wingdings?

  • marvin the martian (unregistered) in reply to Burpy
    Burpy:
    Why are you guys writing in Wingdings?
    Because if you paid to have them on your system you should bloody well use them; else remove.
  • Anonymous (unregistered) in reply to RogerInHawaii
    RogerInHawaii:
    iMalc:
    Being a New Zealander myself I hate those friggin Aussie site versions. The international sites insist that you must use the Aussie one, and the Aussie one insists that you must live in Aussie. At least that's my experience.

    Isn't it possible for the site itself to know where the site visitor is accessing the site from? There are sites I visit that somehow know that I'm accessing it from Honolulu and automatically provide some kind of "localization", such as saying "Aloha" on the welcome screen. So, couldn't these Australian/New Zealand sites know whether the visitor is accessing the site from within either of those countries and automatically redirect the user to the appropriate site?

    This is possible because a website can resolve your IP address and ascertain the top level domain of your ISP, which generally points to the country you are in. However, there are numerous scenarios in which this doesn't work. You might have an ISP that is based in a different country (my work ISP is based in the US even though the company is in the UK, so any site I visit from work thinks I'm American). Alternatively, you might be going through a non-local proxy. What about if you are away from home? You might be away on business in Azerbaijan when you want to book the tickets, in which case the site would assume you are Azerbaijani. All these scenarios preclude the simple route of determining locale based on your IP address. The only sensible way is to test the address field that has been provided by the user, which is exactly what the regex does (even though it does it very badly).
  • Cedric Mamo (unregistered) in reply to marvin the martian
    marvin the martian:
    Burpy:
    Why are you guys writing in Wingdings?
    Because if you paid to have them on your system you should bloody well use them; else remove.

    that made my day... i can't stop laughing

  • (cs)

    The Australian who wrote that first worked for either AT&T or SCO; when working on Altos' SCO UNIX/386 years ago, I ran into this regexp which did an extensive dictionary check on changed passwords:

    /[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]/

    Curiously, at my very next job I met a manager who claimed to always use the word "password" as his password.

  • hoodaticus (unregistered) in reply to halcyon1234
    halcyon1234:
    Why use a regex? It's so inefficient for finding what's effectively a known quantity. They're not searching for any string, they're searching for a particular one. Sure, there's some permutations with capitalization, but those can be checked for with some hard coded values. As long as you put them in the right order, they index search will be faster than the initialization of the regex engine.

    if (inputbox.value == "australia") alert ("You cannot be in australia"); else if (inputbox.value == "australiA") alert ("You cannot be in australiA"); else if (inputbox.value == "australIa") alert ("You cannot be in australIa"); else if (inputbox.value == "australIA") alert ("You cannot be in australIA"); else if (inputbox.value == "austraLia") alert ("You cannot be in austraLiA");

    etc. Nothing a bit of copy'n'paste (or Excel manipulating) can't produce in less time than mucking with a regex could.

    OMG! LOLZ forever WOOT!

  • edric001 (unregistered) in reply to kmarsh

    That's amazing. I've got the same combination on my luggage.

  • hoodaticus (unregistered) in reply to ZaM
    ZaM:
    TRWTF is nobody had yet suggested a server side IP/Country validation and redirection.

    But TRRWTF is the persistent error message in TDWFT still labeled "Worse than failure".

    I assume they would have done that if only tourists never needed to log into their travel website while in Australia.

    LOL - now THAT would be a WTF.

  • noone (unregistered) in reply to Zylon
    Zylon:
    Well, that's different a different way to do it.

    I see what you did there. +1

  • First (unregistered) in reply to O'hagan

    SHENANIGANS!

  • Yardik (unregistered)

    Odd:

    Not sure what it was, but it was logged. A human will eventually look at it. If the problem persists, please Contact Us. If the problem is on the contact form, then ... well ... that pretty much sucks. You can email instead: alexp-at-WorseThanFailure.com.
  • (cs) in reply to DaveK
    DaveK:
    because if you google the original wording the only result you get is this TDWTF thread
    Yeah, I was just paraphrasing it from memory.
  • ysth (unregistered) in reply to RHuckster
    RHuckster:
    Skywalker:
    You call that a regular expression? This is a regular expression!

    Hey, man, that's just a spoon.

    /(?{ print "Ceci n'est pas une expression reguliere." })/

  • undefined (unregistered) in reply to julmu
    julmu:
    Я русский язык семь лет в школе училься а большинству уже забыл.

    Оно и видно. Смотри, как правильно:

    Я русский язык семь лет в школе учил, но большую часть уже забыл.

    Или, если использовать возвратный постфикс, то так:

    Я русскому языку семь лет в школе учился, но большую часть уже забыл.

    Но лучше:

    Я русскому языку семь лет в школе обучался, но большую часть уже забыл.
  • Organizer (unregistered) in reply to Ilya Ehrenburg
    Ilya Ehrenburg:
    Since when is New Zealand not outside Australia? Must be pretty much hated by the Kiwis, that site.

    I'd say New Zealand is part of Australia, the continent. The Bahamas is part of North America, just not the United States of America.

  • BigMick (unregistered) in reply to MicDundee
    MicDundee:
    I confused, I thought Austria's internet country code was .AT
    Then who are the Dutch?
  • Yay - I'm a spammer! (unregistered) in reply to DaveC
    DaveC:
    How about something latin *and* sexy?

    http://tinyurl.com/yckewje

    You're welcome.

    http://intertran.tranexp.com/InterTran?from=eng&to=ltt&type=url&url=http://thedailywtf.com/Comments/RegExp-From-Down-Under.aspx?pg=3#286999&Submit=Translate

    (You'd get a proper link, but apparently I'm a spammer.)

  • RogerWilco (unregistered) in reply to Yay - I'm a spammer!

    I call those big islands down under Nieuw Holland and Nieuw Zeeland. That's what Tasman called them after all.

  • Particle Man (unregistered)

    Folks, there's a good chance that the author knows how to write a more succinct regex. That's not the WTF.

    TRWTF is premature optimization. In particular, character classes are about 1.5x faster than an equivalent expression using ignorecase. See the following: http://weblogs.asp.net/justin_rogers/archive/2004/03/20/93379.aspx http://stackoverflow.com/questions/32010/is-regex-case-insensitivity-slower

  • Jeremy (unregistered) in reply to wee
    wee:
    Yazeran:
    Besides, how many ways are there to spell Australia using 'funny' characters as substitutes to fool this check (or just plain spelling errors)????

    Or, since JavaScript is normally disabled by default, just submit normally.

    Uhhh...excuse me? Since when? Javascript is normally enabled by default.

  • at (unregistered) in reply to Jeremy
    Jeremy:
    wee:
    Yazeran:
    Besides, how many ways are there to spell Australia using 'funny' characters as substitutes to fool this check (or just plain spelling errors)????

    Or, since JavaScript is normally disabled by default, just submit normally.

    Uhhh...excuse me? Since when? Javascript is normally enabled by default.

    lynx says no...

  • moz (unregistered) in reply to Organizer
    Organizer:
    Ilya Ehrenburg:
    Since when is New Zealand not outside Australia? Must be pretty much hated by the Kiwis, that site.

    I'd say New Zealand is part of Australia, the continent. The Bahamas is part of North America, just not the United States of America.

    Interesting. I wouldn't, as I wouldn't want to make myself sound ignorant. It's your choice, though. You may like to look up the words 'Australasia' and 'Oceania' before you do it again, though.
  • Tony P (unregistered)

    The real problem is letting the user type in the name of the country -- you can't possibly check for every variation.

    Left the opportunity to do so, I would probably type in "Aotearoa" -- a perfectly legal and legitimate alternative for "New Zealand", and commonly used within NZ.

  • Pedro (unregistered)

    The regex is pretty bad, but more to the point, who would have a input box to type the country rather than a dropdown!?! oh dear!

  • (cs) in reply to Burpy
    Burpy:
    Why are you guys writing in Wingdings?

    You should know! We've been writing in them for the last 12 WTFs!

  • Bob (unregistered) in reply to swordfishBob
    swordfishBob:
    Yeah, the Real WTF(tm) is what the Kiwis will say when they discover they're now Australia's Florida (call it "Shebangabang").
    Nah, thanks to geography, old Kiwis tend to retire to Australia for the sunshine. They're our Florida, not the other way round.

    Fortunately, by the time they're going senile retiring to Australia raises the average IQ of both countries. :)

    (Also, some people take those jokes a little too seriously...)

  • Mark (unregistered) in reply to APaddyInOz

    There's no 'L' in Ostraya.

  • derrick (unregistered) in reply to halcyon1234

    Dude, WTF? By mentioning Excel you've given yourself away, VBS tosser. I am LMAO @ U

  • kR105 (unregistered)

    Every programmer have a different way to do the same thing, but not all have a compiler in the brain that warn him about his stupid code..

    Captcha: sino.. spanish of "ifnot" lol

  • Hmm (unregistered)

    Expedia, is that you? :-|

  • zeno (unregistered) in reply to halcyon1234
    halcyon1234:
    Why use a regex? It's so inefficient for finding what's effectively a known quantity. They're not searching for any string, they're searching for a particular one. Sure, there's some permutations with capitalization, but those can be checked for with some hard coded values. As long as you put them in the right order, they index search will be faster than the initialization of the regex engine.

    if (inputbox.value == "australia") alert ("You cannot be in australia"); else if (inputbox.value == "australiA") alert ("You cannot be in australiA"); else if (inputbox.value == "australIa") alert ("You cannot be in australIa"); else if (inputbox.value == "australIA") alert ("You cannot be in australIA"); else if (inputbox.value == "austraLia") alert ("You cannot be in austraLiA");

    etc. Nothing a bit of copy'n'paste (or Excel manipulating) can't produce in less time than mucking with a regex could.

    Dude!

    if (inputbox.value.toUppercase() == "AUSTRALIA") alert ("You cannot be in Australia");

  • PinkFloyd43 (unregistered)

    Sure the guy that did this use Regex for everything! Learned an obscure thing and tried to use it everywhere cause it took him years to figure it out!

  • aristos_achaion (unregistered) in reply to Anonymous
    Anonymous:
    RogerInHawaii:
    iMalc:
    Being a New Zealander myself I hate those friggin Aussie site versions. The international sites insist that you must use the Aussie one, and the Aussie one insists that you must live in Aussie. At least that's my experience.

    Isn't it possible for the site itself to know where the site visitor is accessing the site from? There are sites I visit that somehow know that I'm accessing it from Honolulu and automatically provide some kind of "localization", such as saying "Aloha" on the welcome screen. So, couldn't these Australian/New Zealand sites know whether the visitor is accessing the site from within either of those countries and automatically redirect the user to the appropriate site?

    This is possible because a website can resolve your IP address and ascertain the top level domain of your ISP, which generally points to the country you are in. However, there are numerous scenarios in which this doesn't work. You might have an ISP that is based in a different country (my work ISP is based in the US even though the company is in the UK, so any site I visit from work thinks I'm American). Alternatively, you might be going through a non-local proxy. What about if you are away from home? You might be away on business in Azerbaijan when you want to book the tickets, in which case the site would assume you are Azerbaijani. All these scenarios preclude the simple route of determining locale based on your IP address. The only sensible way is to test the address field that has been provided by the user, which is exactly what the regex does (even though it does it very badly).

    Or, you know, you want to book your American girlfriend tickets to see you. Basically, where you are has nothing to do with where you live.

    And, for all the regex hating, this would be equally a WTF if he were trying this via string parsing or token checking or whatnot. It's an awful regex, but TRWTF is that he didn't realize what kind of problem he had.

  • (cs)

    Just write the country name in another language. Isn't French an international postal standard language along with English? So AUSTRALIE or NOUVELLE-ZÉLANDE.

  • Jeremy (unregistered) in reply to at
    at:
    Jeremy:
    wee:
    Yazeran:
    Besides, how many ways are there to spell Australia using 'funny' characters as substitutes to fool this check (or just plain spelling errors)????

    Or, since JavaScript is normally disabled by default, just submit normally.

    Uhhh...excuse me? Since when? Javascript is normally enabled by default.

    lynx says no...

    Even if it is not enabled in Lynx by default, it is still normally enabled by default. Since most users on the Internet are using Internet Explorer or Firefox, it is normally enabled by default.

    http://www.w3schools.com/browsers/browsers_stats.asp

  • (cs)

    So there are now two new countries on Earth:

    Australiaa and New Zealandd

  • http://www.happytiffany.com (unregistered)

    I believe you will like it, shopping will bring endless pleasure

  • http://www.pretty-tiffany.com (unregistered)

    100% 925 sterling silver; made according to original edition at 1:1 ratio Good quality with attractive price Many choice for your consideration on our web site There must one

  • John M (unregistered) in reply to halcyon1234
    halcyon1234:
    Why use a regex? It's so inefficient for finding what's effectively a known quantity. They're not searching for any string, they're searching for a particular one. Sure, there's some permutations with capitalization, but those can be checked for with some hard coded values. As long as you put them in the right order, they index search will be faster than the initialization of the regex engine.

    if (inputbox.value == "australia") alert ("You cannot be in australia"); else if (inputbox.value == "australiA") alert ("You cannot be in australiA"); else if (inputbox.value == "australIa") alert ("You cannot be in australIa"); else if (inputbox.value == "australIA") alert ("You cannot be in australIA"); else if (inputbox.value == "austraLia") alert ("You cannot be in austraLiA");

    etc. Nothing a bit of copy'n'paste (or Excel manipulating) can't produce in less time than mucking with a regex could.

    Either that, or var test = inputbox.value; test = test.toUpperCase(); if (test != "AUSTRALIA") alert ("You cannot be from Australia to use this site");

  • Bryan W (unregistered)

    Another example of why, when I become dictator of the world, I will ban Regular Expressions and CSS. These so-called "technologies" have no business in a world of programmers with the ability to think logically.

  • Daniel (unregistered) in reply to halcyon1234

    Hahahahahaahahahahhaha you're hilarious... I most certainly hope you're joking. But if you're not, please produce some more of your code on this site. Look forward to it!

  • Maxie (unregistered)

    299

Leave a comment on “RegExp From Down Under”

Log In or post as a guest

Replying to comment #:

« Return to Article