var reg = new RegExp( '\\.', "g"); //创建正则RegExp对象 \\是转意符,要不然就会匹配除\n以外的所有字符
labelstr += " class=\"tag\" contenteditable=\"false\" name=\"" + name + "\" path=\"" + path + "\">" + path.replace(reg, "=>") + "</span> " ;
转载于:https://www.cnblogs.com/luchunqing/p/3617403.html