// 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)(^\w*[ а-яА-Яa-zA-Z:,\/]*\\?$)|^\\*[\w .:]*\\*\/?(.*)").unwrap();
let string = "\\\\\\\\atxr2.atxr.ru\\\\_resource_test_001001\\\\_dir1
c:\\\\_resource_test_001001\\\\_dir1
\\\\atxr2.atxr.ru\\_resource_test_001001\\_dir1
D:\\
_dir1
\\\\atxr2.atxr.ru\\_resource_test_001004
Локальное имя
_resource_test_001004
Разделяемое устройство
atxr.ru/Users/Administrator
atxr2.atxr.ru/_resource_test_001004
atxr2.atxr.ru\\_resource_test_001004
Удаление,Смена владельца документа,Смена владельца,Удаление документа,Просмотр разрешений документа,Просмотр разрешений,Управление документами,Управление принтером,Просмотр документов,Печать,Установка разрешений документа,Установка разрешений
Подразделение Active Directory
atxr.ru/_resource_test_0011015/_resource2_test_0011015
atxr.ru/_resource_test_0011015/_user1_test_0011015
Содержание папки/Чтение данных,Чтение дополнительных атрибутов,Обзор папок/Выполнение файлов,Чтение атрибутов,Чтение разрешений
(^[\\w а-яА-Я:]*\\\\?$)|(^[A-Z]{1}:\\\\$)|^[\\\\a-zA-Z0-9.-:]*[\\\\\\/](.*)
(^[\\w а-яА-Я:]*\\\\?$)|^[\\\\a-zA-Z. :0-9-]*\\\\\\/?(.*)
(^\\w*[ а-яА-Яa-zA-Z:,\\/]*\\\\?$)|^\\\\*[\\w .:]*\\\\*\\/?(.*)";
// 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/