#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "\s*<script src="\/((\w+)[\w.\/]+)"><\/script>"
Local $sString = "<!DOCTYPE html>" & @CRLF & _
"<html>" & @CRLF & _
"" & @CRLF & _
"<head>" & @CRLF & _
" <meta charset="utf-8">" & @CRLF & _
" <meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'">" & @CRLF & _
" <meta name="viewport" content="width=device-width,initial-scale=1.0">" & @CRLF & _
" <title>atomic-project</title>" & @CRLF & _
"</head>" & @CRLF & _
"" & @CRLF & _
"<body>" & @CRLF & _
" <div id="app"></div>" & @CRLF & _
" <!-- built files will be auto injected -->" & @CRLF & _
"" & @CRLF & _
"<script src="/app.js"></script><script src="/app.js"></script><script src="/app.js"></script><script src="/app.js"></script></body>" & @CRLF & _
"" & @CRLF & _
"</html>" & @CRLF & _
""
Local $sSubst = "\n<script>\n const $2Script = document.createElement('script');\n $2Script.type = 'text/javascript';\n $2Script.async = true;\n $2Script.src = '$1';\n document.body.appendChild($2Script);\n</script>\n"
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