正则表达式 intellij-idea 替换

Regular Expression intellij-idea replace

我正在使用 IntelliJ,我希望得到一些关于正则表达式的帮助以获得如下结果:

    patient.setIdentificationDate(new Date()); -> {IdentificationDate} and {new Date()}
    patient.setIdentificationNumber(153698); -> {IdentificationNumber} and {153698}
    patient.setIdentificationSeries("33 02"); -> {IdentificationSeries} and {"33 02"}

p.s。非常感谢

您似乎在Replace in path通过正则表达式修改您的源代码?

如果是这样,您可以打开 Replace in path 对话框 (ctrl-shift-r),勾选 正则表达式 并输入以下内容:

要查找的文本:patient.set([A-Za-z]*)\((.*)(\);)

替换为:{} and {}

希望这对您有所帮助。

此正则表达式模式替换将起作用

patient.set([^(]*)\((.*)\);

替换为

{} and {}