#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i){[^}]*name:[^}]*\bthe\b[^}]*}"
Local $sString = "{" & @CRLF & _
"id: 1" & @CRLF & _
"locID: A" & @CRLF & _
"tStart: 17:10:00" & @CRLF & _
"tEnd: 17:35:00" & @CRLF & _
"name: the man 45" & @CRLF & _
"text: Lorum Ipsum" & @CRLF & _
"}" & @CRLF & _
"{" & @CRLF & _
"id: 2" & @CRLF & _
"locID: A" & @CRLF & _
"tStart: 17:11:00" & @CRLF & _
"tEnd: 17:12:00" & @CRLF & _
"name: Frank" & @CRLF & _
"text: Lorum Ipsum" & @CRLF & _
"}" & @CRLF & _
"{" & @CRLF & _
"id: 3" & @CRLF & _
"locID: A" & @CRLF & _
"tStart: 17:11:00" & @CRLF & _
"tEnd: 17:14:00" & @CRLF & _
"name: there Frank" & @CRLF & _
"text: Lorum Ipsum" & @CRLF & _
"}" & @CRLF & _
"{" & @CRLF & _
"id: 4" & @CRLF & _
"locID: B" & @CRLF & _
"tStart: 17:51:00" & @CRLF & _
"tEnd: 17:56:00" & @CRLF & _
"name: the woman 2" & @CRLF & _
"text: Lorum Ipsum" & @CRLF & _
"}" & @CRLF & _
"{" & @CRLF & _
"id: 5" & @CRLF & _
"locID: A" & @CRLF & _
"tStart: 17:11:00" & @CRLF & _
"tEnd: 16:11:00" & @CRLF & _
"name: the man with the golden gun" & @CRLF & _
"text: Lorum Ipsum" & @CRLF & _
"}" & @CRLF & _
"{" & @CRLF & _
"id: 6" & @CRLF & _
"locID: C" & @CRLF & _
"tStart: 17:11:00" & @CRLF & _
"tEnd: 17:11:00" & @CRLF & _
"name: the woman with the dragon tattoo" & @CRLF & _
"text: Lorum Ipsum" & @CRLF & _
"}" & @CRLF & _
"{" & @CRLF & _
"id: 7" & @CRLF & _
"locID: A" & @CRLF & _
"tStart: 17:15:00" & @CRLF & _
"tEnd: 17:15:00" & @CRLF & _
"name: Jo" & @CRLF & _
"text: Lorum Ipsum" & @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