#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?:\"|\')(?<key>[\w\d]+)(?:\"|\')(?:\:\s*)(?:\"|\')?(?<value>[\w\s-]*)(?:\"|\')?"
Local $sString = "{" & @CRLF & _
" "firstName": "John"," & @CRLF & _
" "lastName": "Smith"," & @CRLF & _
" "age": 25," & @CRLF & _
" "address": {" & @CRLF & _
" "streetAddress": "21 2nd Street"," & @CRLF & _
" "city": "New York"," & @CRLF & _
" "state": "NY"," & @CRLF & _
" "postalCode": "10021"" & @CRLF & _
" }," & @CRLF & _
" "phoneNumber": [" & @CRLF & _
" {" & @CRLF & _
" "type": "home"," & @CRLF & _
" "number": "212 555-1239"" & @CRLF & _
" }," & @CRLF & _
" {" & @CRLF & _
" "type": "fax"," & @CRLF & _
" "number": "646 555-4567"" & @CRLF & _
" }" & @CRLF & _
" ]," & @CRLF & _
" "gender": {" & @CRLF & _
" "type": "male"" & @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