Regular expression to identify java function
I have no idea what you are trying to match with \\s+\\w+\\s+\\w+\\s*.  If you are looking for a return type, then that won't do at all.

It appears that you are trying to match the function body using \\{.*\\}.  That won't work, because braces may be nested, and regular expressions cannot handle nesting.

Modifier keywords can appear in any order, and you are missing a few, such as:


synchronized
transient
volatile
strictfp


If you want to implement this correctly, don't just make assumptions based on code that you have been seeing.  Read the Java Language Specification.