#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = ""(?=(?:(?:[^<](?!%>))*(?:<%[^%]+%>)(?:[^<](?!%>))*)*$)"
Local $sString = "select "SomethingQuoted", "SomethingQuoted" , "SomethingQuoted" , "SomethingQuoted" to_char(max(decode( landing_name,'DX_L_MDC_RDM', BATCH_ID , -1))) as MDC_RDM_BATCH_ID" & @CRLF & _
" ,to_char(max(decode( landing_name,'DX_L_ESB_SPARK', BATCH_ID , -1))) as ESB_SPARK_BATCH_ID" & @CRLF & _
"from (" & @CRLF & _
"select max(u.batch_id) as BATCH_ID , u.landing_name" & @CRLF & _
" from "<%=odiRef.getSchemaName("DJC_METADATA","D")%> .u$dx_batch_log u" & @CRLF & _
""SomethingQuoted"" & @CRLF & _
" join <%=odiRef.getSchemaName("DJC_METADATA","D")%> .djc$dx_landing la" & @CRLF & _
" on u.landing_name = la.landing_name" & @CRLF & _
" and u.batch_id >= la.last_deleted_batch_id" & @CRLF & _
" join <%=odiRef.getSchemaName("DJC_METADATA","D")%> .djc$load_log lo" & @CRLF & _
" on u.load_id = lo.load_id" & @CRLF & _
" and lo.status = 'COMPLETE'" & @CRLF & _
" and lo.load_id > 0" & @CRLF & _
" "SomethingQuoted" " & @CRLF & _
" "SomethingQuoted" " & @CRLF & _
" where u.landing_name in ('DX_L_MDC_RDM', 'DX_L_ESB_SPARK')" & @CRLF & _
" and u.chkp_status = 'FINISHED'" & @CRLF & _
" group by u.landing_name" & @CRLF & _
" ) "<%==" "=%>" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
""
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