addLink(val) {
var reg = /https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9@_-](\?)?)*)*/ig;
var nStr = val.replace(reg,"<a href='$&'>$&</a>");
return nStr;
}
花了点时间,记录下
addLink(val) {
var reg = /https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9@_-](\?)?)*)*/ig;
var nStr = val.replace(reg,"<a href='$&'>$&</a>");
return nStr;
}
花了点时间,记录下
本文标题:识别文字中的标签自动添加a标签
本文链接:https://www.haomeiwen.com/subject/ifwffctx.html
网友评论