// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r#"\\"(.*?)\\""#).unwrap();
let 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}]}]\"}}";
let substitution = "\"$1\"";
// result will be a String with the substituted value
let result = regex.replace_all(string, substitution);
println!("{}", 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 Rust, please visit: https://docs.rs/regex/latest/regex/