正则表达式(...排除 - > \([\ s \ S] + \)......)?

时间:2013-07-27 09:33:13

标签: javascript regex

我用

a JavaScript regular expression tester

找出我的问题。

\([\s\S]+\)

(foo (foo bar) bar) foo

匹配(foo (foo bar) bar)

精细。

现在,我需要一个匹配(foo bar)

的正则表达式

所以,我需要的是(... Excludes-> \([\s\S]+\) ...)

什么是正则表达式?

1 个答案:

答案 0 :(得分:0)

> '(foo (foo bar) bar) foo'.match(/\([^()]+\)/)
["(foo bar)"]