#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?xms)" & @CRLF & _
"( # group 1" & @CRLF & _
" \b explore:" & @CRLF & _
" [^\S\r\n]* # optional horizontal whitespaces" & @CRLF & _
" [^\n{]* # possible content of the same line" & @CRLF & _
" # followed by two possibilities" & @CRLF & _
" (?: # the content stops at the end of the line with a ;" & @CRLF & _
" ; [^\S\r\n]* $" & @CRLF & _
" | # or it contains curly brackets and spreads over eventually multiple lines" & @CRLF & _
" ( # group 2" & @CRLF & _
" {" & @CRLF & _
" [^{}"]*+ # all that isn't curly brackets nor double quotes" & @CRLF & _
" (?:" & @CRLF & _
" " [^\\"]*+ (?: \\. [^\\"]* )*+ " # contents between quotes" & @CRLF & _
" [^{}"]*" & @CRLF & _
"" & @CRLF & _
" |" & @CRLF & _
" (?2) # nested curly brackets, recursion in the group 2" & @CRLF & _
" [^{}"]*" & @CRLF & _
" )*+" & @CRLF & _
" }" & @CRLF & _
" )" & @CRLF & _
" )" & @CRLF & _
")"
Local $sString = "explore: character_balance {}" & @CRLF & _
"explore: tower_ends {" & @CRLF & _
" label: "Tower Results"" & @CRLF & _
" join: activity_type {" & @CRLF & _
" relationship: many_to_one" & @CRLF & _
" type: inner" & @CRLF & _
" sql_on: ${activity_type.activity_name}=${wba_fact_activity.activity_name} ;;" & @CRLF & _
" }" & @CRLF & _
"}" & @CRLF & _
"explore: seven11_core_session_start {}"
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