#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^(h[1-6]|p|a|img):\n[\w\-\.\d].*(?=\n{0,}?)"
Local $sString = "h3:" & @CRLF & _
"Lorem, ipsum dolor, sit amet consectetur adipisicing elit. Voluptate, perspiciatis." & @CRLF & _
"" & @CRLF & _
"h4:" & @CRLF & _
"Lorem, ipsum dolor, sit amet consectetur adipisicing elit. Voluptate, perspiciatis." & @CRLF & _
"" & @CRLF & _
"p:" & @CRLF & _
"Hello this is a paragraph you can add something to our dsle deglet for more and now how to use this for free" & @CRLF & _
"" & @CRLF & _
"img:" & @CRLF & _
"http://www.icon.in/logoe/gksoedfkle/dfkeadka/img.jpg" & @CRLF & _
"" & @CRLF & _
"a:" & @CRLF & _
"rahul" & @CRLF & _
"" & @CRLF & _
"p:" & @CRLF & _
"are you ready for more thing so what do you think" & @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