The Regex Story
lie.1296 at gmail.com
Fri Apr 9 06:48:22 CEST 2010
On 04/09/10 12:32, Dotan Cohen wrote:
>> Regexes do have their uses. It's a case of knowing when they are the
>> best approach and when they aren't.
> Agreed. The problems begin when the "when they aren't" is not recognised.
But problems also arises when people are suggesting overly complex
series of built-in functions for what is better handled by regex.
Using built-in functions (to me at least) is not a natural way to match
strings, and makes things less understandable for anything but very
simple manipulations. Regex is like Query-by-Example (QBE), in database,
you give an example and you get a result; you give the general pattern
and you get a match. Regex is declarative similar to full-blown parser,
instead of procedural like built-in functions. Regex's unsuitability for
complex parsing stems from terseness and inability to handle arbitrary
People need to recognize when built-in function isn't suitable and when
bringing forth pyparsing for parsing one or two is just an overkill.
Unreasonable phobia to regex is just as much harmful as overuse of it.
More information about the Python-list