#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^-- [^][\n]*\[.*(?:\n--[^\S\n]{3}.*)*"
Local $sString = "-------------------------------------------" & @CRLF & _
"/ Vegetation /" & @CRLF & _
"-------------------------------------------" & @CRLF & _
"-- " & @CRLF & _
"-- Shrubs [-] = Number of shrubs" & @CRLF & _
"-- Shrub_x [m/rad] = The position of shrub nr x in either (x,y,z) or in (latitude, longitude, h)" & @CRLF & _
"-- (XY/WGS84, height above msl)" & @CRLF & _
"-- " & @CRLF & _
"------------------------------------------" & @CRLF & _
"I.Shrubs := 3; -- {MIN:0 MAX:10}" & @CRLF & _
"Car.Shrub_1 := (0.0, 0.0, 1.5);" & @CRLF & _
"Car.Shrub_2 := (3.4, 10.0, 0.2);" & @CRLF & _
"Car.Shrub_3 := (5.0, 5.0, 2.0);" & @CRLF & _
"" & @CRLF & _
"-------------------------------------------" & @CRLF & _
"/ Lawn /" & @CRLF & _
"-------------------------------------------" & @CRLF & _
"-- Some general info thats not required but that could be written here." & @CRLF & _
"-- " & @CRLF & _
"-- Lawn_Attitude [rad] = The attitude of the lawn as Euler angles. " & @CRLF & _
"-- North, East and Up is used as reference frame." & @CRLF & _
"-- Lawn_Quality [-] = The quality index of the lawn." & @CRLF & _
"--" & @CRLF & _
"-------------------------------------------" & @CRLF & _
"Eul.Lawn_Attitude := (0.7853981,-0.23651236, 0.017); " & @CRLF & _
"I.Lawn_Quality := 5; --{0,1,2,3,4,5}"
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