$re = '/<errore(.*)<\/errore(.){0,2}>/i';
$str = '<RISPOSTA_ALLEGATURA xmlns="http://it/almaviva/disagr/xsd/allegaturaDomandaOut/">
<STATO>Pratica non presente</STATO>
<CODICEFISCALE />
<COD_PRATICA />
<UFF_PAT />
<COD_PAT />
<PROTOCOLLO />
<COD_LOTTO />
<ERRORE><CODICE_ERRORE>0</CODICE_ERRORE><MESSAGGIO_ERRORE>cvc-elt.1: Impossibile trovare la dichiarazione dell\'elemento \'note\'.</MESSAGGIO_ERRORE></ERRORe></RISPOSTA_ALLEGATURA>';
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