#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)<!--(.*?)-->|\s\B"
Local $sString = "<body>" & @CRLF & _
" <!-- carousel slider section -->" & @CRLF & _
" <section id="carousel">" & @CRLF & _
" <div class="carouserl-item" id="carousel1">" & @CRLF & _
" <!-- gambar pertama -->" & @CRLF & _
" <img src="img1.jpg" alt="Image Description" width="300" height="600"> " & @CRLF & _
" </div>" & @CRLF & _
" <div class="carouserl-item" id="carousel2">" & @CRLF & _
" <!-- gambar kedua -->" & @CRLF & _
" <img src="img2.jpg" alt="Image Description" width="300" height="600"> " & @CRLF & _
" </div>" & @CRLF & _
" </section>" & @CRLF & _
"</body>"
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