// 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"(\d){1}\t\t(\d){1,3}\%\s\t(\d){1}\t(\d){1,3}\%").unwrap();
let string = "Current car character
Power Handling Acceleration
102 107 104
Car character points history
Car part Level Action Wear New level New wear
Chassis: 6 96% 6 96%
Engine: 7 100% 7 100%
Front wing: 8 70% 8 70%
Rear wing: 8 75% 8 75%
Underbody: 8 63% 8 63%
Sidepods: 8 91% 8 91%
Cooling: 8 80% 8 80%
Gearbox: 7 82% 7 82%
Brakes: 9 25% 9 25%
Suspension: 8 94% 8 94%
Electronics: 8 78% 8 78%
(\\d){1}\\t\\t(\\d){1,3}\\%\\s\\t(\\d){1}\\t(\\d){1,3}\\%";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
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/