I am working with regex for fetching string value containing quotes. In below example I want to get value summary key as "Here is "summary". Currently I am getting only "Here is " as output of below program. I want to escape all double quotes those comes in-between first and final double quote.
String in = "summary = \"Here is \"summary\"";
Pattern p = Pattern.compile("'(.*?)'|\"(.*?)[^\\\"]+\"");
Matcher m = p.matcher(in);
while(m.find()) {
System.out.println(m.group());
}
Thanks for any help.