[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[StrongED] Re: Regular Search and Replace on a key?
In article <fbcdc2e150.wra1th@xxxxxxxxxxxxxxx>,
Gavin Wraith <gavin@xxxxxxxxxxxxxxx> wrote:
> In message <50e1b4d819Lists@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?
> Can you be more specific about what you want to do? We are presumably
> talking about transforming text, not renaming files. Did you want
> to convert a relative RISC OS filename (relative to the directory
> containing the file containing the text) to the corresponding Linux
> relative filename, so it can be used as a link in a webpage?
> It may not be what you are after but this RiscLua function swaps
> '.' with '/' in strings:
> slashdot = \(s)
> local dot,slash = '.','/'
> local swap = { [dot] = slash, [slash] = dot }
> => (s:gsub(dot,\(c) => swap[c] or c end)) end
> It is an accident that dot is also the pattern that matches any
> character ;). The extra parentheses cut out all the returned values
> except the first; gsub (global substitution) returns not only the
> converted string but also the number of matches, in this case the
> length of the string, and you do not want the second of these.
> This is a function I use in scripts for creating websites on my
> hard disc, in a form ready to be ftp-ed up to a server.
Thren you understand exacrtly what I asked. But how do I use it? I managed
to save it to the Scripts.Lua directory. Then managed to find where that
was and open it (not very easy - Fred how about an Iconbar menu entry
"Open scripts")
Retyped it to Lua.
Dragged it onto the scripts icon of a window containing the RiscOS URL
(shift dragged from disc).
Also tried adding #! lua at the beginning
Ain't nuttin done happen!
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!).
--
Richard Torrens.
http://www.Torrens.org.uk for genealogy, natural history, wild food, walks, cats
and more!
--
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxxxxx