Get text between two rounded brackets

javascript, regex

Solution

console.log(
  "This is (my) simple text".match(/\(([^)]+)\)/)[1]
);

`\(` being opening brace, `(` — start of subexpression, `[^)]+` — anything but closing parenthesis one or more times (you may want to replace `+` with `*`), `)` — end of subexpression, `\)` — closing brace. The `match()` returns an array `["(my)","my"]` from which the second element is extracted.

Problem

How can I retrieve the word `my` from between the two rounded brackets in the following sentence using a regex in JavaScript? "This is (my) simple text"

Original source