#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?xm)^\s*class\s+" & @CRLF & _
"(?P<class>\S+)[^{}]+(\{" & @CRLF & _
"(?:[^{}]*|(?2))*" & @CRLF & _
"\})"
Local $sString = "" & @CRLF & _
"<?php" & @CRLF & _
"" & @CRLF & _
"// base class with member properties and methods" & @CRLF & _
"class Vegetable {" & @CRLF & _
"" & @CRLF & _
" var $edible;" & @CRLF & _
" var $color;" & @CRLF & _
"" & @CRLF & _
" function Vegetable($edible, $color="green")" & @CRLF & _
" {" & @CRLF & _
" $this->edible = $edible;" & @CRLF & _
" $this->color = $color;" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" function is_edible()" & @CRLF & _
" {" & @CRLF & _
" return $this->edible;" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" function what_color()" & @CRLF & _
" {" & @CRLF & _
" return $this->color;" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
"} // end of class Vegetable" & @CRLF & _
"" & @CRLF & _
"// extends the base class" & @CRLF & _
"class Spinach extends Vegetable {" & @CRLF & _
"" & @CRLF & _
" var $cooked = false;" & @CRLF & _
"" & @CRLF & _
" function __construct()" & @CRLF & _
" {" & @CRLF & _
" parent::__construct(true, "green");" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" function cook_it()" & @CRLF & _
" {" & @CRLF & _
" $this->cooked = true;" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" function is_cooked()" & @CRLF & _
" {" & @CRLF & _
" return $this->cooked;" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
"} // end of class Spinach" & @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