Is it possible to save regexp recipes in IntellijIdea?
Clash Royale CLAN TAG#URR8PPP
Is it possible to save regexp recipes in IntellijIdea?
I use regexp replace for debugging. For example my initial class:
After that I want to log which methods was called with arguments. Cc.logchw()
command does this.
Cc.logchw()
Find: (function )(.*)(([^{]*)({ *)(r*)(s*)
(function )(.*)(([^{]*)({ *)(r*)(s*)
Replace: $1$2$3$4$5$6Cc.logchw(this, "$2", arguments);$5$6
$1$2$3$4$5$6Cc.logchw(this, "$2", arguments);$5$6
My class after replace:
Then I can comment, un-comment or remove all logs in current class.
To do all this actions I should go to my Regexp.txt, copy 1st line, paste into "Find" field, copy 2nd line and paste into "Replace" field. My recipes example:
So is it possible to save regexp recipes in IntellijIdea?
For example some list > select "Un-Comment" > It fills "Find" and "Replace" fields. Or maybe some plugin can do this.
1 Answer
1
You could use Edit > Find > Replace Structurally
and save your Find and Replace expressions as templates.
Edit > Find > Replace Structurally
The template 'expressions' use a bespoke IntelliJ search criteria language.
There are plenty of pre existing templates so you might find something which meets your needs or could be customised to meet your needs.
More details in the docs
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Couple days ago some guy proposed answer in comments, but I had no time to try it. Now comments are empty. It`s deleted or some bug. Can some moderator show it to me?
– Sergey Senkov
Sep 26 '17 at 18:59