// 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#"(?is)[a-z]+([\n].*?<\/div>[\n ]+<div class="large-3 small-3 columns">[\n ]+)[a-z]+"#).unwrap();
let string = "
<div class=\"row\">
<div class=\"large-3 columns displayoffer-centered\">
<small>1 ⨯ <img src=\"/static/currency/Exalted_Orb.png\" class=\"currencyimg\"> ← 1500 ⨯ <img src=\"/static/currency/Orb_of_Alteration.png\" class=\"currencyimg\"></small>
</div>
<div class=\"large-6 columns\">
<div class=\"displayoffer-primary displayoffer-centered\">
<div class=\"row\">
<div class=\"large-3 small-3 columns\">
exalted
</div>
<div class=\"large-6 small-6 columns displayoffer-text\">
<div class=\"displayoffer-left\"><img src=\"/static/currency/Exalted_Orb.png\" class=\"currencyimg\"></div>
<div class=\"displayoffer-right\"><img src=\"/static/currency/Orb_of_Alteration.png\" class=\"currencyimg\"></div>
<div class=\"displayoffer-middle\">1 ⇐ 1500</div>
</div>
<div class=\"large-3 small-3 columns\">
alteration
</div>
</div>
</div>
</div>
<div class=\"large-3 columns displayoffer-centered\">
<small>1 ⨯ <img src=\"/static/currency/Orb_of_Alteration.png\" class=\"currencyimg\"> → 0.0007 ⨯ <img src=\"/static/currency/Exalted_Orb.png\" class=\"currencyimg\"></small>
</div>
</div>
<div class=\"row\">
<div class=\"large-12 columns\">
<div class=\"displayoffer-bottom\">IGN: MoreSpellDamage <span class=\"right\"><a href=\"#\" onclick=\"contact_form(this); return false;\">Contact seller</a></span></div>
</div>
</div>
</div>
<div class=\"displayoffer\" data-username=\"joshxx\" data-sellcurrency=\"6\" data-sellvalue=\"1.0\" data-buycurrency=\"7\" data-buyvalue=\"1650.0\" data-ign=\"joshhhz\">
<div class=\"row\">
<div class=\"large-3 columns displayoffer-centered\">
<small>1 ⨯ <img src=\"/static/currency/Exalted_Orb.png\" class=\"currencyimg\"> ← 1650 ⨯ <img src=\"/static/currency/Chromatic_Orb.png\" class=\"currencyimg\"></small>
</div>
<div class=\"large-6 columns\">
<div class=\"displayoffer-primary displayoffer-centered\">
<div class=\"row\">
<div class=\"large-3 small-3 columns\">
exalted
</div>
<div class=\"large-6 small-6 columns displayoffer-text\">
<div class=\"displayoffer-left\"><img src=\"/static/currency/Exalted_Orb.png\" class=\"currencyimg\"></div>
<div class=\"displayoffer-right\"><img src=\"/static/currency/Chromatic_Orb.png\" class=\"currencyimg\"></div>
<div class=\"displayoffer-middle\">1 ⇐ 1650</div>
</div>
<div class=\"large-3 small-3 columns\">
chrome
</div>
</div>
</div>
</div>
<div class=\"large-3 columns displayoffer-centered\">
<small>1 ⨯ <img src=\"/static/currency/Chromatic_Orb.png\" class=\"currencyimg\"> → 0.0006 ⨯ <img src=\"/static/currency/Exalted_Orb.png\" class=\"currencyimg\"></small>
</div>
</div>
<div class=\"row\">
<div class=\"large-12 columns\">
<div class=\"displayoffer-bottom\"><span class=\"success label\">online</span> · IGN: joshhhz <span class=\"right\"><a href=\"#\" onclick=\"contact_form(this); return false;\">Contact seller</a></span></div>
</div>
</div>
</div>
<div class=\"displayoffer\" data-username=\"deadlylegolas\" data-sellcurrency=\"6\" data-sellvalue=\"1.0\" data-buycurrency=\"7\" data-buyvalue=\"1700.0\" data-ign=\"LegoSaiyanGod\">
<div class=\"row\">
<div class=\"large-3 columns displayoffer-centered\">
<small>1 ⨯ <img src=\"/static/currency/Exalted_Orb.png\" class=\"currencyimg\"> ← 1700 ⨯ <img src=\"/static/currency/Chromatic_Orb.png\" class=\"currencyimg\"></small>
</div>
<div class=\"large-6 columns\">
<div class=\"displayoffer-primary displayoffer-centered\">
<div class=\"row\">
<div class=\"large-3 small-3 columns\">
exalted
</div>
<div class=\"large-6 small-6 columns displayoffer-text\">
<div class=\"displayoffer-left\"><img src=\"/static/currency/Exalted_Orb.png\" class=\"currencyimg\"></div>
<div class=\"displayoffer-right\"><img src=\"/static/currency/Chromatic_Orb.png\" class=\"currencyimg\"></div>
<div class=\"displayoffer-middle\">1 ⇐ 1700</div>
</div>
<div class=\"large-3 small-3 columns\">
chrome
</div>
</div>
</div>
</div>
<div class=\"large-3 columns displayoffer-centered\">
<small>1 ⨯ <img src=\"/static/currency/Chromatic_Orb.png\" class=\"currencyimg\"> → 0.0006 ⨯ <img src=\"/static/currency/Exalted_Orb.png\" class=\"currencyimg\"></small>
</div>
";
// 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/