SciTE - Replace string every two found

97 views Asked by At

I use SciTE as my text editor, primarily oriented towards LaTeX and C++ programming.

My current problem is I want to replace the $$ $$ TeX displaymath symbols with the \[ \] LaTeX ones. Given there's no way to distinguish between the opening and the closing one in the TeX's way, that means I have to find the first $$ in the document, and then replace it with a \[. Skip the next, and replace again. Again skip, and so on.

Is there a way in SciTE to easily automate this? I mean, finding the first $$ and saying, replace with a \[ every two $$ found. Then I can just bulk substitute every $$ left with a \]. Or do I have to use another editor, or make a custom script? I remember having done this in the past, maybe with Gedit, but right now I can't seem to accomplish that, not even searching in the internet.

1

There are 1 answers

0
Phylogenesis On

As I understand it, SciTE has support for regular expressions. The following find/replace works in Notepad++ (based on Scintilla):

Find:    \$\$(.*?)\$\$
Replace: \[ \1 \]