// 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"(?i)(url\s\d+[.]\d+[.]\d+[.]\d+[:](http|https|ftp).*)").unwrap();
let string = "URL 123.45.67.8:http://www.google-analytics.com/r/collect?v=1&_v=j41&a=1071188231&t=pageview&_s=1&dl=http%3A%2F%2Fm.sherdog.com%2F&ul=en-us&de=UTF-8&dt=Sherdog.com%3A%20UFC%2C%20Mixed%20Martial%20Arts%20(MMA)%20News%2C%20Results%2C%20Fighting&sd=32-bit&sr=320x480&vp=320x460&je=0&_utma=236548035.1293902652.1385044241.1442
URL 123.34.45.7:http://captive.apple.com/hotspot-detect.html";
// 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/