#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)<style>([\s\S]*)</style>"
Local $sString = "<!DOCTYPE html>" & @CRLF & _
"<html>" & @CRLF & _
" <head>" & @CRLF & _
" <style>" & @CRLF & _
" body {background-color: powderblue;}" & @CRLF & _
" h1 {color: blue;}" & @CRLF & _
" p {color: red;}" & @CRLF & _
" </style>" & @CRLF & _
" </head>" & @CRLF & _
"" & @CRLF & _
" <body>" & @CRLF & _
"" & @CRLF & _
" <h1>This is a heading</h1>" & @CRLF & _
" <p>This is a paragraph.</p>" & @CRLF & _
"" & @CRLF & _
" </body>" & @CRLF & _
"</html>"
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