[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: is this behavior correct?
- From: Ben Kelly <ranavin@...>
- Date: Sun, 19 Jun 2011 10:28:01 -0400
On June 14, 2011 08:46:20 AM Philippe Lhoste wrote:
> On 13/06/2011 20:59, Javier Guerra Giraldez wrote:
> > 2011/6/13 john gladkih 599133195<email@example.com>:
> >> that's not standard regexp interpretation.
> > Lua patterns are not regexp
> Certainly not a standard one, at least...
Not *any* one. Lua patterns are missing some features required to act as
regular expressions (the grouping operator () and the alternation operator |,
specifically), while having some additional features (%b) that let them
describe nonregular languages!
This results in the surprising and annoying situation that with lua patterns,
you can describe some languages that you cannot describe with regular
expressions, but at the same time there are many regular languages that you
cannot describe with lua patterns.
> A standard RE implementation, even if not as complete as PCRE, would
> probably be as big as full Lua code itself (including its pattern
> implementation...). And a RE engine isn't hard to plug in, you can find
> several implementations around.
Every time I hear this ("a full RE implementation would be as big as Lua
itself") it always seems to equate "full RE implementation" with PCRE, or
POSIX EREs, or something else that starts with regular expressions and then
adds a huge number of extra features. How big would something be that *just*
adds () and |?