// 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)(http[s]?:\/\/)?(www.)?(11st|auction|bj\.afreecatv|blog\.naver|blog\.daum|cafe\.daum|cafe\.naver|smartstore\.naver|storefarm\.naver|partner\.booking.naver\.com|partner\.booking\=.naver|shop\.naver\.com|gmarket|go\.kr).*").unwrap();
let string = "http://11st.co.kr
http://www.11st.co.kr
http://auction.co.kr
http://blog.naver.com/wef
http://blog.daum.net/wef
http://bj.afreecatv.com/wef
http://cafe.daum.net
http://cafe.naver.com/
http://smartstore.naver.com
http://smartstore.naver.com/wef
storefarm.naver.com
http://partner.booking.naver.com/bizes
http://shop.naver.com/starkrobotics
http://sell.storefarm.naver.com
https://www.rndia.or.kr/
http://m.hakjum.com/
itskorea.kr
minishop.gmarket.co.kr
hrd.keia.kr
www.dsf.go.kr";
// 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/