// 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"£\d+\.\d{1,2}").unwrap();
let string = "<div style=\"float:left;\"><a class=\"url\" href=\"http://www.amazon.co.uk/AllThingsAccessory%C2%AE-Sports-Running-Jogging-... src=\"http://ecx.images-amazon.com/images/I/51bQWjrCioL._SL160_.jpg\" alt=\"AllThingsAccessory Sports\" border=\"0\" hspace=\"0\" vspace=\"0\" /></a></div><span class=\"riRssTitle\"><a href=\"http://www.amazon.co.uk/AllThingsAccessory%C2%AE-Sports-Running-Jogging-...® Sports Running Jogging Gym Armband Arm Band Case Cover Holder For iPhone 6 5 5S 5C 4S 4</a></span> <br /><span class=\"riRssContributor\">AllThingsAccessory®</span> <br /><img src=\"http://g-ecx.images-amazon.com/images/G/02/x-locale/common/icons/uparrow... width=\"13\" align=\"abstop\" alt=\"Ranking has gone up in the past 24 hours\" title=\"Ranking has gone up in the past 24 hours\" height=\"11\" border=\"0\" /> <font color=\"green\"><strong>52,006%</strong></font> Sales Rank in Sports & Outdoors: 50 (was 26,053 yesterday) <br /> <img src=\"http://g-ecx.images-amazon.com/images/G/02/detail/stars-4-5._V192253866_... width=\"64\" height=\"12\" border=\"0\" style=\"margin: 0; padding: 0;\"/>(51)<br /><br /><a href=\"http://www.amazon.co.uk/AllThingsAccessory%C2%AE-Sports-Running-Jogging-... new: </a> <strike>£7.99 - £9.99</strike> <font color=\"#990000\"><b>£4.99</b></font> <br /><br />(Visit the <a href=\"http://www.amazon.co.uk/gp/movers-and-shakers/sports/ref=pd_zg_rss_ms_sg... & Shakers in Sports & Outdoors</a> list for authoritative information on this product's current rank.)";
// 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/