Link Details

Link 967863 thumbnail
User 448255 avatar

By dotCore
via bradt.ca
Published: May 13 2013 / 09:31

If you develop in Perl, PHP, Python, Ruby, Javascript (or pretty much any other language with its roots in Unix) and don’t know regular expressions, you are missing a critical piece. And if you’re intentionally avoiding regular expressions, it’s like you’ve torn pages out of YOUR manual, but everyone else’s manual is complete.
  • 7
  • 0
  • 464
  • 592

Comments

Add your comment
User 368023 avatar

yakkoh replied ago:

0 votes Vote down Vote up Reply

regex have many missing parts: (1) you can't match a column number like \col{72}; (2) regex are not 'open': they don't have a construction kit and you can't bring your own functions; (3) the notation is atrocious; ...

User 218789 avatar

eelmore replied ago:

0 votes Vote down Vote up Reply

Like any tool, regexes have appropriate applications and less appropriate applications. They're not meant to be a matching tool for all applications, nor are they meant to be their own programming language. They do, however, cover such a mind-blowingly large set of applications that it's insane to not at least consider a regex solution.

User 282815 avatar

Infernoz replied ago:

1 votes Vote down Vote up Reply

Regex's should be treated as a filter to match and separate text data; they are designed to be terse, so rapid to parse and compile into an /optimised/ state machine, so it is silly to complain about the lack of function support and the notation used. 1. Position matching could cripple state machine optimisations and complicate the state machine, unless you did something like /^.{71}(.)/, which may not give useful results. 2. Of course not, it is a special purpose search expression grammar, not a language; functions could not be optimised and will probably cause unwanted side-effects. 3. Again it is a designed to be a rapid to parse expression grammar, so it won't be very readable until you learn it. Using inserted functions for searching can be very inefficient, as people have discovered with SQL, because they can't be optimised there either, because there is nothing to in-line unless it exposes interpretable code and is running in a sophisticated runtime optimising VM, like a JVM.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (7)



Voters Against This Link (0)



    Spring Integration
    Written by: Soby Chacko
    Featured Refcardz: Top Refcardz:
    1. Search Patterns
    2. Python
    3. C++
    4. Design Patterns
    5. OO JS
    1. PhoneGap
    2. Spring Integration
    3. Regex
    4. Git
    5. Java