#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)\[CDATA\[\[[^]*?]]>"
Local $sString = "<records>" & @CRLF & _
" <record>" & @CRLF & _
" <name>Jon</name>" & @CRLF & _
" <surname>Doe</surname>" & @CRLF & _
" <dob>2001-02-01</dob>" & @CRLF & _
" <comment>" & @CRLF & _
" <![CDATA[[ Patient with > 2 and < 5 siblings]]]>" & @CRLF & _
" </comment>" & @CRLF & _
" </record>" & @CRLF & _
" <record>" & @CRLF & _
" <name>Jane</name>" & @CRLF & _
" <surname>Doe</surname>" & @CRLF & _
" <dob>2001-02-01</dob>" & @CRLF & _
" <comment>" & @CRLF & _
" <![CDATA[[ Patient with > 2 siblings ]]]>" & @CRLF & _
" </comment>" & @CRLF & _
" </record>" & @CRLF & _
"</records>"
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