// 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)"([a-z-@/0-9\.-]+)"(: ".+",?\n)"#).unwrap();
let string = "\"@typescript-eslint/eslint-plugin\": \"^4.14.0\",
\"@typescript-eslint/parser\": \"^4.14.0\",
\"babel-eslint\": \"^10.1.0\",
\"eslint\": \"7.2.0\",
\"eslint-config-airbnb\": \"18.2.1\",
\"eslint-config-prettier\": \"^7.2.0\",
\"eslint-plugin-import\": \"^2.22.1\",
\"eslint-plugin-jam3\": \"^0.2.3\",
\"eslint-plugin-jsx-a11y\": \"^6.4.1\",
\"eslint-plugin-prettier\": \"^3.3.1\",
\"eslint-plugin-react\": \"^7.21.5\",
\"eslint-plugin-react-hooks\": \"4.0.0\",
";
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/