lua-users home
lua-l archive

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


On Tue, Aug 27, 2019 at 2:46 PM Scott Morgan <> wrote:
> Is there a limit to how big those sets can be? In practice I'd be
> looking at a few dozen allowed chars.

Its trivially easy to test. Assuming you only use the printable subset
of the ascii set you wanted to use:

Lua 5.3.3  Copyright (C) 1994-2016, PUC-Rio
> a=''; for i=32,126 do a=a..string.char(i) end; print(a)
> b=a:gsub("([%%%-%]])","%%%1"); print(b);
> print(a:gsub("[^"..b.."]","x"))
> print(a:gsub("["..b.."]","x"))

I do not have a 5.1 handy, but you can test it easily, and given how
char classes are usually made ( I haven't looked in lua, but I've seen
several ), they normally are unlimited, specially when dealing with

Francisco Olarte.