Regular expressions are a weakness of mine.
I am looking for a regex or other technique that will allow me to read an arbitrary string and determine if it is a valid java function.
Good:
public void foo()
void foo()
static protected List foo()
static List foo()
Bad:
public List myList = new List()
Code:
For String line : lines.
{
If(line.matches("(public|protected|private)*(/w)*(")
}
Is there such a regex that will return true if it's a valid java function?