$re = '/\n1 XXXX.*(\n[2-9].*)*/m';
$str = '0 @I10@ INDI
1 XXXX Alena /Boudová/
2 TYPE birth
2 GIVN Alena
2 SURN Bouda
1 SEX F
1 BIRT
2 DATE 1950
2 PLAC Dolní Lhota, Královéhradecký, Česko
3 _LOC @X866@
1 OCCU dělnice
1 FAMS @F187@
1 FAMC @F146@
1 CHAN
2 DATE 19 OCT 2015
3 TIME 20:29:06
2 _WT_USER admin
1 XXXX Alena /Kuklová/
2 TYPE married
2 GIVN Alena
2 SURN Kukl';
$subst = "";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
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