[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: validation function
- From: "Aaron Brown" <aaron-lua@...>
- Date: Thu, 25 Aug 2005 09:33:28 -0400
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.