IntelliJ using replace (Ctrl+R) with regexp

Task:

have several code lines which “gitter” need to be replaced with actual function name called

log.debug("gitter: {}", inboudStats.getJitter());
log.debug("gitter: {}", inboudStats.getFractionLost());
log.debug("gitter: {}", inboudStats.getBytesReceived());

Solution:

Search: (gitter)(:\s\{\}”,\s(in|out)bou[nd]*Stats.get(.*)\(\))

Replace: $3$2

When intelliJ finds searching string, it gives replace string as well as matching string high lighted.

replacewith-regexp

Ref:


 

Leave a Reply

Close Menu