[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Multiple successive "patsubst"s…
From: |
Grant Taylor |
Subject: |
Multiple successive "patsubst"s… |
Date: |
Tue, 18 Sep 2018 17:26:46 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
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
Description: S/MIME Cryptographic Signature
- Multiple successive "patsubst"s…,
Grant Taylor <=