Check for balanced parentheses in a string using a regular expression? Piece of cake try { new RegExp(testString) } catch (e) { return false } return true
-
-
If you don't strip non-parentheses out first, there are a few failure cases: (abc\) - returns false, should be true [abc)(] - returns true, should be false
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.