lua-users home
lua-l archive

Re: Feature request: plain option for gsub

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


> >function escape( s ) return ( s:gsub( '%p', '%%%1' ) ) end
> 
> I'm a bit puzzled why this one works. `%1` is supposed to refer to the 
> first capture, but there is no capture in your pattern ...
 "if the pattern specifies no captures, then it behaves as if the whole
 pattern was inside a capture."
 http://www.lua.org/manual/5.2/manual.html#pdf-string.gsub

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