#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^label (\S+)(?!.*(?:\n(?!label).*)*?\n[ \t]*\[end_timeline\])"
Local $sString = "label Colorcode (Object)" & @CRLF & _
"Dialog" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"Speaker 2: "[i]Text[/i]! [pause={pause.medium}] more text."" & @CRLF & _
"do function_name("parameter", {parameter})" & @CRLF & _
"# comment, there are no inline-comments" & @CRLF & _
"[end_timeline]" & @CRLF & _
"" & @CRLF & _
"label Maroon (Guitar)" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"[end_timeline]" & @CRLF & _
"" & @CRLF & _
"label Pink (Chest)" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"" & @CRLF & _
"label Königsblau (Wardrobe)" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"[end_timeline]" & @CRLF & _
"" & @CRLF & _
"label Azur (Sorcerers Hat)" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"# [end_timeline]" & @CRLF & _
"" & @CRLF & _
"label Jade (Paintings)" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"label Gras (Ship in a Bottle)" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"[end_timeline]" & @CRLF & _
"" & @CRLF & _
"label Goldgelb (Golden Apple)" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"[end_timeline]" & @CRLF & _
"" & @CRLF & _
"label Himmelblau (Helmet)" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"Speaker: "Text"" & @CRLF & _
"Speaker: "Text""
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