Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij Idea: is it possible to store search-replace expressions for future reuse?

I often need to do complex regex-based find-replace operations in Intellij and apparently, the automatic search history only stores the latest dozen or so expression pairs.

Is there a way to permanently store the find/replace pairs for future reuse? It is a bit cumbersome to have to copy-paste the expressions elsewhere.

Sometimes I might spend several minutes writing a one-off complex regex thinking I won't need later, but then when it turns out I do need to replay it a couple of days later, and it is not in the history anymore.

Is there a built-in way to have the expressions stored permanently, e.g. mark a specific find/replace expression as permanent?

like image 996
ccpizza Avatar asked Aug 17 '17 08:08

ccpizza


People also ask

How do I use structural search in IntelliJ?

Use an existing template (field declaration) In the Structural Search dialog, under the Java | Class-based node, select All Fields of a Class which will look for all field declarations and click Find. As a result, in the Find tool window, IntelliJ IDEA shows all the fields declared in our Java code.


1 Answers

You could use Edit > Find > Replace Structurally and save your Search and Replacement expressions as templates.

enter image description here

More details in the docs.

like image 193
glytching Avatar answered Nov 04 '22 15:11

glytching