#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(var preferences = {)[\s\S]*(};)"
Local $sString = "<!DOCTYPE html>" & @CRLF & _
"<html>" & @CRLF & _
" <head>" & @CRLF & _
" <meta http-equiv='x-ua-compatible' content='IE=edge,chrome=1' />" & @CRLF & _
" <meta name="robots" content="nofollow" />" & @CRLF & _
" <meta name="robots" content="noindex" />" & @CRLF & _
" <meta name="robots" content="noarchive" />" & @CRLF & _
" <meta http-equiv="Cache-Control" content="private, no-cache, no-store, must-revalidate, max-age=0" />" & @CRLF & _
" <meta http-equiv="Pragma" content="no-cache" />" & @CRLF & _
" <meta http-equiv="Expires" content="0" />" & @CRLF & _
" <meta http-equiv="Expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />" & @CRLF & _
" <meta charset='UTF-8' />" & @CRLF & _
" <title>BLANK - FILL WITH CLIENT TITLE</title>" & @CRLF & _
" <link href='css/bpdev.css' rel='stylesheet' type='text/css' />" & @CRLF & _
" <script src='https://code.jquery.com/jquery-1.11.1.min.js'></script>" & @CRLF & _
" <script>!window.jQuery && document.write('<script src="common/js/jquery/jquery-1.11.1.min.js"><\/script>');</script>" & @CRLF & _
" <link rel='shortcut icon' href='images/favicon.ico' type='image/x-icon' />" & @CRLF & _
" <style id="antiClickjack">body{display:none !important;}</style>" & @CRLF & _
" </head>" & @CRLF & _
" <body id='userTools'>" & @CRLF & _
" <div id='notificationContainer' data-automation='notification_window'></div>" & @CRLF & _
" <div id='overlay' class='modalOverlay' data-automation='modal_overlay'></div>" & @CRLF & _
" <div id='dialog' class='modal' data-automation='modal_window'></div>" & @CRLF & _
" <div id='container'>" & @CRLF & _
" <div id='header' data-automation='header'></div>" & @CRLF & _
" <div id='loader' data-automation='content_loader'></div>" & @CRLF & _
" <div id='content' data-automation='content_area'></div>" & @CRLF & _
" </div>" & @CRLF & _
" <div id='copyFooter' class='copyright' data-automation='copyright_footer'></div>" & @CRLF & _
" <script src='common/js/gateway.framework-min.js' type='text/javascript'></script>" & @CRLF & _
" <script src='common/js/gateway.app-min.js' type='text/javascript'></script>" & @CRLF & _
" <script type='text/javascript'>" & @CRLF & _
" if (self === top) {" & @CRLF & _
" var antiClickjack = document.getElementById('antiClickjack');" & @CRLF & _
" antiClickjack.parentNode.removeChild(antiClickjack);" & @CRLF & _
" } else {" & @CRLF & _
" top.location = self.location;" & @CRLF & _
" }" & @CRLF & _
" (function($) {" & @CRLF & _
" var preferences = {" & @CRLF & _
" logo : 'images/logo.png'," & @CRLF & _
" logoWidth : 250," & @CRLF & _
" logoHeight : 38," & @CRLF & _
" logoAlt : ''," & @CRLF & _
" logoLink : ''," & @CRLF & _
" logoutURL : '../../pkmslogout'" & @CRLF & _
" };" & @CRLF & _
" Gateway.startGateway(preferences, true);" & @CRLF & _
" }(jQuery));" & @CRLF & _
" </script>" & @CRLF & _
" </body>" & @CRLF & _
"</html>"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
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