$re = '/^-- [^][\n]*\[.*(?:\n--[^\S\n]{3}.*)*/m';
$str = '-------------------------------------------
/ Vegetation /
-------------------------------------------
--
-- Shrubs [-] = Number of shrubs
-- Shrub_x [m/rad] = The position of shrub nr x in either (x,y,z) or in (latitude, longitude, h)
-- (XY/WGS84, height above msl)
--
------------------------------------------
I.Shrubs := 3; -- {MIN:0 MAX:10}
Car.Shrub_1 := (0.0, 0.0, 1.5);
Car.Shrub_2 := (3.4, 10.0, 0.2);
Car.Shrub_3 := (5.0, 5.0, 2.0);
-------------------------------------------
/ Lawn /
-------------------------------------------
-- Some general info thats not required but that could be written here.
--
-- Lawn_Attitude [rad] = The attitude of the lawn as Euler angles.
-- North, East and Up is used as reference frame.
-- Lawn_Quality [-] = The quality index of the lawn.
--
-------------------------------------------
Eul.Lawn_Attitude := (0.7853981,-0.23651236, 0.017);
I.Lawn_Quality := 5; --{0,1,2,3,4,5}';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php