$re = '/<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>/m';
$str = '<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> ';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php