#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)"username": "(?!Bot[12]")([^"]+)",(?:\s*"[^"]+": (?:[^"]+|"[^"]*"),)*\s*"channel_id": "(\d+)""
Local $sString = ""members": [" & @CRLF & _
" {" & @CRLF & _
" "id": "0"," & @CRLF & _
" "username": "User1"," & @CRLF & _
" "discriminator": "0000"," & @CRLF & _
" "avatar": null," & @CRLF & _
" "status": "online"," & @CRLF & _
" "avatar_url": "https://cdn.discordapp.com/widget-avatars/..."," & @CRLF & _
" "deaf": false," & @CRLF & _
" "mute": false," & @CRLF & _
" "self_deaf": false," & @CRLF & _
" "self_mute": false," & @CRLF & _
" "suppress": false," & @CRLF & _
" "channel_id": "42"" & @CRLF & _
" }," & @CRLF & _
" {" & @CRLF & _
" "id": "1"," & @CRLF & _
" "username": "Bot1"," & @CRLF & _
" "discriminator": "0000"," & @CRLF & _
" "avatar": null," & @CRLF & _
" "status": "online"," & @CRLF & _
" "avatar_url": "https://cdn.discordapp.com/widget-avatars/..."" & @CRLF & _
" }," & @CRLF & _
" {" & @CRLF & _
" "id": "2"," & @CRLF & _
" "username": "Bot2"," & @CRLF & _
" "discriminator": "0000"," & @CRLF & _
" "avatar": null," & @CRLF & _
" "status": "online"," & @CRLF & _
" "avatar_url": "https://cdn.discordapp.com/widget-avatars/..."," & @CRLF & _
" "game": {" & @CRLF & _
" "name": "music | /help"" & @CRLF & _
" }," & @CRLF & _
" "deaf": false," & @CRLF & _
" "mute": false," & @CRLF & _
" "self_deaf": false," & @CRLF & _
" "self_mute": false," & @CRLF & _
" "suppress": false," & @CRLF & _
" "channel_id": "17"" & @CRLF & _
" }" & @CRLF & _
" ]," & @CRLF & _
" "presence_count": 3" & @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