lua-users home
lua-l archive

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


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.