#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(MY_TABLE_\d+)(\s*)(CODE_TYPE.*)"
Local $sString = "MY_TABLE_1 MY_CODE "OFF"" & @CRLF & _
"MY_TABLE_1 YOUR_CODE "ON"" & @CRLF & _
"MY_TABLE_1 CODE_TYPE "<NONE>"" & @CRLF & _
"MY_TABLE_1 CODE_STATE "ON"" & @CRLF & _
"MY_TABLE_2 MY_CODE "IGNORE"" & @CRLF & _
"MY_TABLE_2 YOUR_CODE "IGNORE"" & @CRLF & _
"MY_TABLE_2 CODE_TYPE "FLAGGED"" & @CRLF & _
"MY_TABLE_2 CODE_STATE "ON""
Local $sSubst = "\1\2\3\n\1\2USER_CODE "DEFAULT""
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