[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: String search: the need for a "literal" pattern
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 21 Jul 2011 12:08:54 +0200
On Thu, Jul 21, 2011 at 12:05 PM, Dirk Laurie <dpl@sun.ac.za> wrote:
> Quick workaround: devise a pattern that matches `item` and no other
> substring of `str`.
Or just use something like this to un-magic the string?
function.escape(s)
return (s:gsub('[%-%.%+%[%]%(%)%$%^%%%?%*]','%%%1'))
end
(I hope it is correct, since it is from Penlight)
steve d.