I need a Regex that will match a java method declaration. I have come up with one that will match a method declaration, but it requires the opening bracket of the method to
I built a vim regex to do this for ctrlp/funky based on Georgios Gousios's answer.
let regex = '\v^\s+' " preamble
let regex .= '%(<\w+>\s+){0,3}' " visibility, static, final
let regex .= '%(\w|[<>[\]])+\s+' " return type
let regex .= '\w+\s*' " method name
let regex .= '\([^\)]*\)' " method parameters
let regex .= '%(\w|\s|\{)+$' " postamble
I'd guess that looks like this in Java:
^\s+(?:<\w+>\s+){0,3}(?:[\w\<\>\[\]])+\s+\w+\s*\([^\)]*\)(?:\w|\s|\{)+$