[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PatternMatching symbol for magic characters :-)
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 15 Jun 2015 12:28:49 -0300
> I'm in Lua exploration, and I want to use its pattern matching.
> Basically I read strings form a file and use that has pattern to
> scan program code...
>
> so here my suggestion ...
>
> Can we have a "%m" symbol representing lua "magic" characters set ?
> basically this "^$()%.[]*+-?"
>
> so it will be more nice to scan my source file and put exception
> characters in it.
> and it will help writing more nice pattern when using in complex pattern
You can use %p (or, if you are an ANSI-C zealot, %W) for that job. Lua
ensures that any non-alphanumeric character can be escaped with '%' to
mean itself.
-- Roberto