Can regexes be legible?

    Date: 12/16/06 (Javascript Community)    Keywords: no keywords

    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan


    I've found recently there's a very strong attitude in favor of making code simple and well-organized at the cost of efficiency, rather than trying to do things in a clever manner that makes it very difficult to understand if you're not the person that wrote it (and even then, if you didn't write it recently). Now, I'm sure that this isn't a recent phenomenon, but it's something that I've really only recently become aware of.

    Anyways, my question is this... Regular expressions: is there a way to write them that's easily legible? By their very nature, they seem horrendously arcane and indecipherable, yet totally invaluable. The only thing I can think of is basically just bitin the bullet and writing it, then spending several lines in comments dissecting what you just did bit-by-bit. Is there a better way?

    Source: http://community.livejournal.com/javascript/120264.html

« WANTED: form generator. || Looping through an array of... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home