[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [StrongED] Regular Search and Replace on a key?
In message <fbcdc2e150.wra1th@xxxxxxxxxxxxxxx> you wrote:
> slashdot = \(s)
> local dot,slash = '.','/'
> local swap = { [dot] = slash, [slash] = dot }
> => (s:gsub(dot,\(c) => swap[c] or c end)) end
and this one looks a bit neater:
slashdot = \(s)
local slash,dot,pat = '/','.','[%./]'
local swap = { [dot] = slash, [slash] = dot }
=> (s:gsub(pat,swap)) end
--
Gavin Wraith (gavin@xxxxxxxxxxxxxxx)
Home page: http://www.wra1th.plus.com/
--
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxxxxx