// 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)[\xC0-\xD6\xD8-\xF6\xF8-\xFF\x{100}-\x{2AF}\x{388}-\x{3EF}]").unwrap();
let string = "Different languages to test:
Napiszę tutaj trochę po polsku, żeby uzyskać znaki specjalne. To jest tylko do testowania. Szybki brązowy lis przeskoczył nad leniwym psem.
Unë thjesht do të shkruaj disa gjëra shqipe këtu për të marrë karaktere të veçanta. Kjo është vetëm për testim. Dhelpra e shpejtë kafe u hodh mbi qenin dembel.
Mən burada xüsusi personajlar əldə etmək üçün bir az azərbaycanca yazılar yazacam. Bu sadəcə sınaq üçündür. Sürətli qəhvəyi tülkü tənbəl itin üstündən atladı.";
// 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/