// 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)(https?://(?![^\s\/]+youtu)[^\s\)\]?]+)\?([^\s\)\]?]{20,})").unwrap();
let string = "https://www.aliexpress.com/item/4000050337687.html?spm=a2g0o.productlist.0.0.70c9492bADfZA5&algo_pvid=66a91537-1872-4a3b-ab39-e9d130970423&algo_exp_id=66a91537-1872-4a3b-ab39-e9d130970423-0&pdp_ext_f=%7B%22sku_id%22%3A%2210000003069527876%22%7D&pdp_npi=2%40dis%21EUR%2118.03%2114.07%21%21%21%21%21%402100bdd816603176696127137ebeac%2110000003069527876%21sea&curPageLogUid=8f5jqvWtAYMa";
// 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/