question about nasty regex

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Apr 4 01:50:29 EDT 2006


In article <7xacb2fdyt.fsf at ruckus.brouhaha.com>,
 Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:

>"Some people, when confronted with a problem, think ``I know, I'll use
>regular expressions.'' Now they have two problems."  --JWZ

Regexes are good if you need a solution quickly, and you're not 
processing large amounts of data on a regular basis. (How large is 
large? When you're chewing through appreciable amounts of CPU time doing 
it.)

Once you get to that point, it would be more efficient to hand-code your 
own state machine to do the parsing. Of course, doing it in an (even 
partially) interpreted language like Python or Perl would defeat the 
point...



More information about the Python-list mailing list