// 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#"(http(s)?:\/\/.)?(www\.)?(?:[-a-zA-Z0-9@:%_\+~#=]{1,63}\.)+[a-z]{2,6}\b((?:[-a-zA-Z0-9@:%_\+~#?&//="]+\.)*[-a-zA-Z0-9@:%_\+~#?&//="]+)?"#).unwrap();
let string = "asfd http://gskinner.co.im asfd
asfd m.skinner.com asfd
asfd www.gskinner.com asfd
asfd http://www.gskinner.com asfd
asfd www.gskinner.com?a=1&b=2 asfd
asfd gskinner.com?a=\"1\"%203&b=2 asfd
asfd http://gskinner.com/a/b?c=3 asfd
asfd https://gskinner.com/a/b?c=3 asfd
asfd fdg.f.fg.gskinn.er.com/a/b?c=3 asfd
asfd ffgfgfgfgdfd/dfdfd.df asfd
asfd https://web.whatsapp.com/%F0%9F%8C%90/en asfd
asfd sdfsd://asdfw.asgd asfd
wealth.in..mutual sdf of 10k
wealth.Mutual,dfdfg sdf of 10k
wealth.Mutu/#index al of 10k
wealth.#MutualFundsSIP of 10k
wealth.$MutualFundsSIP of 10k
";
// 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/