// 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)(#define\s*CANIF_AR_RELEASE_REVISION_VERSION\s*\().+?(\).*?)").unwrap();
let string = "#define CANIF_AR_RELEASE_MAJOR_VERSION (FFFU)
#define CANIF_AR_RELEASE_MINOR_VERSION (1XFFUU)
#define CANIF_AR_RELEASE_REVISION_VERSION (2X000FFFU)
#define TEST_McalModule_CanTp_ID (70U) /* 0x46 */";
let substitution = "\\g<1>3U\\g<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/