Replacing different String literals with empty Strings using regex in java
Please let me know if there is any regex that can convert the following
input into the following output:
Input line (Single line)
System.out.println("Random\"String 1");System.out.println("Another Random
String");String x = "Random String once again";
Output line
System.out.println("");System.out.println("");String x = "";
Is this possible using regex?
I will be highly greatful if you can help me find such a regular
expression. Or please let me know whether this can be achieved using regex
or not.
My question is precise and has sufficient details, and I know this can be
solved using some java parser easily. But I have to use regular
expressions only. So please don't ask for any further details or suggest
alternate ways other than regex. Thank you for your understanding :)
About the Input line: multiple string literals on the same line. the
string literals can contain quote character also (following an escape
character, as in Random\"String1).
No comments:
Post a Comment