// 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)authorization:\s(.*)\s\^").unwrap();
let string = "curl 'https://i-tools.cys.com/api/v1/places/nearby?latitude=-6.30491801&longitude=106.6861089&radius_in_km=0.5&providers=internaltopv2&limit=10&msg_id=aa0cabd1-db82-11ea-af17-1d5f5xxxxx' \\
-H 'authority: i-tools.cys.com' \\
-H 'accept: application/json, text/plain, */*' \\
-H 'authorization: axZhbGciOiJSUzI1NiIsImtpZCI6Il9kZWZhdWx0IiwidHlwIjoiSldUIn0.eyJhdWQiOiJHRU8tVE9PTFMiLCJleHAiOjE2MDgxMDgxNDYsImlhdCI6MTYwODAyMTc0MywianRpIjoiNDA2NjI5NzgtN2RmMS00MDE5LThjZTktMTZkMTFlMjY4NmYyIiwibG1lIjoiR09PR0xFVjMiLCJuYW1lIjoiIiwic3ViIjoiNWU1ZWQyM2YtNGRkMi00YmY3LThkNTEtZGM0MzY0NDdmNzg5In0.IXBubd0NrCaVEyrnaskH4CO50nP5qLz-6G02IBpy0vnPAjHcFeLd4OdocN2TinuBiK_LtgIfIgLCOJx_A3hsNCqnAbIRKfKV6b7xO7HSLNXIT3PS8iAy_z2I5bW4-hUcKJkrMJcgHA8j2bBZGlAPaDf6PkjdzFM7M0P_kXk5H_zKyO2prAQA-eh3UYUr22PLptLsusWMAfXFGf42eUoNz6gq8KKWzaO0wc7FqrYD-rLz50xDMuwLS9J-su4TzIhpJgaMKq8rIvNyy5nAs-77IhG_foaIelVY6ZGFgUe_dvq0Ox9JrR8tqLV7kRwMf7EAIgbdKN-Xxu8ZbulhhuxNZA' ^
-H 'i-tools-params: {\"client_version\":\"v11.0.1xxxx\"}' \\
-H 'user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Mobile Safari/537.36' \\
-H 'x-app-identity: i_tools' \\
-H 'origin: https://i-tools.cys.net' \\
-H 'sec-fetch-site: cross-site' \\
-H 'sec-fetch-mode: cors' \\
-H 'sec-fetch-dest: empty' \\
-H 'referer: https://i-tools.cys.net/ops-tools/place-nearby-v2' \\
-H 'accept-language: id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7' \\
--compressed";
// 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/