Replace unicode space characters

前端 未结 4 601
轮回少年
轮回少年 2020-12-11 05:07

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         


        
4条回答
  •  温柔的废话
    2020-12-11 05:33

    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,'');
    

提交回复
热议问题