Intellij regex find and replace up to open parenthesis

intellij-idea, regex

Solution

Use capturing group.

Replace:

([A-Za-z]+)\(

- OR `^([A-Za-z]+)\(` if you want the text only match at the beginning of the lines

with:

$1 = new TestThing("$1",

According to the the documentation, JetBrains use `$n` form for backreference.

Problem

I want to use replacement groups in IntelliJ to find and replace all occurrences of: ``` SomeText( ``` with ``` SomeText = new TestThing("SomeText", ``` Where SomeText is the replacement group

Original source