// 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#"(?m)(\G(?!^)|\"body\"\s*:\s*\")([^\",\\]*(?:\\.[^\",\\]*)*),"#).unwrap();
let string = "{
\"url\": \"RETURNED URL\",
\"repository_url\": \"RETURNED URL\",
\"labels_url\": \"RETURNED URL\",
\"comments_url\": \"RETURNED URL\",
\"events_url\": \"RETURNED URL\",
\"html_url\": \"RETURNED URL\",
\"id\": \"RETURNED_ID\",
\"node_id\": \"RETURNED id\",
\"number\": 10,
...
\"author_association\": \"xxxx\",
\"active_lock_reason\": null,
\"body\": \"text \\\"text\\\" text, text text, text \\\\\\\"text text\\\", text, text text\",
\"performed_via_github_app\": null
}";
let substitution = "$1$2";
// 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/