Reputation: 774
When I test my regex online (like http://regex101.com), everything works fine. But when I test it in javascript, It doesn't. I don't understand what I'm doing wrong.
var input = 'fzef zef zef zef (, ) dezdezfzef ezf ze';
input = input.replace('/\(\,?\s{0,}?\)/g', '');
console.log(input);
Thank you
Upvotes: 0
Views: 36
Reputation: 2916
You need to remove the quotes from around your regex:
input.replace(/\(\,?\s{0,}?\)/g, '')
Upvotes: 2