In java I am using regex \".*?\".
I used this for replacing all the string with doublequote with a term String.
Ex:
INPUT: Functions.unescapeJson("test")
Result : Functions.unescapeJson("String")
But now I wanted to exclude some string if they contains double quote. So, I am using / as the escape character. How to achieve this.
Ex:
INPUT: Functions.getJsonPath(Functions.getJsonPath(Functions.getJsonPath(Functions.unescapeJson("test"), "m2m:cin.con"),"payloads_ul.dataFrameOutput"),"[/"Dimming Value/"]")
RESULT: Functions.getJsonPath(Functions.getJsonPath(Functions.getJsonPath(Functions.unescapeJson(String), String),String),String)
But the result I am getting if I use the previous regex is:
Functions.getJsonPath(Functions.getJsonPath(Functions.getJsonPath(Functions.unescapeJson(input.mIntegerm/:sgn.nev.rep), String),String),StringDimming ValueString)
How to achieve this using regex if it finds / it should neglect without replacing original string.
The code that I am using
public static void main(String[] args) {
String STRINGVALIDATIONREGEX = "\".*?\"";
String formula = "Functions.getJsonPath(Functions.getJsonPath(Functions.getJsonPath(Functions.unescapeJson(input.m2m/:sgn.nev.rep), \"m2m:cin.con\"),\"payloads_ul.dataFrameOutput\"),\"[\"Dimming Value\"]\")";
System.out.println(formula.replace(STRINGVALIDATIONREGEX, "String"));
}