// 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)<div\s[\s\S]*?\"detailBulletsWrapper_feature_div[\s\S]*?<div\s[\s\S]*?detailBullets_feature_div[\s\S]*?<ul[\s\S]*?ASIN:[\s\S]*?<\/span>\s*<span>([\s\S]*?)<\/span>"#).unwrap();
let string = "<div id=\"detailBulletsWrapper_feature_div\" data-feature-name=\"detailBullets\" data-template-name=\"detailBullets\" class=\"a-section a-spacing-none feature\" data-cel-widget=\"detailBulletsWrapper_feature_div\">
<div id=\"detailBullets_feature_div\">
<ul class=\"a-unordered-list a-nostyle a-vertical a-spacing-none\">
<li><span class=\"a-list-item\">
<span class=\"a-text-bold\">Product Dimensions:
</span>
<span>5 x 5 x 0.7 inches</span>
</span></li>
<li><span class=\"a-list-item\">
<span class=\"a-text-bold\">Shipping Weight:
</span>
<span>12 ounces (<a href=\"https://www.amazon.com/gp/help/seller/shipping.html/ref=dp_pd_shipping?_encoding=UTF8&seller=&asin=B07F9GS3VY\">View shipping rates and policies</a>)</span>
</span></li>
<li><span class=\"a-list-item\">
<span class=\"a-text-bold\">ASIN:
</span>
<span>B07F9GS3VY</span>
</span></li>
<li><span class=\"a-list-item\">
</span></li>
<li><span class=\"a-list-item\">
<span class=\"a-text-bold\">Item model number:
</span>
<span>WXAGLHP2</span>
</span></li>
<li><span class=\"a-list-item\">
<span class=\"a-text-bold\">Date first listed on Amazon:
</span>
<span>September 11, 2013</span>
</span></li>
</ul>
</div>
<div id=\"dpx-amazon-sales-rank_feature_div\">
<style type=\"text/css\">
.zg_hrsr_item {list-style : none};
</style>
<li id=\"SalesRank\" style=\"list-style : none\">
<b>Amazon Best Sellers Rank:</b> #36,542 in Clothing, Shoes & Jewelry (<a href=\"https://www.amazon.com/gp/bestsellers/fashion/ref=pd_dp_ts_fashion_1\">See Top 100 in Clothing, Shoes & Jewelry</a>) <style type=\"text/css\">.zg_hrsr { margin: 0; padding: 0; list-style-type: none; }.zg_hrsr_item { margin: 0 0 0 10px; }.zg_hrsr_rank { display: inline-block; width: 80px; text-align: right; }</style><ul class=\"zg_hrsr\"> <li class=\"zg_hrsr_item\"> <span class=\"zg_hrsr_rank\">#39</span> <span class=\"zg_hrsr_ladder\">in <a href=\"https://www.amazon.com/gp/bestsellers/fashion/ref=pd_zg_hrsr_fashion_1_1\">Clothing, Shoes & Jewelry</a> > <a href=\"https://www.amazon.com/gp/bestsellers/fashion/7147440011/ref=pd_zg_hrsr_fashion_1_2\">Women</a> > <a href=\"https://www.amazon.com/gp/bestsellers/fashion/679337011/ref=pd_zg_hrsr_fashion_1_3\">Shoes</a> > <a href=\"https://www.amazon.com/gp/bestsellers/fashion/6127771011/ref=pd_zg_hrsr_fashion_1_4\">Athletic</a> > <b><a href=\"https://www.amazon.com/gp/bestsellers/fashion/679351011/ref=pd_zg_hrsr_fashion_1_5_last\">Women's</a></b></span> </li> <li class=\"zg_hrsr_item\"> <span class=\"zg_hrsr_rank\">#129</span> <span class=\"zg_hrsr_ladder\">in <a href=\"https://www.amazon.com/gp/bestsellers/fashion/ref=pd_zg_hrsr_fashion_2_1\">Clothing, Shoes & Jewelry</a> > <a href=\"https://www.amazon.com/gp/bestsellers/fashion/7147440011/ref=pd_zg_hrsr_fashion_2_2\">Women</a> > <a href=\"https://www.amazon.com/gp/bestsellers/fashion/679337011/ref=pd_zg_hrsr_fashion_2_3\">Shoes</a> > <a href=\"https://www.amazon.com/gp/bestsellers/fashion/6127771011/ref=pd_zg_hrsr_fashion_2_4\">Athletic</a> > <b><a href=\"https://www.amazon.com/gp/bestsellers/fashion/679377011/ref=pd_zg_hrsr_fashion_2_5_last\">Walking</a></b></span> </li> <li class=\"zg_hrsr_item\"> <span class=\"zg_hrsr_rank\">#284</span> <span class=\"zg_hrsr_ladder\">in <a href=\"https://www.amazon.com/gp/bestsellers/fashion/ref=pd_zg_hrsr_fashion_3_1\">Clothing, Shoes & Jewelry</a> > <a href=\"https://www.amazon.com/gp/bestsellers/fashion/7147440011/ref=pd_zg_hrsr_fashion_3_2\">Women</a> > <a href=\"https://www.amazon.com/gp/bestsellers/fashion/679337011/ref=pd_zg_hrsr_fashion_3_3\">Shoes</a> > <a href=\"https://www.amazon.com/gp/bestsellers/fashion/6127771011/ref=pd_zg_hrsr_fashion_3_4\">Athletic</a> > <b><a href=\"https://www.amazon.com/gp/bestsellers/fashion/679360011/ref=pd_zg_hrsr_fashion_3_5_last\">Women's</a></b></span> </li></ul>
</li>
</div>
<ul class=\"a-unordered-list a-nostyle a-vertical a-spacing-none\">
<li><span class=\"a-list-item\">
<span class=\"a-text-bold\">
Average Customer Review:
</span>
<style type=\"text/css\">
/*
* Fix for UDP-1061. Average customer reviews has a small extra line on hover
* https://omni-grok.amazon.com/xref/src/appgroup/websiteTemplates/retail/SoftlinesDetailPageAssets/udp-intl-lock/src/legacy.css?indexName=WebsiteTemplates#40
*/
.noUnderline a:hover {
text-decoration: none;
}
</style>
<div id=\"detailBullets_averageCustomerReviews\" class=\"a-spacing-none\" data-asin=\"B07F9GS3VY\" data-ref=\"dpx_acr_pop_\">
<span class=\"a-declarative\" data-action=\"acrStarsLink-click-metrics\" data-acrstarslink-click-metrics=\"{}\">
<span id=\"acrPopover\" class=\"reviewCountTextLinkedHistogram noUnderline\" title=\"4.1 out of 5 stars\">
<span class=\"a-declarative\" data-action=\"a-popover\" data-a-popover=\"{"max-width":"700","closeButton":"false","position":"triggerBottom","url":"/gp/customer-reviews/widgets/average-customer-review/popover/ref=dpx_acr_pop_?contextId=dpx&asin=B07F9GS3VY"}\">
<a href=\"javascript:void(0)\" class=\"a-popover-trigger a-declarative\">
<i class=\"a-icon a-icon-star a-star-4\"><span class=\"a-icon-alt\">4.1 out of 5 stars</span></i>
<i class=\"a-icon a-icon-popover\"></i></a>
</span>
<span class=\"a-letter-space\"></span>
</span>
</span>
<span class=\"a-letter-space\"></span>
<span class=\"a-declarative\" data-action=\"acrLink-click-metrics\" data-acrlink-click-metrics=\"{}\">
<a id=\"acrCustomerReviewLink\" class=\"a-link-normal\" href=\"#customerReviews\">
<span id=\"acrCustomerReviewText\" class=\"a-size-base\">221 customer reviews</span>
</a>
</span>
<script type=\"text/javascript\">
P.when('A', 'ready').execute(function(A) {
A.declarative('acrLink-click-metrics', 'click', { \"allowLinkDefault\" : true }, function(event){
if(window.ue) {
ue.count(\"acrLinkClickCount\", (ue.count(\"acrLinkClickCount\") || 0) + 1);
}
});
});
</script>
<script type=\"text/javascript\">
P.when('A', 'cf').execute(function(A) {
A.declarative('acrStarsLink-click-metrics', 'click', { \"allowLinkDefault\" : true }, function(event){
if(window.ue) {
ue.count(\"acrStarsLinkWithPopoverClickCount\", (ue.count(\"acrStarsLinkWithPopoverClickCount\") || 0) + 1);
}
});
});
</script>
</div>
</span></li>
</ul>
<div class=\"a-row\">
</div>
<div class=\"a-row\">
If you are a seller for this product, would you like to <b><a href=\"https://sellercentral.amazon.com/cu/contact-us?categoryId=30002&typeId=30005\">suggest updates through seller support</a></b>?
</div>
</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/