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

Re: [StrongED] Re: Regular Search and Replace on a key?



In message <50e1c585c6Lists@xxxxxxxxxxxxxx> you wrote:


> > > While we're on the subject, is there an easy way of doing the RiscOS <>
> > > Linux file path swap? i.e. exchange . and / in a URL?

> Thren you understand exacrtly what I asked. But how do I use it?
> I don't understand scripts and have looked at Lua .. grappling with a
> small amount of Perl is difficult enough. But another language... Life's
> now too short (I'm 66!).

I am 7 weeks short of 71!

What I wrote was the function, not the script. For the script we need
to know to which strings in your StrongED window you want to apply the
function. If to all strings then try this script:

#! lua
do
local lines in io
local slashdot = \(s)
      local slash,dot,pat = '/','.','[%./]'
      local swap = { [slash] = dot, [dot] = slash }
      => (s:gsub(pat,swap)) end -- function
for line in lines(arg[1]) do print(slashdot(line)) end -- for
end -- do

-- 
Gavin Wraith (gavin@xxxxxxxxxxxxxxx)
Home page: http://www.wra1th.plus.com/

-- 
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxxxxx