#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)\n1 XXXX.*(\n[2-9].*)*"
Local $sString = "0 @I10@ INDI" & @CRLF & _
"1 XXXX Alena /Boudová/" & @CRLF & _
"2 TYPE birth" & @CRLF & _
"2 GIVN Alena" & @CRLF & _
"2 SURN Bouda" & @CRLF & _
"1 SEX F" & @CRLF & _
"1 BIRT" & @CRLF & _
"2 DATE 1950" & @CRLF & _
"2 PLAC Dolní Lhota, Královéhradecký, Česko" & @CRLF & _
"3 _LOC @X866@" & @CRLF & _
"1 OCCU dělnice" & @CRLF & _
"1 FAMS @F187@" & @CRLF & _
"1 FAMC @F146@" & @CRLF & _
"1 CHAN" & @CRLF & _
"2 DATE 19 OCT 2015" & @CRLF & _
"3 TIME 20:29:06" & @CRLF & _
"2 _WT_USER admin" & @CRLF & _
"1 XXXX Alena /Kuklová/" & @CRLF & _
"2 TYPE married" & @CRLF & _
"2 GIVN Alena" & @CRLF & _
"2 SURN Kukl"
Local $sSubst = ""
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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 AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm