Match individual instances using RegEx
I'll be brief
"Test(this)thingplease(for)me"[/\(.*\)/]
matches
Test (this)thingplease(for) me
I want
Test (this) thing开发者_如何学JAVAplease (for) me
Use non greedy regex, i.e.: \(.*?\)
or this: \([^()]*\)
It will match:
(this)
(for)
Try making the match non-greedy by adding a ? after the *:
/\(.*?\)/
Otherwise try
/\([^)]*\)/
精彩评论