Hello, @gabriel-mourão, @alan-kilborn and All,
I’m sorry, Gabriel, but your final search regex seems invalid -:((
May be it’s some typos, introduced by the forum syntax, but one correct syntax is :
!\\[([^]]+[A-Za-z{}=\\/!_-\s])\\]\([^)]+[A-Za-z{}=\\/()!_-\s]
Using the free-spacing mode, (?x), this syntax can be split as below :
(?x)
!\\[
(
[^]]+
[A-Za-z{}=\\/!_-\s]
)
\\]
\(
[^)]+
[A-Za-z{}=\\/)!_-\s]
Note that :
On one hand :
The part [^]]+ matches the chars range ![\vec{Q}=m \cdot \vec{\Delta v}
The part [A-Za-z{}=\\/!_-\s] matches the single char ]
On the other hand :
The part [^)]+ matches the chars range (vec{Q}=m_!cdot_!vec{!Delta_v}
The part [A-Za-z{}=\\/)!_-\s] matches the single char ), at the end
I suppose that it’s not exactly what you want !
Your need could rather be expressed as :
First search for an exclamation mark and an opening square bracket ![
Then, search for the smallest range of chars…
Till an ending square bracket ]
Now, search for an opening parenthese (
Then, search for the smallest range of chars…
Till an ending parenthese )
This leads to this simple regex S/R :
SEARCH (?-s)!\\[(.+?)\\]\(.+?\)
REPLACE \$$1\$
Best Regards,
guy038