// 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)\b[a-zA-Z0-9.! #$%&'*+\/=? ^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*\b").unwrap();
let string = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\r\\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\\r\\n<html>\\r\\n<head></head>\\r\\n<body>\\r\\n<a name=\"top\"></a>Back to Category Index</a></p>\\r\\n<p>-----------------------------------<br/></p>\\r\\n\\r\\n67)<a name=\"e1h1\" id=\"e1h1\"></a> Summary: Solar Eclipse 2024 Travel\\r\\n<br/><br/>\\r\\n<p>Name: laure gem wilson\\r\\nRoadtrippers\\r\\n</p>Category: Travel\\r\\n<br/><br/>\\r\\nEmail: <a href=\"mailto:query-e1h1@email.net\">query-e1h1@email.net</a>\\r\\n<br/><br/>\\r\\nOutlet: Roadtrip<br/><br/>\\r\\nDeadline: 7:00 PM EST - 8 July\\r\\n<br/><br/>\\r\\n<p>\\r\\nQuery: \\r\\n<br/><br/>\\r\\nHi, I am on assignment to write a feature about planning a road<br/>trip to experience the Solar Eclipse 2024, including path of<br/>totality, advice about viewing, and recommendations for when and<br/>where to book accommodations, thanks!<br/>\\r\\n</p>\\r\\n<p>\\r\\nRequirements: \\r\\n<br /><br />\\r\\nMust be domestic USA<br/>\\r\\n</p>\\r\\n<p><a href=\"#top\">Back to Top</a> <a href=\"#Travel\">Back to Category Index</a></p>\\r\\n<p>-----------------------------------<br/>
";
// 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/