>clear >TEXT TO cText NOSHOW TEXTMERGE >DEFINE CLASS test > PROCEDURE init > IF ATC("DEFINE CLASS",x)>0 > * > ENDIF > IF ATC("PROCEDURE",x)>0 > * > ENDIF > PROTECTED PROCEDURE something > ENDPROC > HIDDEN PROCEDURE more_sss > ENDPROC > FUNCTION me(xx) > ENDFUNC > ENDPROC >ENDDEFINE >ENDTEXT > >RegExp = NEWOBJECT( "_RegExp", "RegExp.vcx" ) >cpat = "^\s*(((hidd(e(n)?)?)|(prot(e(c(t(e(d)?)?)?)?)?))\s+)?((func(t(i(o(n)?)?)?)?)|(proc(e(d(u(r(e)?)?)?)?)?))\s*\w+" >? cpat >n= RegExp.execute( ctext, cpat, .F., .T.) >? n >FOR i=1 TO n > ? >* ?? RegExp.Matches[i,1] > ?? RegExp.Matches[i,2] >* ?? substr(ctext, regexp.matches(i,1), 20) >NEXT >Three notes on this, the first concerning what I previously suggested, the others regarding your changes.
DEFINE CLASS test AS Form ADD OBJECT aButton AS CommandButton PROCEDURE aButton.Click ...will match "PROCEDURE aButton", and I think you would like to match "PROCEDURE aButton.Click" (if I'm not mistaken).
m.RegExp.pattern = "^[ \t]*(((hidd(e(n)?)?)|(prot(e(c(t(e(d)?)?)?)?)?))[ \t]+)?((func(t(i(o(n)?)?)?)?)|(proc(e(d(u(r(e)?)?)?)?)?))[ \t]+(\w+(\.\w+)?)"