Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Most unusable technology award (my nomination - regular expressions)

Most unusable technology award (my nomination - regular expressions)

Scheduled Pinned Locked Moved The Lounge
csscomalgorithmshelptutorial
65 Posts 40 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C CaptJosh

    I have to say, my tendency would be to have a list of the known postal codes and put that into an array. Then use a string compare to just look for matches to all known postal codes first. Then after that start doing evals to look for things that fit the known formats but aren't on the known list, if possible, presuming each entry is a separate line or item in an array, only putting the lines or items that haven't already matched into a separate array and checking those. Not sure if my solution is more or less complicated. It's probably colored by my experience as a LAMP dev though.

    CaptJosh There are only 10 kinds of people in the world; those who understand binary and those who don't.

    F Offline
    F Offline
    Florin Jurcovici 0
    wrote on last edited by
    #61

    Use a trie instead of a list. The complete list of postal codes is long, you know. Or at least have it ordered, and employ a somewhat optimized search algorithm.

    T 1 Reply Last reply
    0
    • F Florin Jurcovici 0

      Use a trie instead of a list. The complete list of postal codes is long, you know. Or at least have it ordered, and employ a somewhat optimized search algorithm.

      T Offline
      T Offline
      Tim Yen
      wrote on last edited by
      #62

      Best answer to this so far.

      1 Reply Last reply
      0
      • S Stefan_Lang

        Yes, I've considered that too - and most of the XML-related stuff. But at least you have the option to make it halfway readable. It can be a real pain though if you have to delve in to other people's code and the original programmer took no care of naming conventions and formatting...

        T Offline
        T Offline
        Tim Yen
        wrote on last edited by
        #63

        I second that, XML looks like it was designed by a committee. Schema ( huh why use latin words, why not use english words like plan or design or layout) DTD, XSD, XPath oh my god what a mess. Some guy from the Vatican whose first language was Latin must have gone beserk when designing XML.

        S 1 Reply Last reply
        0
        • T Tim Yen

          I second that, XML looks like it was designed by a committee. Schema ( huh why use latin words, why not use english words like plan or design or layout) DTD, XSD, XPath oh my god what a mess. Some guy from the Vatican whose first language was Latin must have gone beserk when designing XML.

          S Offline
          S Offline
          Stefan_Lang
          wrote on last edited by
          #64

          Schema, yes I like that. When I think about it, the whole system of *ML languages looks like a database schema. And maybe that's all it really is: a glorified text-based database schema, only that instead of a computer, the programmers are supposed to work their way through it. Me, I prefer SQL.

          1 Reply Last reply
          0
          • A Andrew Wiles

            Every now and then I need to solve a problem for which regular expressions looks like it is the "perfect" answer. Today that happens to be validating and extracting UK postal codes from addresses. BUT Every time I try to use regular expressions I find that no-one (especially me) has a clue how to use them and that all "posted" solutions can be demonstrated as flawed and therefore dangerous to use. The sheer complexity of the expressions makes them virtually impossible to read and therefore understand. I post the wikipedia solution to demonstrate my case (GIR 0AA)|(((A[BL]|B[ABDHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K [ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKLMNOPRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV] |YO|ZE)[1-9]?[0-9]|((E|N|NW|SE|SW|W)1|EC[1-4]|WC[12])[A-HJKMNPR-Y]|(SW|W)([2-9]|[1-9][0-9])|EC[1-9] [0-9]) [0-9][ABD-HJLNP-UW-Z]{2}) Can anyone think of a less usable technology?

            www.it-workplace.com
            "If a man speaks in a forest where there is no woman to hear him, is he still wrong?"

            D Offline
            D Offline
            Dale Willits
            wrote on last edited by
            #65

            I feel very lucky to only have 7 digits as postal codes.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups