I am trying to find method calls in Java source code.
Here is my current attempt:
Subject:
exec.execute(new EngineRobot(robotPool));
Pattern:
((?!while|if|for\\b)\\b\\w+)\\s*\\((.*)\\)
I want to find both method names ("execute" and "EngineRobot") but it only returns "execute".
If I understand correctly, you want to match both of the words using one regex. Just use a lookahead for that so that the regex doesn't consume too many characters.
((?!while|if|for\b)\b\w+)\s*(?=\((.*)\))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.