#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?!.*@media)[\t ]*([a-zA-Z#.:*[][^{\/]*\s*){[\s\S]*?}"
Local $sString = "a {color: red !important;}" & @CRLF & _
" " & @CRLF & _
"#p1 {" & @CRLF & _
" margin-top: 20px !important" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
"/* Client-specific styles */" & @CRLF & _
"" & @CRLF & _
" .ExternalClass, " & @CRLF & _
" .ExternalClass p, " & @CRLF & _
" .ExternalClass span, " & @CRLF & _
" .ExternalClass font, " & @CRLF & _
" .ExternalClass td, " & @CRLF & _
" .ExternalClass div {" & @CRLF & _
" line-height: 100%;" & @CRLF & _
" }" & @CRLF & _
" " & @CRLF & _
" a {}" & @CRLF & _
"" & @CRLF & _
"@media query { " & @CRLF & _
"a { " & @CRLF & _
"display:none " & @CRLF & _
"} " & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" a" & @CRLF & _
" { display:none } " & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"/* Media query for mobile viewport" & @CRLF & _
" #asset_container * Developer: hero graphics should be 2 x width for HD rendering." & @CRLF & _
" */ " & @CRLF & _
" @media only screen and (max-width: 480px){" & @CRLF & _
" table[class=max-width-pad] {" & @CRLF & _
" max-width: 100% !important;" & @CRLF & _
" width: 100% !important;" & @CRLF & _
" padding-top: 15px !important;" & @CRLF & _
" height: auto !important;" & @CRLF & _
" }" & @CRLF & _
" #asset_container table[class=max-width]{" & @CRLF & _
" max-width: 100% !important;" & @CRLF & _
" width: 100% !important;" & @CRLF & _
" height: auto !important;" & @CRLF & _
" }" & @CRLF & _
" #asset_container table[class=container]{" & @CRLF & _
" margin: 0 auto !important;" & @CRLF & _
" }" & @CRLF & _
" #asset_container .desktop-masthead{" & @CRLF & _
" display: none !important;" & @CRLF & _
" }" & @CRLF & _
" #asset_container *[class].hidden. *[class=desktop-masthead]{" & @CRLF & _
" display: none !important;" & @CRLF & _
" }" & @CRLF & _
" #asset_container *[class].elastic{" & @CRLF & _
" width: 100% !important;" & @CRLF & _
" height: auto !important;" & @CRLF & _
" }" & @CRLF & _
" #asset_container *[class].centered{" & @CRLF & _
" text-align: center !important;" & @CRLF & _
" }" & @CRLF & _
" #asset_container *[class].fluid, #asset_container [class=fluid-mob]{" & @CRLF & _
" width: 100% !important;" & @CRLF & _
" }" & @CRLF & _
" [class=fluid-mob] {" & @CRLF & _
" #asset_container position: relative;" & @CRLF & _
" }" & @CRLF & _
" .mobile-show{" & @CRLF & _
" display: table-cell !important;" & @CRLF & _
" width: auto !important;" & @CRLF & _
" height: auto !important;" & @CRLF & _
" max-height: none !important;" & @CRLF & _
" overflow: visible !important;" & @CRLF & _
" visibility: visible !important;" & @CRLF & _
" position: relative !important;" & @CRLF & _
" text-align: center !important;" & @CRLF & _
" }" & @CRLF & _
" #asset_container .show-mob{" & @CRLF & _
" display: block !important;" & @CRLF & _
" max-height: none !important;" & @CRLF & _
" width: auto !important;" & @CRLF & _
" visibility: visible !important;" & @CRLF & _
" }" & @CRLF & _
" #asset_container *[class].mob-masthead{" & @CRLF & _
" width: 100% !important;" & @CRLF & _
" display: block !important;" & @CRLF & _
" height: auto !important;" & @CRLF & _
" max-height: none !important;" & @CRLF & _
" padding: 0 !important;" & @CRLF & _
" }" & @CRLF & _
" #asset_container *[class].mob-masthead-img{" & @CRLF & _
" position: absolute !important;" & @CRLF & _
" top: 0px !important;" & @CRLF & _
" display: block !important;" & @CRLF & _
" height: auto !important;" & @CRLF & _
" max-height: none !important;" & @CRLF & _
" padding: 0 !important;" & @CRLF & _
" width: auto !important;" & @CRLF & _
" }" & @CRLF & _
" [class=fluid-mob] {" & @CRLF & _
" display: table-cell !important;" & @CRLF & _
" width: auto !important;" & @CRLF & _
" height: auto !important;" & @CRLF & _
" max-height: none !important;" & @CRLF & _
" overflow: visible !important;" & @CRLF & _
" visibility: visible !important;" & @CRLF & _
" position: relative !important;" & @CRLF & _
" text-align: center !important;" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
""
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