> On 2022-07-06, at 17:31, Kaushal Modi wrote: > No period after "1.1" above - makes things slightly more difficult. Right, I repaired those manually before running queery resplace > This might be a bit overzealous if there are more numbers with a period > after them. Another way would be to add ^\(\**\) at the beginning of > the regex (and a \1 in the replacement) and go through the file as many > times as there are nesting levels. Ah ok, but right now Kaushal's proposed solution is good enough for me > You could also try Elisp as the replacement - see > https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexp-Replace.html, > https://www.masteringemacs.org/article/evaluating-lisp-forms-regular-expressions > and > http://mbork.pl/2013-09-18_Selective_replacement_in_LaTeX_documents_(en) . > You could probably use keyboard macros, too - see e.g. > http://mbork.pl/2021-02-20_Using_keyboard_macros_to_emulate_query_replace . I thought about this, but usually I end up faster using a function (or query replace) there was a time a liked keyboards macros, but now I find them a bit dangerous. Regards