re = /(?:(Dim|Public|Private) )(?:(WithEvents) )?(?:(?:(?!Declare)(?!Type)(?!Enum)(?!Const)(\w*))(\(\))?)(?: As )?(?:(New) )?(\w*)(, [\w ,\(\)]*)?/m
str = 'Attribute VB_Name = "mdl_WbkInits"
Option Compare Database
Public WithEvents ue_u23 As New String, soumeth_34ing as somethnig, asi As Anthere item, Maybe lastOne
Public ueu As Variant
Dim ueu
Public Declare Function IIDFromString Lib "ole32" (ByVal lpsz As Long, ByRef lpiid As UUID) As Long
Private Declare Function IIDFromString Lib "ole32" (ByVal lpsz As Long, ByRef lpiid As UUID) As Long
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
Private Type UUID \'GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type
Public Enum e_ControlEventCatch
e_onClick
e_onChange
e_onUpdate
e_onUpdated
e_onDblClick
e_onFocus
e_onExtClick
e_onExtDblClick
e_onActivate
e_onDeActivate
End Enum
Public Const IID_IDispatch As String = "{00020400-0000-0000-C000-000000000046}"
Const OBJID_NATIVEOM As Long = &HFFFFFFF0
'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html