Shlomi Cohen
Shlomi Cohen

Reputation: 213

Regexp AND (for searching code in intelliJ)

i'm trying to find code in IntelliJ with regular expression search , to be able to have AND condition. i read this answer about the matter , but could not make it work i have this expression

^(?=.*platform) (?=.*SpringTestBase).*$ i have tried adding multiline /m at the end with no luck.

My Search string would be something like this

@MyAnnotation (profile=platform)
class SpringTestBase extends object {
 }

Upvotes: 0

Views: 176

Answers (1)

knittl
knittl

Reputation: 265928

You are better off using Structural Search and Replace functionality of IntelliJ, in Edit>Find>Search Structurally…:

@MyAnnotation(profile="platform")
class SpringTestBase {
}

This will automatically take care of whitespace normalization, different newline style, inheritance, etc. for you.

Upvotes: 1

Related Questions