regex - Regexp javascript and replace -
when test regex online (like http://regex101.com), works fine. when test in javascript, doesn't. don't understand i'm doing wrong.
var input = 'fzef zef zef zef (, ) dezdezfzef ezf ze'; input = input.replace('/\(\,?\s{0,}?\)/g', ''); console.log(input);
thank you
you need remove quotes around regex:
input.replace(/\(\,?\s{0,}?\)/g, '')
Comments
Post a Comment