I am trying to search static concatenation of strings and combine them into single string using Structural Search Replace.
For instance
I want to search replace "String1"+"String2"+"String3"
and replace with "String1String2String3"
.But it should not replace strings in comments.
public class Main {
public static void main(String[] args) {
String s = "String1"+"String2"
+"String3";
System.out.println(CONSTANT);
}
// private static final String CONSTANT ="String1"
// +"String2"+"String3"
}
If I search for
"$String1$"
It results in 1 occurrences for above string However
"$String1$"+"$String2$"
Doesn't match above string
How does Structural Search Replace work?
How to refer to variables found in Search string
in Replace String