What would be the regular expression to locate a method?

Hello, I’m developing a custom plugin for Java. For certain metrics I need to locate in the code the methods that exist. I found on the sonar-java github this, but it doesn’t work:
METHOD_PATTERN ^([a-zA-Z_0-9\$]+[\.[a-zA-Z_0-9\$]+](?:\[\])?)#(\w+)(\()?
CLASS_PATTERN ^(\w+[\.\w+]
(?:\[\])?)(\()?

Can someone help me or guide me or tell me why this is wrong? or tell me where the patterns are in the git hub code

Hi @danisok,

There are files with custom rule examples: sonar-java/docs/java-custom-rules-example/src/main/java/org/sonar/samples/java/checks at master · SonarSource/sonar-java · GitHub
Please take a look and let me know if this helps you.

All the best,

Irina

Thanks for your answer, but I think that is for rules and I am using it for a sensor.
In the end I created the regular expression.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.