const regex = /\n1 XXXX.*(\n[2-9].*)*/mg;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('\\n1 XXXX.*(\\n[2-9].*)*', 'mg')
const 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`;
const subst = ``;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', 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 JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions