Mastering Regular Expressions 2nd Ed.

Fredrik Lundh fredrik at pythonware.com
Wed Jul 24 11:07:20 EDT 2002


Tom Harris wrote:

> Massive regular expressions are certainly difficult to maintain, and I
> sometimes wonder if they are the best solution to some problems.

when in doubt, the answer is no.

for further discussion, see:

    http://www.google.com/search?q=zawinski+two+problems

> Lexical analysis is tokenisation, parsing is making sense of the
> tokens, is that correct?

exactly.

> Is the moral to leave logic to the programming language, not try to
> use regexes to do it?

exactly.  (why do you ask when you know the answer ;-)

for some discussion on using REs for lexical analysis, and python
to do (simple) parsing, see:

    http://effbot.org/guides/xml-scanner.htm

</F>





More information about the Python-list mailing list