lua-users home
lua-l archive

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

Antero Vipunen wrote:

>   if find(s, '[%.,\\"]') then return "weird chars" end

Normally the percent sign ("%") is necessary to escape magic
characters such as the dot (".") inside patterns, but here
it's not, because we're inside square brackets.  (The
percent sign would still be necessary to escape itself,
though, because even inside square brackets it has a special
meaning of introducing character classes such as "%a".)

For example: the pattern "." matches any single character,
the pattern "%." matches a single dot, the pattern "[.,]"
matches a single dot or comma, and the pattern "[.%%]"
matches a single dot or percent sign.