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

标签 javascript regex

我用

a JavaScript regular expression tester

找出我的问题。

\([\s\S]+\) 代表 (foo (foo bar) bar) foo

匹配 (foo (foo bar) bar)

很好。

现在,我需要一个正则表达式来匹配 (foo bar)

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

什么是正则表达式?

最佳答案

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

关于javascript - (... 排除->\([\s\S]+\) ...) 的正则表达式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17896324/

相关文章:

javascript - ECMAScript 真的是 Lisp 的一种方言吗?

javascript - jwplayer 6 : how to dynamically load file, 使用 javascript api?

regex - 如何以复杂模式 grep 日期?

python - 类型错误 : expected string or buffer python re. 搜索

javascript - 正则表达式多提取一个符号

javascript - 在一个循环中,我附加了一个标记来提醒循环索引计数。为什么它总是提醒循环的最后一个索引?

javascript - 实现极小极大

javascript - Google 图表分数数字

mysql - 在类似mysql的查询中包含点运算符

c# - 如何获得重叠的 3 x 3 字符串的单词?