Replacing using named capture groups in IntelliJ IDEA

I stumbled on the solution to this while trying to use a named capture group in IntelliJ. I haven’t been able to find documentation on it.

The official documentation now shows how this is done (thanks @Pang):

  • Numbered capture groups use $n e.g. find: <h2>(.*?)</h2> replace: $1.
  • Named capture groups use ${<name>} e.g. find: <h2>(?<title>.*?)</h2> replace: ${title}

Leave a Comment