8

Never understood the hate for regular expressions, it's just one more useful tool in my eyes. Anyone want to weigh in?

Comments
  • 1
    I don't understand it, but I like using it
  • 3
    There are two kinds of people in the anti-regex camp:
    1. The people who don't understand them, because they lack fundamental CS knowledge.
    2. The people who witnessed some of the horrors that where created back when Perl was still commonplace.
  • 1
    As useful as they are, they are quite hard to read and debug. But tools like regex101.com are starting to make it much easier
  • 0
    @Alt-Grrr Look at Perl6's Named Regex concept. That is the solution. It allows you to create a regex, give it a name and then reference it in another, more complex regex. It basically enables arbitrarily complex regular expressions while still maintaining readability.
    You can even use that system to create whole grammars that can then be used to parse text with a single method call.
  • 0
    @3141 I tend to do this in TCL, just set a variable to a sub regex, e.g. to match a hex character
  • 0
    It's a powerful tool, but it's way more complicated than it should be
  • 0
    They are like a very hot and sharp knife. You have to make so that it matches your use case exactly otherwise a waste of processing power.
  • 0
    Regex is a powerful, but unfortunately unintuitive tool (see also Git, CSS). This means that people who are forced to work with or learn it often dislike it at first. On the plus side, once you get a complicated Regex to work, you feel like a God
  • 0
    I love regex, they can help you so much and not only in coding, also with any ide, when you need to find replace a lot of changes.
Add Comment