#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?ms)statusCode: (?<status_code>\d+)"
Local $sString = "{ [-]" & @CRLF & _
"" & @CRLF & _
" body: { [-]" & @CRLF & _
"" & @CRLF & _
" message: [ [-]" & @CRLF & _
"" & @CRLF & _
" { [-]" & @CRLF & _
"" & @CRLF & _
" errorMessage: must have required property 'objectIds'" & @CRLF & _
"" & @CRLF & _
" field: objectIds" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" { [-]" & @CRLF & _
"" & @CRLF & _
" errorMessage: must be equal to one of the allowed values : [object1,object2]" & @CRLF & _
"" & @CRLF & _
" field: objectType" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" statusCode: 400" & @CRLF & _
"" & @CRLF & _
" type: BAD_REQUEST_ERROR" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" headers: { [-]" & @CRLF & _
"" & @CRLF & _
" Access-Control-Allow-Origin: *" & @CRLF & _
"" & @CRLF & _
" Content-Type: application/json" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" hostname: " & @CRLF & _
"" & @CRLF & _
" level: 50" & @CRLF & _
"" & @CRLF & _
" msg: republish error response" & @CRLF & _
"" & @CRLF & _
" statusCode: 400" & @CRLF & _
"" & @CRLF & _
" time: ****" & @CRLF & _
"" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
" " & @CRLF & _
"" & @CRLF & _
"Event 2:500 Error" & @CRLF & _
"" & @CRLF & _
"{ [-]" & @CRLF & _
"" & @CRLF & _
" awsRequestId: " & @CRLF & _
"" & @CRLF & _
" body: { [-]" & @CRLF & _
"" & @CRLF & _
" message: Unexpected token “ in JSON at position 98" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" headers: { [-]" & @CRLF & _
"" & @CRLF & _
" Access-Control-Allow-Origin: *" & @CRLF & _
"" & @CRLF & _
" Content-Type: application/json" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" msg: reprocess error response" & @CRLF & _
"" & @CRLF & _
" statusCode: 500" & @CRLF & _
"" & @CRLF & _
" time: ***" & @CRLF & _
"" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"Event 3:Success" & @CRLF & _
"" & @CRLF & _
"{ [-]" & @CRLF & _
"" & @CRLF & _
" awsRequestId: " & @CRLF & _
"" & @CRLF & _
" body: { [-]" & @CRLF & _
"" & @CRLF & _
" message: republish request has been submitted for [1] ids" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" headers: { [-]" & @CRLF & _
"" & @CRLF & _
" Access-Control-Allow-Origin: *" & @CRLF & _
"" & @CRLF & _
" Content-Type: application/json" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" headers: { [+]" & @CRLF & _
"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" msg: republish success response" & @CRLF & _
"" & @CRLF & _
" statusCode: 200" & @CRLF & _
"" & @CRLF & _
" time: ***" & @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