I have a macros in my tex-file like \tmp{#1}{#2} and I would like to replace it with, e.g., a string.
However, if I search for \\tmp\{.*\}\{.*\} the search also highlights entire constructions like
\tmp{bla}{bla} blabla. In \cite{bla}
i.e. it does not stop at the second instance of closing "}" as expected but goes to the third one.
Is it a bug or a normal behaviour please?
Regards,
.*is a greedy expression, which means it will match as much as possible. Try the lazy expression.*?, which will match as few as possible:\\tmp\{.*?\}\{.*?\}. However TeXStudio was already reported to not accept the lazy quantifier locally, but only as a global option: https://tex.stackexchange.com/q/506904/134574 – Phelype Oleinik Oct 01 '19 at 09:25\{[^\{\}]*\}to match{..}with no{or}between them. If you actually need to step over matching braces and match things like{zzz{vbb}zzz}then the "regular" in "regular expressions" should mean that is not possible (although some systems provide extended syntax to match non-regular expressions) – David Carlisle Oct 01 '19 at 10:30