Joelio
Joelio

Reputation: 4691

regex to match a string that could extend over several lines

I have examples in a text document line this:

 set (  blah blah blah )

and

 set ( blahlblah
 blahlbal )

and

set ( blah
blah
blah
blah
blah )

I am using text mate and want to find these and replace with nothing

I got this to work with one line but stumped on how to do this over multiple lines. I tried this:

 SET \(.*\n.*\)

Upvotes: 2

Views: 388

Answers (2)

user557597
user557597

Reputation:

I have no idea if textmate can do this

 ^\s*set\s*\([\S\s]*\)[^)]*$

 --------------------------
 ^ 
 \s* set \s* 
 \(
    [\S\s]* 
 \)
 [^)]* 
 $

Upvotes: 0

Jerry
Jerry

Reputation: 71558

Try a simpler:

set \([^)]+\)

Unless the set contains nested sets, that should work.

Upvotes: 2

Related Questions