84

"Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems." - Jamie Zawinski

Comments
  • 8
    RegEx is the darkest of the dark arts.
  • 9
    Regexis good for some problems, but once the regex starts to grow and most parts is not real words you look for in a string (like filtering lines from a log) you really should start to question if it's the right tool.

    Once regex get complicated enough they start being a problem since they get hard to follow and can display strange edge cases that are non obvious.

    By that time some other parsing might be better. Or just split it into several separate regex, one for finding possible rows, one for sorting out the wrong once and finally one for extracting out info instead of one doing all three.
  • 1
    User name checks out ✔
  • 4
    @stackodev Nah, that title is reserved to bit shifting. Regex's at least still have letters...
  • 2
    @stackodev agreed but when it works and saves you a bunch of lines of code, dear God does it feel good.
  • 0
    I usually find that the quickest, easiest way to build a regex is with lots of little regexs
  • 1
    @0c370t It makes testing somewhat easier too
  • 0
    \" within a block of \" is never good :D
  • 0
    @Voxera as long as you use the modifier that ignores white space it makes it much easier to keep everything straight on long complicated expressions. Then you can use newlines and white space to make it all nifty.
Add Comment