Re: String search: the need for a "literal" pattern
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: String search: the need for a "literal" pattern
- From: Shmuel Zeigerman <shmuz@...>
- Date: 2011年7月21日 13:18:58 +0300
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