Take an example.
public static FieldsConfig getFieldsConfig(){
if(xxx) {
sssss;
}
return;
}
I write a regex, \"\\\\
I had to modify this answer for my own needs. I wanted capture groups for the entire method as well as the names of each method in the file. I only need these two capture groups. This requires the single line (s) flag in PCRE. The global (g) flag would be needed to in other REGEX parses to capture the full file and not just one match. I nested the bracket capture @SamWhan showed to allow five levels of nesting. This should get the job done as more is against most recommended standards. This makes this REGEX really expensive so be warned.
(?:public|private|protected|static|final|abstract|synchronized|volatile)\s*(?:(?:(?:\w*\s)?(\w+))|)\(.*?\)\s*(?:\{(?:\{[^{}]*(?:\{[^{}]*(?:\{[^{}]*(?:\{[^{}]*(?:\{[^{}]*(?:\{[^{}]*}|.)*?[^{}]*}|.)*?[^{}]*}|.)*?[^{}]*}|.)*?[^{}]*}|.)*?[^{}]*}|.)*?})