Am 21.01.2015 um 13:53 schrieb Johan Vromans:
On Wed, 21 Jan 2015 11:23:40 +0100
Urs Liska <[email protected]> wrote:
#(set! str
(regexp-substitute/global #f "&" str
'pre "\\&" 'post))
However, this approach will get quite cumbersome (and expensive) when
there are numerous characters to be escaped. Therefore I'd like to know
if I can "fold" them in one regular expression substitution.
I don't know what implementation of regular expression matching scheme
uses, but you should be able to specify a character set (group of
characters) to match, capture the matching character, and replace it by
itself with "\\" prepended.
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.
Urs
-- Johan
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user
--
Urs Liska
www.openlilylib.org
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user