Matching Java methods - a better way than mine?
[email protected] Wed, 30 Jul 2003 16:46:43 -0400
| Newsgroups | gmane.comp.jakarta.regexp.user |
|---|---|
| Message-ID | <[email protected]> |
I've been asked to extract certain information from all the methods within the classes we use. For this, I made a rather crude program, and I identify each method with the following regexp: (public|private|protected)\s+[0-9A-Za-z_\.]+\s*(\[\s*\])?\s+\w+\s*\([^\)]*? \) This works for most of the methods in our source files, but fails to capture the constructor methods and those who have a modifier (like abstract or static). What is a better way to do this? Maybe this has even been solved in the past and I'm just reinventing the wheel? TIA. -- Miguel Farah [email protected]