// 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)(?:(?!video).)*video\/(\d+)\/").unwrap();
let string = "https://www.iesdouyin.com/share/video/7039240821144702223/?region=CN&mid=7039240839087803150&u_code=19ambj1ae&did=MS4wLjABAAAAif33DuCPz8E4TM8ohLFknanLbAaeYNGHZvIMdpUGZBk&iid=MS4wLjABAAAAbcVu-zX1os-3_V1-tnqKfcfhYUGKXPsJhcECdsvolcDBQetzxujmh6J5MwxRPIAa&with_sec_did=1&titleType=title×tamp=1639030688&utm_campaign=client_share&app=aweme&utm_medium=ios&tt_from=copy&utm_source=copy
{START}(?:(?!{END}).)*{END}";
// 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/