http://qs1969.pair.com?node_id=46614


in reply to On XML parsing

And this brings up a point I make from time to time as well. Regular expressions are very well suited to finding patterns in text. They are not suited to general purpose parsing. Trying to use them for that is hard to write, hard to read, hard to be confident you got everything, and you run the risk of exponential failure conditions.

They are beautiful for breaking text into tokens, or finding tokens of interest.

A good analogy is that REs are a great text-processing hammer. But often you need a screwdriver, and sometimes you are dealing with something fragile.

See also related discussion at Why I like functional programming and the CPAN module Parse::RecDescent.