Regular Expression:
^ (? : Public | private )? *? (Sub | function | property (? : Let | set | get) +? (/W + )/(?
VB processing method:
Option explicit <br/> private sub form_load () <br/> dim strdata $ <br/> dim Reg as object <br/> dim matchs as object, match as object </P> <p> strdata = "option explicit" & vbcrlf & _ <br/> "Public formdisplayed as Boolean" & vbcrlf & _ <br/> "Public vbinstance as vbide. VBE "& vbcrlf & _ <br/>" dim mcbmenucommandbar as office. commandbarcontrol "& vbcrlf & _ <br/>" Public withevents menuhandler as comma Ndbarevents 'COMMAND Bar event handler "& vbcrlf & _ <br/>" "& vbcrlf & _ <br/>" 'This event fires when the menu is clicked in the IDE "& vbcrlf & _ <br/> "private sub menuhandler_click (byval commandbarcontrol as object, handled as Boolean, canceldefault as Boolean) "& vbcrlf & _ <br/>" 'dim dd as object, CC as object, S $, I "& vbcrlf & _ <br/>" 'set dd = vbinstance. commandbars "& vbcrlf & _ <br/> "'" & Vbcrlf & _ <br/> "'s = vbinstance. commandbars. count & vbcrlf "& vbcrlf & _ <br/>" 'for I = 10 to vbinstance. commandbars. count-1 "& vbcrlf & _ <br/>" 'set cc = vbinstance. commandbars (I) "& vbcrlf & _ <br/>"'s = S & CC. index & vbtab & CC. name & vbtab & CC. namelocal & vbcrlf "& vbcrlf & _ <br/>" 'Next "& vbcrlf & _ <br/>" "& vbcrlf & _ <br/>" 'vbinstance. activecodepane. codemodule. inser Tlines 5, "" fadsfsadfsdafsdaf "" & vbcrlf & _ <br/> "msgbox vbinstance. activecodepane. codemodule. countoflines "<br/> set Reg = Createobject (" VBScript. regexp ") <br/> Reg. global = true <br/> Reg. ignorecase = true <br/> Reg. pattern = "(?: Public | private )? *? (?: Sub | function) +? (/W + )/(? "</P> <p> set matchs = reg. execute (strdata) </P> <p> for each match in matchs <br/> debug. print match. submatches (0) <br/> next <br/> end sub