Using JavaScript regex to strip substring that contains parentheses
Posted
by cathat
on Stack Overflow
See other posts from Stack Overflow
or by cathat
Published on 2010-04-09T15:38:01Z
Indexed on
2010/04/09
15:43 UTC
Read the original article
Hit count: 278
regex
|JavaScript
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.
© Stack Overflow or respective owner