// 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"(?mu)\b((?:(?!(\u0627|\u064A|\u0648))(?:[\u0600-\u06FF]))+?)\b").unwrap();
let string = "تفقدت نظارتي حين استيقظت صباحا فلم اجدها في مكانها وبحثت عنها في كل مكان دون ان اعثر لها علي اثر يا الهي كيف ساخرج اليوم من البيت واواجه النهار
وتناهي الي من الخارج صوت نقار الخشب فوق جذع شجره قريبه فاسرعت الي الباب وفتحته واذا ضوء النهار يبهر بصري فاغلقت عيني وهتفت ايها النقار اين انت
وحاولت عبثا ان افتح عيني وانا اقول عفوا لا استطيع ان افتح عيني ان الضوء يعميني";
// 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/