Search code examples
intellij-idea

Finding and replacing text in Intellij IDEA


What do I have:

More then 100 lines of fields with same structure:

var type1Name:String = "<some text>";
var type2Name:String = "<some text>";

<some text> is always different. name is always same.

What I want:

Delete all <some text> in all fields. This is more likely to "find and replace" operation, to find something like Name:String = "***"; and replace it with Name:String = ""; in all cases.

How can i do this with Intellij IDEA?


Solution

  • if it is in one file : ctrl + r check the tick box Regex and look for Name:String = \"[^\"]*\" : this should match what you want.

    Then replace it with whatever you want.

    If it is in multiple file, use ctrl + shift + r