I have a class with "n" complex functions like this:
public class Foo {
public String getSmt(String param, Foo foo) {
try {
if (smtIsTrue()) {
Thread mThread = new Thread(new Runnable(){
@Override
public void run() {
// Here I do something
}
}).start();
} else if (other()) {
if (isExisted()) {
execute();
}
}
} catch (Exception e) {
throw new Exception(e.getMessage());
} finally {
doSmt();
}
}
public String otherGetSmt(String param, Foo foo) {
try {
if (smtIsTrue()) {
Thread mThread = new Thread(new Runnable(){
@Override
public void run() {
// Here I do something
}
}).start();
} else if (other()) {
if (isExisted()) {
execute();
}
}
} catch (Exception e) {
throw new Exception(e.getMessage());
} finally {
doSmt();
}
}
}
I would like to get content of two function by using Regex. Could you so me how? I tried this
(public|protected|private|static|\s) +[\w\<\>\[\], ]+\s+(\w+) *\([^\)]*\) *(\{?|[^;]) .*\{((\s|.)*)\}
But I doesn't work fine.