// 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#"<li><a href="" target="_blank">[\n](.*?)[\n](https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})[\n]<\/a><\/li>"#).unwrap();
let string = "<li><a href=\"\" target=\"_blank\">
Best Buy – Mount Laurel, NJ – Robbery
https://patch.com/new-jersey/cinnaminson/7-3k-electronics-stolen-burlington-co-store-suspect-sought
</a></li>
<li><a href=\"\" target=\"_blank\">
C-Store- Yuma, AZ – Armed Robbery
https://arizonadailyindependent.com/2023/02/14/yuma-county-sheriffs-deputies-make-robbery-arrest/
</a></li>
<li><a href=\"\" target=\"_blank\">
C-Store – Jasper, TX – Armed Robbery
https://www.kjas.com/news/local_news/article_c5a5133a-ace7-11ed-9a1b-630ed466fb7f.html
</a></li>
<li><a href=\"\" target=\"_blank\">
C-Store – Colorado Springs, CO – Armed Robbery
https://gazette.com/news/crime/shots-fired-during-attempted-armed-robbery-in-east-colorado-springs/article_96f7de40-ac70-11ed-ad96-2b1db289229e.html
</a></li>
<li><a href=\"\" target=\"_blank\">
C-Store – Houston, TX – Armed Robbery
https://mobile.twitter.com/KHOU/status/1625379198322806785
</a></li>
<li><a href=\"\" target=\"_blank\">
C-Store – Kanawha County, WV – Armed Robbery
https://www.wsaz.com/2023/02/15/deputies-investigating-armed-robbery-gas-station/
</a></li>
<li><a href=\"\" target=\"_blank\">
Department – Cleveland, OH – Robbery
https://www.cleveland.com/community/2023/02/man-already-banned-from-returning-to-beachwood-place-until-2028-arrested-for-stealing-mall-merchandise-beachwood-police-blotter.html
</a></li>
<li><a href=\"\" target=\"_blank\">
Dollar – Akron, OH – Armed Robbery
https://www.cleveland.com/crime/2023/02/akron-police-investigate-armed-robbery-of-dollar-general-clerk.html
</a></li>
<li><a href=\"\" target=\"_blank\">
Grocery – Showell, MD – Armed Robbery
https://www.wrde.com/news/troopers-ask-for-help-in-identifying-man-suspected-in-showell-armed-robbery/article_c2e57e92-ac78-11ed-a628-7fba37176075.html
</a></li>
<li><a href=\"\" target=\"_blank\">
Guns – Lansing, IL – Burglary
https://www.fox32chicago.com/news/police-seek-smash-and-grab-crew-who-burglarized-canada-goose-lansing-gun-store
</a></li>
<li><a href=\"\" target=\"_blank\">
Hardware – Tulsa, OK – Robbery
https://www.fox23.com/news/video-three-men-arrested-stealing-thousands-dollars-flooring-tile/3708187a-4784-4ea5-b9c7-04971b6315dc/
</a></li>
<li><a href=\"\" target=\"_blank\">
Marijuana – Los Angeles, CA – Burglary
https://www.cbsnews.com/losangeles/video/fairfax-dispensary-burglary-foiled-by-lapd-response/
</a></li>
<li><a href=\"\" target=\"_blank\">
Marijuana – Lynnwood, WA – Burglary
https://ustimespost.com/thieves-ram-truck-into-lynnwood-pot-shop-in-attempted-atm-robbery/
</a></li>
<li><a href=\"\" target=\"_blank\">
Marijuana – New York, NY – Robbery
https://www.audacy.com/1010wins/news/local/suspect-spray-manhattan-smoke-shop-worker-steal-usd300-in-weed
</a></li>
<li><a href=\"\" target=\"_blank\">
Marijuana - Los Angeles, CA – Burglary
https://www.cbsnews.com/losangeles/video/fairfax-dispensary-burglary-foiled-by-lapd-response/
</a></li>
<li><a href=\"\" target=\"_blank\">
Marijuana – Moore, OK – Burglary
https://kfor.com/news/local/two-in-custody-after-burglary-of-oklahoma-dispensary/
</a></li>
<li><a href=\"\" target=\"_blank\">
Pawn – Lewisville, TX – Armed Robbery / Owner killed
https://www.crosstimbersgazette.com/2023/02/14/lewisville-police-seeking-3-suspects-in-capital-murder-of-pawn-shop-owner/
</a></li>
<li><a href=\"\" target=\"_blank\">
Pharmacy – Chautauqua County, NY – Robbery
https://www.observertoday.com/news/top-stories/2023/02/robbery-suspect-identified-by-silver-creek-cameras/
</a></li>
<li><a href=\"\" target=\"_blank\">
Restaurant – Oakland, CA – Robbery
https://deleciousfood.com/oakland-restaurant-manager-details-robbery-similar-to-the-one-that-killed-angel-cakes-owner-jen-angel-2/
</a></li>
<li><a href=\"\" target=\"_blank\">
Tobacco – New York, NY – Armed Robbery
https://citizen.com/-NOIfeXowunwknAhxrL3
</a></li>
<li><a href=\"\" target=\"_blank\">
Vape – Lincoln, NE – Burglary
https://www.1011now.com/2023/02/14/police-investigating-burglary-northeast-lincoln-vape-shop/
</a></li>
";
// result will be a tuple containing the start and end indices for the first match in the string
let result = regex.captures(string);
let (start, end) = match result {
Some((s, e)) => (s, e),
None => {
// ...
}
};
println!("{}", &string[start, end]);
}
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/