I need to replace the unicode characters defined on here
I have got this so far but it seems to remove all space including standard spacebar ones:
va
Remove the regular space that you have first in the pattern:
str = str.replace(/[\u00A0\u1680\u180e\u2000-\u2009\u200a\u200b\u202f\u205f\u3000]/g,'');
I guess you should use the escape sequence for spaces (15.10.2.12 of the norm) which is \s, and that you want to replace multiple spaces by a single one :
str= str.replace(/\s+/g,' ') ;
I think you can simplify, try this:
str = str.replace(/(?! )\s/g,'');
Demo: http://jsbin.com/acexun/2/edit
try this:
var str = "Hello this is a test of the site";
str= str.replace(/[\u00A0\u1680\u180e\u2000-\u2009\u200a\u200b\u202f\u205f\u3000]/g,'')
same as you did, but with out ' ' (regular space)