On Tue, Sep 01, 2020 at 06:22:02PM +0100, Sharon Kimble wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > Thanks for replying Tomas. > writes: You're welcome :-) [...] > >> - --8<---------------cut here---------------start------------->8--- > >> \uuline{foo} > >> - --8<---------------cut here---------------end--------------->8--- [...] > >> - --8<---------------cut here---------------start------------->8--- > >> /\uuline{foo}/ > >> - --8<---------------cut here---------------end--------------->8--- [...] > Okay, being very specific, all of '\uuline{foo}' remains, but with a > forward slash at the beginning and end of '\uuline{foo}' to achieve this > '/\uuline{foo}/' Ah, got it now. Regular expressions seem to be your friends here. I'm assuming your foo is a placeholder, and varies from instance to instance. I'm further assuming the "foo"s don't contain a closing curly brace (we'd have to refine things otherwise). Try M-x (i.e. Meta-x) and then "query-replace-regexp". It asks you first for the regular expression, which will be \\uuline{[^}]*} (note the double backslash: that's because a backslash has a special meaning in regular expressions, and you have to "escape" it with another backslash; this regexp roughly states: "a backslash followed by uuline, followed by an opening curly, followed by zero or more (that's the star) characters which aren't a closing curly followed by a closing curly). You finish that part with ENTER. Then you're asked for the replacement. You enter /\&/ Which means: "a slash, followed by whatever you just matched (that's the "\&" part, only one backslash this time) and a slash. Make a backup of your file first :-) Regular expressions are very powerful, but sometimes confusing. It pays off big time to wrangle them! Good luck - t