您需要创建一组转义的(带有
)括号(与括号匹配)和一组常规的括号来创建捕获组:var regExp = /(([^)]+))/;var matches = regExp.exec("I expect five hundred dollars ($500).");//matches[1] contains the value between the parenthesesconsole.log(matches[1]);分解:
(
:匹配左括号(
:开始捕获组[^)]+
:匹配一个或多个非)
字符)
:结束捕获组)
:匹配右括号



