// 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)(?:\*\*\*trash[0-9]+\*\*\*)(\w+\s\w+)(?:\s[^\D]+\s)").unwrap();
let string = "random text 1***trash24***y6f dhy 63 month ago 14 minutes, 29 seconds 3,620 name***trash3***random text 1\",\"random text 2***trash2***pot 5aq 3 months ago 9 minutes, 9 seconds 226,629 name***trash3***random text 2\",\"random text 3***trash2***uan 4fp 5 months ago 26 minutes 506,950 name***trash3***random text 3\"
и тут тоже $1 то что тебе нужно
";
// 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/