// 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)(?<!cpc|accounts\.)(google|bing|search\.yahoo|search\.myway|yandex|duckduckgo|ecosia|search\.tb\.ask|baidu)(?!.*cpc)").unwrap();
let string = "google/cpc/[google][cpc][house][sale]
google/cpc/[google][cpc][condo][sale]
accounts.google.com.sg
accounts.google.co.id
google.com
google.com.ph
google.co.th
bing.com
google.co.uk
com.google.android.googlequicksearchbox
google.com.sg
google.com.au
google.com.vn
google.ca
google.co.id
google.com.hk
search.yahoo.com
duckduckgo.com
google.de
ph.search.yahoo.com
google.co.in
google.fr
google.co.jp
google.co.kr
google.com.my
google.ae
google.se
google.ch
int.search.myway.com
yandex.ru
google.ru
google.com.tw
google.nl
cn.bing.com
ecosia.org
google.it
google.dk
google.co.nz
int.search.tb.ask.com
search.yahoo.co.jp
google.co.za
google.no
google.es
google.be
th.search.yahoo.com
google.fi
baidu.com
google.ie
google.com.tr
uk.search.yahoo.com";
// 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/