lua-users home
lua-l archive

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


On 15/05/2007 01:16, Nick Gammon wrote:
Thus, the character "." is defined as a "character class".

Moving onto page 181, the book says:

"A char-set allows you to create your own character classes, combining different character classes and single characters between square brackets".

Indeed, the typology is fuzzy here.

I acknowledge that changing Lua to do this may break a whole heap of regular expressions currently in use,

And in classical regular expressions, [] removes magic from _most_ special chars (except escape char and chars special to this expression), so changing this would be unexpected to most users.

but perhaps the documentation could be clarified to make it clear that a period inside a char-set is "itself" and not "all characters".

Although the Lua doc. tends to rely on "classical programming knowledge" (the principle of least surprise dear to Ruby users), I agree that the documentation might be clarified.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --