// 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)<NumDI>(?'num_externe'.*)<\x2FNumDI>.*<NomDemandeur>(?'apt_nom'.*)<\x2FNomDemandeur>.*<Installation>(?'ins_libl'.*)<\x2FInstallation>.*<Localisation>(?'apt_localisation'.*)<\x2FLocalisation>.*<Symptome>(?'tsy_lib'.*)<\x2FSymptome>.*<SousSymptome>(?'qsy_lib'.*)<\x2FSousSymptome>.*<DateSouhaitee>(?'dtheure_limite'.*)<\x2FDateSouhaitee>.*<Commentaires>(?'commentaire_externe'.*)<\x2FCommentaires>").unwrap();
let string = "<DEMANDE> <NumDI> 247902</NumDI> <NomDemandeur>BOURG</NomDemandeur> <Installation>84CA21558</Installation> <Localisation>ZAC,,,</Localisation> <Symptome>CHA2</Symptome> <SousSymptome>CHA2</SousSymptome> <Urgence>1</Urgence> <DateSouhaitee>15/05/2019</DateSouhaitee> <Commentaires>TEST DE CREATION DE DEMANDE</Commentaires> </DEMANDE> ";
// 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/