正则 相关

(1)对手机号码 进行 替换为 - 分开

var telText = tel.replace(/.{0,3}/,"$&-").replace(/.{0,8}/,"$&-");

 

(2) string 去掉- :空格 的正则

new RegExp(/-|:|\s+/g)

posted @ 2016-12-12 23:35  he0xff  阅读(167)  评论(0编辑  收藏  举报