#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?ms)(.*)<p[^>]*>.*</p>\R?"
Local $sString = "<p align="justify">First paragraph</p>" & @CRLF & _
"<p>Second paragraph</p>" & @CRLF & _
"<p>Third paragraph</p>" & @CRLF & _
"<div class="item">" & @CRLF & _
"<p>Some paragraph here</p>" & @CRLF & _
"<p><strong><u>Specs</u>:</strong><br /><br /><strong>Weight:</strong> 10kg<br /><br /><strong>LxWxH:</strong> 5mx1mx40cm</p" & @CRLF & _
"<p align="justify">second last para</p>" & @CRLF & _
"<p align="justify">This is the paragraph I am trying to remove with regex.</p>" & @CRLF & _
"</div>"
Local $sSubst = "$1"
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