http://www.perlmonks.org?node_id=272351


in reply to Re: Re: Scraping HTML: orthodoxy and reality
in thread Scraping HTML: orthodoxy and reality

Parsing is the task of taking structured information and analyzing the structure. This is a very different task, and regular expressions (as they currently are) are simply not designed to do it.

Parsing typically has two phases though, the first is Tokenization and the second Parse Tree Generation (Im sure there is a better term but I forget what it is). These phases more often then not occur in synch but they need not. Either way regexes are perfectly suited to tokenization.

I learned the most about regexes from writing a regex tokenizer and parser. I learned a lot more from the tokenizer than from the parser tho. :-) Writing regexes to tokenize regexes is a fun head trip. (Incidentally the whole idea was to be able to use regexes to specify and generate random test data.)


---
demerphq

<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...