This might be easy for those who play with regular expressions.
str = "Here is 'sample' test";
str = str .replace(new RegExp('"', 'g'), '');
str = str .replace(new RegExp("'", 'g'), '');
How to combine 2nd and 3rd line, I want to combine regular expressions new RegExp('"', 'g')
and new RegExp("'", 'g')
into one regular expression, this will make it in one line. Thanks in advance.
str = str.replace(/"|'/g, '')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With