user3257350
user3257350

Reputation: 51

Regular Expression intellij-idea replace

I am using IntelliJ and I would please like some help with a Regular Expression to get some results like this:

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

p.s. thanks alot

Upvotes: 2

Views: 3053

Answers (2)

vikingsteve
vikingsteve

Reputation: 40388

It looks like you are doing Replace in path to modify your source code via a regular expression?

If that is the case, you can open up Replace in path dialog (ctrl-shift-r), tick Regular Expression and enter the following:

Text to find: patient.set([A-Za-z]*)\((.*)(\);)

Replace with: {$1} and {$2}

Hope this helps.

Upvotes: 6

armnotstrong
armnotstrong

Reputation: 9065

this regex pattern replace will work

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

replace with

{$1} and {$2}

enter image description here

Upvotes: 0

Related Questions