You need to create a set of escaped (with \
) parentheses (that match the parentheses) and a group of regular parentheses that create your capturing group:
var regExp = /\(([^)]+)\)/;_x000D_
var matches = regExp.exec("I expect five hundred dollars ($500).");_x000D_
_x000D_
//matches[1] contains the value between the parentheses_x000D_
console.log(matches[1]);
_x000D_
Breakdown:
\(
: match an opening parentheses(
: begin capturing group[^)]+
: match one or more non )
characters)
: end capturing group\)
: match closing parenthesesHere is a visual explanation on RegExplained