获取url中的参数
var channelStr = window.location.search && window.location.search.match(/utm_source=[^&]+/) || ""
var channel = channelStr && channelStr.length && channelStr[0].split('=')[1]
替换手机号中间几位为*
const strList = this.globalData.mobile.match(/^(\d{3})\d+(\d{3})$/)
if (!strList) {
return ''
}
return strList[1] + '****' + strList[2]
RegExp.prototype.test()
test() 方法执行一个检索,用来查看正则表达式与指定的字符串是否匹配。返回 true 或 false。
RegExp.prototype.test() MDN
String.prototype.match()
match() 方法检索返回一个字符串匹配正则表达式的结果。
String.prototype.match() MDN