#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^\s*((public|private|protected)? *(static)? *(void|int|String|boolean|float|double) +[a-zA-Z_](\w)* *[\(] *(((int|String|boolean|float|double) +[a-zA-Z_](\w)*))* *( *, *int +[a-zA-Z_](\w)* *| *, *String +[a-zA-Z_](\w)* *| *, *boolean +[a-zA-Z_](\w)* *| *, *float +[a-zA-Z_](\w)* *| *, *double +[a-zA-Z_](\w)* *|\))+\s*[{]\s*|( *public +static +void +main *\( *String *(\[\])? * args *(\[\])? *\)\s*[{]\s*))"
Local $sString = "public static void salud(String hola,boolean siu) {" & @CRLF & _
"void ultimo(int hola){" & @CRLF & _
"public void saludos(){" & @CRLF & _
"void numeros(String cola, int hola, String si){" & @CRLF & _
"public static void main(String[] args){" & @CRLF & _
"protected String idnombre (int n){" & @CRLF & _
"protected void prueba(String a,int b){" & @CRLF & _
"public static void main(String[] args[]){" & @CRLF & _
"public static void main(String args[]){" & @CRLF & _
"void hola(){}" & @CRLF & _
"void hola(){" & @CRLF & _
"public void main(String id)" & @CRLF & _
"{" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"public void hola ( int c)" & @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