I have problem in removing ' with (blank and no space). Like Kello's to kellos.
I already tried this-
str = str.replace(/[\']/g, '');
But its not working.
Please help.
It actually does work:
var str = 'aa\'bb\'cc';
alert(str.replace(/'/g,'')); // aabbcc
alert(str.replace(/[\']/g,'')); // aabbcc
You do not need a character class, you just have to mask it if you use single quotes in JavaScript.
Also, keep in mind that ' (U+0027) is different from ’ (U+2019) and must be handled separately.
.replace(/'/g, '') and .replace(/[\']/g, '') in respect to the result? Exactly: none. Both replace all ' with a blank.
/'/gbut that would not change the already working code. Please be more specific in describing the problem. Input, expected output, actual wrong output.