How do you check, in JavaScript, if a string is a proper regular expression that will compile?
For example, when you execute the following javascript, it produces an error.
var regex = new RegExp('abc ([a-z]+) ([a-z]+))');
// produces:
// Uncaught SyntaxError: Invalid regular expression: /abc ([a-z]+) ([a-z]+))/: Unmatched ')'
How does one determine if a string will be a valid regex or not?