我想在 IntelliJ 中使用替换组来查找和替换所有出现的:
SomeText(
与
SomeText = new TestThing("SomeText",
其中 SomeText 是替换组
最佳答案
使用捕获组。
替换:
([A-Za-z]+)\(
- OR
^([A-Za-z]+)\(
如果您希望文本只匹配行的开头
与:
$1 = new TestThing("$1",
根据the documentation , JetBrains 使用 $n
形式进行反向引用。
关于regex - Intellij 正则表达式查找并替换为左括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21140762/