开发者

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:

  1. (this)
  2. (for)


Try making the match non-greedy by adding a ? after the *:

/\(.*?\)/

Otherwise try

/\([^)]*\)/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜