// 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)"_id[^,]*,\s*"#).unwrap();
let string = "json_file<- '{ \"_id\" : ObjectId( \"539163d7bd350003\" ), \"login\" : \"vui\", \"id\" : 369607, \"avatar_url\" : \"https://avatars.mashupsusercontent.com/u/369607?\", \"gravatar_id\" : \"df8897ffebe16c5b0cd690925c63e190\", \"url\" : \"https://api.mashups.com/users/vui\", \"html_url\" : \"https://mashups.com/vui\", \"followers_url\" : \"https://api.mashups.com/users/vui/followers\", \"following_url\" : \"https://api.mashups.com/users/vui/following{/other_user}\", \"gists_url\" : \"https://api.mashups.com/users/vui/gists{/gist_id}\", \"starred_url\" : \"https://api.mashups.com/users/vui/starred{/owner}{/repo}\", \"subscriptions_url\" : \"https://api.mashups.com/users/vui/subscriptions\", \"organizations_url\" : \"https://api.mashups.com/users/vui/orgs\", \"repos_url\" : \"https://api.mashups.com/users/vui/repos\", \"events_url\" : \"https://api.mashups.com/users/vui/events{/privacy}\", \"received_events_url\" : \"https://api.mashups.com/users/vui/received_events\", \"type\" : \"User\", \"site_admin\" : false, \"org\" : \"amurath\" }'
";
let substitution = "";
// 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/