#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\"ruleGroupId\":\s*\"(?<ruleGroupId>[^\"]+)\",[\r\n](.+[\r\n]){2}(\"excludedRules\"\:\s\[)([\r\n].+)[\r\n]\"exclusionType\"\:\s*\"(?<exclusionTpe>[^\"]+)"
Local $sString = "{" & @CRLF & _
""timestamp": 1646229254523," & @CRLF & _
""formatVersion": 1," & @CRLF & _
""webaclId": "arn:aws:wafv2:us-east-1:111111:regional/webacl/alb-stage-web-acl/26ac170c-03c4-4fd7-8fab-86e346789fef"," & @CRLF & _
""terminatingRuleId": "Default_Action"," & @CRLF & _
""terminatingRuleType": "REGULAR"," & @CRLF & _
""action": "ALLOW"," & @CRLF & _
""terminatingRuleMatchDetails": []," & @CRLF & _
""httpSourceName": "ALB"," & @CRLF & _
""httpSourceId": "182116744736-app/ALB-Stage/fcc1f5f9483b035e"," & @CRLF & _
""ruleGroupList": [" & @CRLF & _
"{" & @CRLF & _
""ruleGroupId": "AWS#AWSManagedRulesAmazonIpReputationList"," & @CRLF & _
""terminatingRule": null," & @CRLF & _
""nonTerminatingMatchingRules": []," & @CRLF & _
""excludedRules": null" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""ruleGroupId": "AWS#AWSManagedRulesBotControlRuleSet"," & @CRLF & _
""terminatingRule": null," & @CRLF & _
""nonTerminatingMatchingRules": []," & @CRLF & _
""excludedRules": null" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""ruleGroupId": "AWS#AWSManagedRulesCommonRuleSet"," & @CRLF & _
""terminatingRule": null," & @CRLF & _
""nonTerminatingMatchingRules": []," & @CRLF & _
""excludedRules": [" & @CRLF & _
"{" & @CRLF & _
""exclusionType": "EXCLUDED_AS_COUNT"," & @CRLF & _
""ruleId": "SizeRestrictions_BODY"" & @CRLF & _
"}" & @CRLF & _
"]" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""ruleGroupId": "AWS#AWSManagedRulesKnownBadInputsRuleSet"," & @CRLF & _
""terminatingRule": null," & @CRLF & _
""nonTerminatingMatchingRules": []," & @CRLF & _
""excludedRules": null" & @CRLF & _
"}" & @CRLF & _
"]," & @CRLF & _
""rateBasedRuleList": []," & @CRLF & _
""nonTerminatingMatchingRules": []," & @CRLF & _
""requestHeadersInserted": null," & @CRLF & _
""responseCodeSent": null," & @CRLF & _
""httpRequest": {" & @CRLF & _
""clientIp": "67.218.14.10"," & @CRLF & _
""country": "US"," & @CRLF & _
""headers": [" & @CRLF & _
"{" & @CRLF & _
""name": "host"," & @CRLF & _
""value": "sample.com"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "content-length"," & @CRLF & _
""value": "50362"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "cache-control"," & @CRLF & _
""value": "max-age=0"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "sec-ch-ua"," & @CRLF & _
""value": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"98\", \"Microsoft Edge\";v=\"98\""" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "sec-ch-ua-mobile"," & @CRLF & _
""value": "?0"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "sec-ch-ua-platform"," & @CRLF & _
""value": "\"Windows\""" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "origin"," & @CRLF & _
""value": "https://sample.com"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "upgrade-insecure-requests"," & @CRLF & _
""value": "1"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "dnt"," & @CRLF & _
""value": "1"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "content-type"," & @CRLF & _
""value": "multipart/form-data; boundary=----WebKitFormBoundaryuXOFvh7iQjJkEJHm"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "user-agent"," & @CRLF & _
""value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 Edg/98.0.1108.62"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "accept"," & @CRLF & _
""value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "sec-fetch-site"," & @CRLF & _
""value": "same-origin"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "sec-fetch-mode"," & @CRLF & _
""value": "navigate"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "sec-fetch-user"," & @CRLF & _
""value": "?1"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "sec-fetch-dest"," & @CRLF & _
""value": "document"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "referer"," & @CRLF & _
""value": "https://sample.com/DischargeDetail.aspx"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "accept-encoding"," & @CRLF & _
""value": "gzip, deflate, br"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "accept-language"," & @CRLF & _
""value": "en-US,en;q=0.9"" & @CRLF & _
"}," & @CRLF & _
"{" & @CRLF & _
""name": "cookie"," & @CRLF & _
""value": "_ga=GA1.3.84334902.1642521795; __RequestVerificationToken=-8kinKddCjKCZTws-wPmXDZTFg39urggswPnYm5Y15UwfIjspHqTj1hOPAXIaRPHL2cupyt2vO4Gb5QUExZGd6e5djS0v81kxt2pH22Ow9XiJYr2NPWB_BdQb-VmCUHVXbiVZZ5NwTfGDrXd2O0uD_gba4fM3PhkQUO5f9zs5381; _gid=GA1.2.249665053.1645964709; _ga_33R15ZN4N1=GS1.1.1645965393.6.0.1645965397.56; _ga=GA1.2.84334902.1642521795; ASP.NET_SessionId=1fnikipv2poi14r3doy4kb2w"" & @CRLF & _
"}" & @CRLF & _
"]," & @CRLF & _
""uri": "/ReleaseRequest.aspx"," & @CRLF & _
""args": ""," & @CRLF & _
""httpVersion": "HTTP/2.0"," & @CRLF & _
""httpMethod": "POST"," & @CRLF & _
""requestId": "1-621f7706-5e8f4ea33e2dc0cc66b98797"" & @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