#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?:(Dim|Public|Private) )(?:(WithEvents) )?(?:(?:(?!Declare)(?!Type)(?!Enum)(?!Const)(\w*))(\(\))?)(?: As )?(?:(New) )?(\w*)(, [\w ,\(\)]*)?"
Local $sString = "Attribute VB_Name = "mdl_WbkInits"" & @CRLF & _
"Option Compare Database" & @CRLF & _
"" & @CRLF & _
"Public WithEvents ue_u23 As New String, soumeth_34ing as somethnig, asi As Anthere item, Maybe lastOne " & @CRLF & _
"Public ueu As Variant" & @CRLF & _
"Dim ueu" & @CRLF & _
"" & @CRLF & _
"Public Declare Function IIDFromString Lib "ole32" (ByVal lpsz As Long, ByRef lpiid As UUID) As Long" & @CRLF & _
"Private Declare Function IIDFromString Lib "ole32" (ByVal lpsz As Long, ByRef lpiid As UUID) As Long" & @CRLF & _
"" & @CRLF & _
"Private Declare PtrSafe Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hwnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long" & @CRLF & _
"" & @CRLF & _
"Private Type UUID 'GUID" & @CRLF & _
" Data1 As Long" & @CRLF & _
" Data2 As Integer" & @CRLF & _
" Data3 As Integer" & @CRLF & _
" Data4(7) As Byte" & @CRLF & _
"End Type" & @CRLF & _
"" & @CRLF & _
"Public Enum e_ControlEventCatch" & @CRLF & _
" e_onClick" & @CRLF & _
" e_onChange" & @CRLF & _
" e_onUpdate" & @CRLF & _
" e_onUpdated" & @CRLF & _
" e_onDblClick" & @CRLF & _
" e_onFocus" & @CRLF & _
" e_onExtClick" & @CRLF & _
" e_onExtDblClick" & @CRLF & _
" e_onActivate" & @CRLF & _
" e_onDeActivate" & @CRLF & _
"End Enum" & @CRLF & _
"" & @CRLF & _
"Public Const IID_IDispatch As String = "{00020400-0000-0000-C000-000000000046}"" & @CRLF & _
"Const OBJID_NATIVEOM As Long = &HFFFFFFF0" & @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