手机间隔

var str = '13726542608';
var newstr = '';
newstr = str.replace(/s/g, '').replace(/(^d{3})(?=d)/g, "$1 ").replace(/(d{4})(?=d)/g, "$1 ");
console.log(newstr);

原文地址:https://www.cnblogs.com/luoguixin/p/9183170.html