builtin regular expressions?

Jorgen Grahn grahn+nntp at snipabacken.dyndns.org
Sun Oct 1 10:24:40 CEST 2006

On Sat, 30 Sep 2006 20:01:57 +0100, Thorsten Kampe <thorsten at thorstenkampe.de> wrote:
> It's originally from Jamie Zawinski:
> 'Some people, when confronted with a problem, think "I know, I'll use 
> regular expressions." Now they have two problems.'
> And the simple reason why Regular Expressions are not a part of the 
> core Python language is that Regular Expressions are overrated.

It seems to me they are currently /underrated/ in the Python community. Or,
I suspect, everybody disrespects them in public but secretly use them when
they're hacking ;-)

> They are simply not the preferred tool for every kind of text manipulation 
> and extraction.

Oh yes, agreed there.  str.split, str.startswith, substr in str ... take you
a long way without a single backslash. I use them more frequently these
days; for example, I would have solved the original poster's problem in that

However, there is a set of common problems which would be hell to solve
without regexes. I used to do that stuff in C when I was young and stupid;
now would never go back to hand-coded, buggy loops just for the sake of
avoiding regexes.

Possibly I have more need of regexes than some others, because I do a lot of
traditional Unix programming, which is heavy on text processing and
text-based mini-languages.


  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.dyndns.org>  R'lyeh wgah'nagl fhtagn!

More information about the Python-list mailing list