// 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)([^&]+)=([^&]+)").unwrap();
let string = "https://www.baidu.com/s?wd=%E5%8E%89%E5%AE%B3%E4%BA%86%EF%BC%8C%E7%89%9B%E5%8F%89666
&rsv_spt=1&rsv_iqid=0xc3aa1c4b000475f0&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=1&rsv_sug3=38&rsv_sug1=5&rsv_sug7=100&rsv_sug2=0
&inputT=464145&rsv_sug4=464269
&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJuaW5naGFvLm5ldCIsImV4cCI6IjE0Mzg5NTU0NDUiLCJuYW1lIjoid2FuZ2hhbyIsImFkbWluIjp0cnVlfQ.SwyHTEx_RQppr97g4J5lKXtabJecpejuef8AqKYMAJc&1-2-.-93=sdfdsfsdfsdff";
// 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/