In message <
5b2f0c4fb2b...@btinternet.com>
on 7 Feb 2024 Brian Jordan wrote:
> I use a program called !Zonk to produce and edit my websites.
[snip]
> The 'one small problem' is in the naming and location of the finished
> files and seems to be related to some Regex content within an editable
> system file in !Zonk; the relevant stuff seems to be in this segment...
> # these default setups create filenames based on the 'leaf' part of the
> # datafile name, add /htm and put them in an 'htm' directory below the
> # data directory which *must* already exist
> oneout: ((?:[^\.]*\.)*)(\w{1,6})[^\.]*$::htm.\2/htm
> I seem, at some time, to have managed to edit the entry perhaps to
> accomodate long file names.
> oneout: ((?:[^\.]*\.)*)([^/\.]+)[^\.]*$::htm.\2/htm
> Under my current setup the output doesn't incorporate the leafname (just
> /htm)and puts it one directory level above where is intended. Whether
> this is a Pi/Aemulor issue or a Regex one isn't clear to me. I wonder if
> anyone can provide any insight?
Those regular expressions look like they're written in Perl-compatible
syntax. Try looking up PCRE, an open source library which has been
incorporated in PHP and a number of other languages to provide advanced
regular expression support. (PCRE was developed by the same person as the
RISC OS music typesetting system PMS.)
From what you have above, it looks like the part before the "::" is the
pattern to match, and the part after is what to do with it.
The part that goes
((?:[^\.]*\.)*)
will match any a sequence of strings consisting of
[^\.]* -- any number of non-full-stop characters (including zero)
\. -- a full stop
So it would match, for example:
ADFS::HardDisc4.$.This.That.Other.
The second part differs in your two examples. In the first, it matches
between 1 and 6 "word character", i.e. A-Z, a-z, 0-9 or underscore. In the
rewritten example it matches as many characters as possible (minimum 1)
that are not full stop or slash. This part is captured and becomes \2 in
the replacement text.
The final part matches any number of non-full-stop characters, with an
insistence that we reach the end of the string.
The effect is that \2 will match the leafname, excluding any part at the
end of it (if any) introduced with a slash.
I am afraid I have no idea why the program would work differently on the
Pi from on VA. You could try simplifying the expression a bit and see if
that helps. For example:
oneout: ^(.*\.)?([^/\.]+)[^\.]*$::htm.\2/htm
should have the same effect.
--
Matthew Phillips
Durham