lilypond-user
[Top][All Lists]
Advanced

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

Re: Multiple replacements in one regular expression?


From: Johan Vromans
Subject: Re: Multiple replacements in one regular expression?
Date: Wed, 21 Jan 2015 13:53:53 +0100

On Wed, 21 Jan 2015 11:23:40 +0100
Urs Liska <address@hidden> 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.

-- Johan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]