lua-users home
lua-l archive

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


On 11/04/13 23:45, Pierre-Yves Gérardy wrote:
> In the section about patterns, the following line puzzles me:
>
>> The interaction between ranges and classes is not defined. Therefore, patterns like [%a-z] or [a-%%] have no meaning.
> In the second pattern, '%%' is actually the escape sequence for %, not
> a character set. "[a-%%]" is an empty set, because 'a' > '%', but
> nevertheless, it looks out of place in that sentence.
>
> That line is present in the manual since at least v5.0, which leads me
> to think that I may be missing something...
>
> What gives?
>
> -- Pierre-Yves
>
If you look into the source, when you write %+ you actually create a
character class consisting of a single character, '+', same with %%
http://www.lua.org/source/5.1/lstrlib.c.html#match_class

/* mniip */