lua-users home
lua-l archive

Re: PatternMatching symbol for magic characters :-)

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


> 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

AltStyle によって変換されたページ (->オリジナル) /