lua-users home
lua-l archive

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


On 21/07/2011 13:08, steve donovan wrote:
function.escape(s)
     return (s:gsub('[%-%.%+%[%]%(%)%$%^%%%?%*]','%%%1'))
end

(I hope it is correct, since it is from Penlight)

Inside a character class [....], you don't have to escape characters other than:
^ - % ]
I.e., the following characters could be unescaped:
. + [ ( ) $ ? *

--
Shmuel