// 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"(?mi)(?:(?:dictad|pronunciad)(?:a|o)) por (?:don |doña )?([\w\s]+), juez(?:a?) (?:suplente)?").unwrap();
let string = "Dictada por don ARMANDO FREDY PUELLES ROJAS, Juez Suplente del Juzgado de Letras, Garantía, Familia, y del Trabajo de Taltal
Dictada por ARMANDO FREDY PUELLES ROJAS, Juez Suplente del Juzgado de Letras, Garantía, Familia, y del Trabajo de Taltal
Dictada por ARMANDO FREDY PUELLES ROJAS, Juez del Juzgado de Letras, Garantía, Familia, y del Trabajo de Taltal
V-1560-2018 Foja: 1 Dictada por don ARMANDO FREDY PUELLES ROJAS, Juez Suplente del Juzgado de Letras, Garantía, Familia, y del Trabajo de Taltal
Dictada por doña SANDRA JANETT ORELLANA ARAYA, Jueza Suplente del Primer Juzgado de Letras de Vallenar',";
// 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/