import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "\\\\\"(.*?)\\\\\"";
final String string = "{\"unit\":{\"id\":1,\"val\":\"px\",\"name\":\"px\"},\"type\":{\"id\":3,\"val\":\"HORIZONTAL_BAR\",\"name\":\"Horizontal Bar\"},\"zoom\":{\"id\":2,\"val\":\"DEFAULT\",\"name\":\"Show\"},\"scale\":{\"id\":2,\"val\":\"TRUE\",\"name\":\"Show\"},\"fullscreen\":{\"id\":1,\"val\":\"FALSE\",\"name\":\"Hide\"},\"street\":{\"id\":2,\"val\":\"TRUE\",\"name\":\"Show\"},\"poi\":{\"id\":1,\"val\":\"FALSE\",\"name\":\"Disable\"},\"draggable\":{\"id\":2,\"val\":\"TRUE\",\"name\":\"Enable\"},\"doubleclick\":{\"id\":2,\"val\":\"TRUE\",\"name\":\"Enable\"},\"mouse\":{\"id\":2,\"val\":\"TRUE\",\"name\":\"Enable\"},\"gesture\":{\"id\":2,\"val\":\"auto\",\"name\":\"Auto\"},\"map\":{\"id\":1,\"val\":\"ROADMAP\",\"name\":\"Road Map\"},\"mapid\":\"mapkit-9479\",\"api\":\"\",\"lat\":\"51.343695608206275\",\"lng\":\"-2.4871419408111706\",\"zoomlvl\":13,\"width\":600,\"height\":400,\"position\":{},\"route\":{},\"infowindow\":{\"enable\":false,\"title\":false,\"tel\":false,\"email\":false,\"web\":false,\"desc\":false},\"visible\":1,\"lon\":\"-2.4871419408111706\",\"user_id\":4575,\"map_url\":\"26T9Te\",\"snazzy\":{\"id\":12,\"snazzy_id\":11,\"name\":\"Blue\",\"json\":\"[{\\\"featureType\\\":\\\"all\\\",\\\"stylers\\\":[{\\\"hue\\\":\\\"#0000b0\\\"},{\\\"invert_lightness\\\":\"true\"},{\\\"saturation\\\":-30}]}]\"}}";
final String subst = "\"$1\"";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
// The substituted value will be contained in the result variable
final String result = matcher.replaceAll(subst);
System.out.println("Substitution result: " + result);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html