Scripting IDEA to do multiple regex replacements in a file

In migrating some code from one environment to another, I need to do a series of regex replacements within a single file, multiple regexes, each with different replacements. I can write external code for this, but it'd be super handy to do it all right there in my editor, as some kind of script. Even handier to be able to set up a number of these as Tools, and just invoke them from a menu.

Is there a way to do any of that within IDEA? Is IDEA scriptable in that sense?

Thanks in advance for any thoughts.

0
4 comments

I don't see anything IDE-specific in that task so Groovy console or simple Groovy script shall be enough.

0

Thanks for the thoughts guys.

Live Plugin seems appropriate, will check it out. I'm not familiar iwth either Groovy or the IntelliJ API, so there's a bit of a curve there, but that's to be expected, not adverse to any of that.

0

Dave Merrill do you resolve your request?

I try to do litle similar things, i want to do multiple search and replace to make a first step to convert kotlin code to swift code

Do you code a script with LivePlugin? Can you share here? 

Thanks.

0

Please sign in to leave a comment.