// 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)^(https?:\/\/)?([а-я0-9_-]{1,32}|[a-z0-9_-]{1,32})\.([а-я0-9_-]{1,8}|[a-z0-9_-]\S{1,8})$").unwrap();
let string = "/********************** yes *****************/
http://yandex.ru
http://asdasd.ru
sdfsdf.ru
http://sdfsdf.ru/sadasds-sadsad/sadsad
http://sdfsdf.ru/sadasds-sadsad/sadsad?page=2
http://sdfsdf.ru/sadasds-sadsad/sadsad?page=2&other=1
sdfsdf.ru/sadasds-sadsad/sadsad?page=2&other=1
http://sdfsdf.ru/sadasds/sadsad?page=2&other=1
https://regex101.com/r/tM7Pmr/1
http://regexpres.narod.ru/calculator.html
http://regexpres.narod.ru/calculator.htm
http://regexpres.narod.ru/calculator.php
http://regexpres.narod.ru/index.php
http://regexpres.narod.ru/index
https://jsfiddle.net/3b0khwhasd6/
https://lenta.ru/articles/2017/03/06/ruvlogs/
https://www.youtube.com/watch?v=PDxVcTWVIck
www.youtube.com/watch?v=PDxVcTWVIck
https://zakon.ru/blog/2017/03/06/delo_o_denezhnyh_generatorah_i_udobnom_sude__p-v_protiv_ikea_opredelenie_skgd_vs_ot_17012017_36-kg16
https://zakon.ru/konstitucionnyj_sud_rf
zakon.ru/blog/2017/03/06/delo_o_denezhnyh_generatorah_i_udobnom_sude__p-v_protiv_ikea_opredelenie_skgd_vs_ot_17012017_36-kg16
https://zakon.ru/konstitucionnyj_sud_rf
/********************** not *****************/
4234czxc
sdfsdf
sdsad.rturturturt/fsdfsd@sd";
// 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/