#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?s)(struct\s*\w+.*?(?=fn))(fn.*?(?=\),)\)).*?(?=fn)(fn.*?\))(?=\R\))"
Local $sString = "struct mbuh" & @CRLF & _
"(" & @CRLF & _
"" & @CRLF & _
"lineshg = 0," & @CRLF & _
"tres = "text"," & @CRLF & _
"" & @CRLF & _
" fn track all:#() = " & @CRLF & _
" (" & @CRLF & _
" local c -- clone" & @CRLF & _
" local lpoint = [0,0,0] -- previous point created" & @CRLF & _
" local ccoll = #() -- array for created objects" & @CRLF & _
" local prev = [0,0] -- var for alt distance changing" & @CRLF & _
" )," & @CRLF & _
"" & @CRLF & _
" fn listzfun trs:123 x:#() = " & @CRLF & _
" (" & @CRLF & _
" obj = snapshotasmesh a" & @CRLF & _
" min_vz = max_vz = in coordsys world (getvert obj 1).z" & @CRLF & _
" min_vx = max_vx = in coordsys world (getvert obj 1).x" & @CRLF & _
" min_vy = max_vy = in coordsys world (getvert obj 1).y" & @CRLF & _
" )" & @CRLF & _
")" & @CRLF & _
"" & @CRLF & _
"struct mbuh" & @CRLF & _
"(" & @CRLF & _
"" & @CRLF & _
"lineshg = 0," & @CRLF & _
"tres = "text"," & @CRLF & _
"" & @CRLF & _
" fn track all:#() = " & @CRLF & _
" (" & @CRLF & _
" local c -- clone" & @CRLF & _
" local lpoint = [0,0,0] -- previous point created" & @CRLF & _
" local ccoll = #() -- array for created objects" & @CRLF & _
" local prev = [0,0] -- var for alt distance changing" & @CRLF & _
" )," & @CRLF & _
"" & @CRLF & _
" fn listzfun trs:123 x:#() = " & @CRLF & _
" (" & @CRLF & _
" obj = snapshotasmesh a" & @CRLF & _
" min_vz = max_vz = in coordsys world (getvert obj 1).z" & @CRLF & _
" min_vx = max_vx = in coordsys world (getvert obj 1).x" & @CRLF & _
" min_vy = max_vy = in coordsys world (getvert obj 1).y" & @CRLF & _
" )" & @CRLF & _
")" & @CRLF & _
"" & @CRLF & _
"fn brung man: =" & @CRLF & _
"(" & @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