note
gjb
<p>Please make a distinction between regular expressions as known in computer science literature and Perl regular expressions. I know someone like [Abigail-II|you] knows, but many people could get very wrong ideas from a statement such as the above.</p>
<p>Regular expressions in the computer science sense have a subset of the operators Perl regular expressions have, i.e. concatenation, union, kleene star.</p>
<p>Regular expressions describe regular languages, context free grammars describe context free languages and it is known (and fairly easy to prove) that reguular languages are a proper subset of context free languages. Hence you <em>can't</em> parse context free language with a regular expression unless it happens to be a regular language.</p>
<p>Perl regular expressions are more powerful than computer science regular expressions since they've features such as capturing and <code>\1</code>, zero-width assertions and code embedding. It is indeed an open problem what the precise expressive power is.</p>
<p>Sorry for this piece of pedantry, but IMHO it's an important point to make when addressing a very general audience.</p>
<p>Just my 2 cents, -gjb-</p>
308283
308285