#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^(?:[^N\n]|N(?:[^O\n]|O(?:[^A\n]|$)|$)|$)+"
Local $sString = "I want to delete anything in a line but stop before the word NOA if that is present in a line. NOA will also follow a colon." & @CRLF & _
"" & @CRLF & _
"1: NOA Keep this)" & @CRLF & _
"2 lkajsflk: DONT KEEP THIS" & @CRLF & _
"asdlkjfaskldjf: Dont keep this" & @CRLF & _
"asdfjlka: NOA" & @CRLF & _
"asdf:NOA(lkjasdlfkjasf)" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"Version: RE2 for Google Sheets" & @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