#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mx)^ # Start of line" & @CRLF & _
"[^()\r\n]* # Any number of non parentheses characters" & @CRLF & _
"(?:\([^()\r\n]*(?:\([^()\r\n]*(?:\([^()\r\n]*(?:\([^()\r\n]*\))?[^()\r\n]*\))?[^()\r\n]*\))?[^()]*\))?" & @CRLF & _
"[^()\r\n]* # Any number of non parentheses characters" & @CRLF & _
":(?!=) # Colon NOT followed by an equal-sign" & @CRLF & _
"[^()\r\n]* # Any number of non parentheses characters" & @CRLF & _
"(?:\([^()\r\n]*(?:\([^()\r\n]*(?:\([^()\r\n]*(?:\([^()\r\n]*\))?[^()\r\n]*\))?[^()\r\n]*\))?[^()]*\))?" & @CRLF & _
"[^()\r\n]* # Any number of non parentheses characters" & @CRLF & _
"$"
Local $sString = "all: whatevs" & @CRLF & _
"all: " & @CRLF & _
"deps:" & @CRLF & _
"$(EXECUTABLE): $(OBJECTS)" & @CRLF & _
"$(sort $(a)): $(b) ;" & @CRLF & _
"$(a): b" & @CRLF & _
"$(a:b=c) : d" & @CRLF & _
"$(X:a=b) : w ;" & @CRLF & _
"lib/%.o: CFLAGS := -fPIC -g" & @CRLF & _
"%.o: CFLAGS := -g" & @CRLF & _
"ifneq ($(words $(subst :, ,$(CURDIR))), 1)" & @CRLF & _
"hash := $(shell printf '\043')" & @CRLF & _
"var := $(shell find . -name "*.c")"
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