Using JavaScript regex to strip substring that contains parentheses
- by cathat
I have a string called myString that contains some part the end that I do not want:
var myString = 'The sentence is good up to here foo (bar1 bar2)';
var toBeRemoved = 'foo (bar1 bar2)';
How can I use best JavaScript regex to remove the part I don't want. The method replace() seems to have a problem with the parentheses.