[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Patterns: Why are anchors not character classes?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 16 Jul 2015 09:53:14 -0300
> Taking up my own challenge, I discovered that it is much trickier than
> I thought. `[set]` is hardcoded to match one character of the subject or
> to report no match.
This is not hardcoded only in the code. It is "hardcoded" in the
definition of a character class:
Lua 5.3 Reference Manual, 6.4.1:
A character class is used to represent a set of characters.
Set of characters cannot contain empty strings...
BTW, I am not sure this is relevant to this discussion, but we can use
%f[^\0] to match the beginning of a subject and %f[\0] to match its end
(assuming the subject does not have embedded zeros). Of course, %f is
not a character class, either.
-- Roberto