On 21 January 2015 at 14:01, Urs Liska <address@hidden> wrote:>
Hm, it's not as easy as that because the escaping can be quite different,
e.g.
"&" -> "\&"
"\" -> "\textbackslash"
"[" -> "{[}"
etc.
So what I really need is:
match (&)(\)([)
and replace that with
(\&)(\textbackslash )({})
And I would be glad if I wouldn't have to do that with individual runs of
regexp-substitute.
Looks like you can use a callback function with regexp-substitute and
then do whatever
necessary there, eg. (from the Guile manual).
(regexp-substitute/global #f "[a-z]+" "to do and not-do"
'pre (lambda (m) (string-reverse (match:substring m))) 'post)
⇒ "ot od dna ton-od"