Multiple successive "patsubst"s…

Grant Taylor <[email protected]> Tue, 18 Sep 2018 17:26:46 -0600
Newsgroups gmane.comp.gnu.m4.general
Organization TNet Consulting
Message-ID <[email protected]>
I need some help with multiple successive "patsubst" statements.

I have a string of text like "Grant Taylor's Blog (:test:)" (accessible 
to a macro as $2) that I need to escape spaces, apostrophes, colons, and 
parenthesis.  I need the output of the above string to be "Grant\ 
Taylor\'s\ Blog\ \(\:test\:\)".

I can get patsubst to replace one or more occurrences of any single 
character.  But I can't seem to get things correct to replace (escape) 
multiple different characters.

I have looked at the documentation of translit and think that it would 
handle multiple characters, but I don't see how to add the leading 
forward slash to escape said characters.

I think I could do what I want to do with the following regular 
expression in sed.  But I want to do this in m4, for various reasons.

s/\([ :()]\)/\1/g



-- 
Grant. . . .
unix || die
smime.p7s (application/pkcs7-signature, 3.9 KB) - not displayed