[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: updated draft



On Tue, Nov 26, 2013 at 3:04 AM, John Cowan <cowan@xxxxxxxxxxxxxxxx> wrote:
Alex Shinn scripsit:

> Expensive is the O(n^3) for the next step up the Chomsky hierarchy.
> I think exponential warrants the use of "prohibitively."  The feature
> is included mostly for completeness, for round-trip conversion from
> existing PCRE libraries, and I think the advice that it should never
> actually be used is warranted.

It's awfully handy for things like /<([a-zA-Z][a-zA-Z0-9-]*>[^<]*</\1>/,
though (given some restrictions that often apply in practice, like no
recursive elements and no non-ASCII element names).

BTW, I'll give John the benefit of the doubt that he's only
using this for very quick & dirty Perl one-liners and not
ever saving this in any kind of source file.  It is in fact the
canonical example of when you should stop using regexps.

See http://stackoverflow.com/a/1732454

In Scheme you can use any of the popular HTML parsers
and pattern matching (the tree patterns in (chibi match) are
perfect for this).

Regexps are handy.  Please don't overuse them.

-- 
Alex