I'm having trouble coming up with a regex that will match the javadoc comment contents for a specific java method. Example:
/**
* Do not match this.
*/
/**
* Do match this.
*/
@SomeAnnotation
public boolean methodX() { }
/**
* Do not match this.
*/
I already know the method signature so I can use that in the regex.
I can match all of the javadoc comments using:
/\*\*(.*?)\*/
I'm also specifying re.DOTALL. I tried expanding the regex to use a negative lookahead that says I only want a javadoc comment if it's the comment immediately proceeding the method:
/\*\*(.*?)\*/(?!.*?/\*\*.*?public boolean methodX\(\))
But that's causing the (.*?) to match the contents from the start of the first javadoc comment to the end of the javadoc comment immediately proceeding methodX.
I keep trying various ways of constructing positive and negative lookaheads but nothing is working. What am I missing?