需要在{}中的unicode字符串中放置unicode单词列表.有我的代码:
var txt = "¿One;one oneé two two two two two twö twöu three;;twä;föur?";
var re = new RegExp("(^|\\W)(one|tw|two two|two|twöu|three|föur)(?=\\W|$)", "gi");
alert(txt.replace(re, '$1 {$2}'));
Run Code Online (Sandbox Code Playgroud)
它返回:
¿{One}; {one} {one}é{two two} {two two} {two} {tw}ö{tw}öu{three} ;; {tw}ä; {föur}?
但应该是:
¿{One}; {one}oneé{two two} {two two} {two}twö{twöu} {three} ;;twä; {föur}?
我做错了什么?