#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)\A(?:^(?!.*\bLecture\b).*\r?\n)*|^\r?\n|^.*\r?\n(?![\s\S]*\bLecture\b)"
Local $sString = "My Dashboard" & @CRLF & _
"Fnfjfjf. random test" & @CRLF & _
"00:50" & @CRLF & _
"" & @CRLF & _
"1:01:56" & @CRLF & _
"My Notes" & @CRLF & _
"No data found." & @CRLF & _
"" & @CRLF & _
" " & @CRLF & _
"Change Language + English " & @CRLF & _
"" & @CRLF & _
"Submit" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"Estimation of Working Capital Lecture 1" & @CRLF & _
"" & @CRLF & _
"Estimation of Working Capital Lecture 2" & @CRLF & _
"" & @CRLF & _
"Estimation of Working Capital Lecture 3" & @CRLF & _
"" & @CRLF & _
"Money Market Lecture 254" & @CRLF & _
"" & @CRLF & _
"Money Market Lecture 255" & @CRLF & _
"" & @CRLF & _
"Money Market Lecture 256" & @CRLF & _
"" & @CRLF & _
"International Trade Lecture 257" & @CRLF & _
"" & @CRLF & _
"International Trade Lecture 258" & @CRLF & _
"" & @CRLF & _
"International Trade Lecture 259" & @CRLF & _
"Terms And Conditions" & @CRLF & _
"84749473837373" & @CRLF & _
"Random text fifjfofifofjfkfkf" & @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