Lets say I want to replace print(x)
with print(wrapper(x))
. I can match
print($Argument$)
and replace it with
print(wrapper($Argument$))
However, if I already have a call to print(wrapper(x))
, I don't want to replace that with print(wrapper(wrapper(x)))
. How can I avoid that? In other words, how do I say "do the replacement, unless the arguments match some pattern"?
You would:
System.out.println($args$)
Edit Variables
$args$
variableText constraints -> Text/regexp
enter ^wrapper\(.*\)$
and tick Invert condition
Obviously you can tweak that regex to whatever you want. Invert condition means that the search will skip all instances where condition is met. Basically you write a regex to match what you don’t want to see and Invert condition
is a NOT
operator.
On my test text:
System.out.println( ex.getMessage() );
System.out.println( wrapper( ex.getMessage() ) );
The second instance was not in the search results.