lua-users home
lua-l archive

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


> 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