Mastering Regular Expressions 2nd Ed.

Kristian Ovaska kristian.ovaska at helsinki.fi
Thu Jul 25 04:46:26 EDT 2002


Tom Harris <TomH at optiscan.com>:
>Massive regular expressions are certainly difficult to maintain, and I
>sometimes wonder if they are the best solution to some problems.

It's strange that while regular languages are a small subset of real,
Turing-complete languages, it's very hard to read or write any
non-trivial regexp. The syntax is straight out of computer science
mathematical notation (with some extensions) and is not suitable for
anything complex. It's bit like programming for the Turing machine. On
the other hand, the syntax is compact and IS suitable for simple
tasks.

I'm sure there are alternative regular languages that are more
readable, altough I've never come across one. The problem of such
languages is, I guess, that since they are more verbose than this very
compact CS notation, you can't just wrap them in a string, but would
need to expand the underlying language (Python in this case).

-- 
Kristian Ovaska <kristian.ovaska at helsinki.fi>



More information about the Python-list mailing list