简体   繁体   中英

Replace UniCode with space in javascript

I want to replace unicode characters with space. For example, I have this string

This was a very successful meeting.\ \ We agreed on several topics:\ New strategy\ Development ressources\ Project optimization

and I want to replace \ with space . Currently, I am doing it this way ie

var str = "This was a very successful meeting.\u000b\u000bWe agreed on several topics:\u000b";
var replaceStr = str.replace(/[\u000b\u00A0\u1680​\u180e\u2000-\u2009\u200a​\u200b​\u202f\u205f​\u3000\u000b-]/g, ' ');

but it's not replacing these unicode characters with space.

Thank you

I want to replace unicode characters with space. For example, I have this string

This was a very successful meeting.\ \ We agreed on several topics:\ New strategy\ Development ressources\ Project optimization

and I want to replace \ with space . Currently, I am doing it this way ie

var str = "This was a very successful meeting.\u000b\u000bWe agreed on several topics:\u000b";
var replaceStr = str.replace(/[\u000b\u00A0\u1680​\u180e\u2000-\u2009\u200a​\u200b​\u202f\u205f​\u3000\u000b-]/g, ' ');

but it's not replacing these unicode characters with space.

Thank you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM