function richtextfindtel(value) {
/*固定电话、手机号码、邮箱*/
var tempValue = value.replace(/<[^>]+>/g, "");
var arrMatch = tempValue.match(/[0-9a-z][0-9a-z\-\_\.]+@([0-9a-z][0-9a-z\-]*\.)+[a-z]{2,}|0[0-9]{2,3}-{0,1}[2-9][0-9]{6,7}|[0-9]+/g);
//按长度排序,避免被提前替换
for (var i = 0; i < arrMatch.length; i++) {
for (var j = i + 1; j < arrMatch.length; j++) {
if (arrMatch[i].length < arrMatch[j].length) {
var tmp = arrMatch[i];
arrMatch[i] = arrMatch[j];
arrMatch[j] = tmp;
}
}
}
for (var match in arrMatch) {
var t = arrMatch[match];
var replacev = '';
//邮箱
if (/^[0-9a-z][0-9a-z\-\_\.]+@([0-9a-z][0-9a-z\-]*\.)+[a-z]{2,}$/.test(t)) { replacev = '<a href="javascript:;" onclick="event.stopPropagation();mailto:' + t + '">' + t + '</a>';
}
//固定电话
if (/^0[0-9]{2,3}-{0,1}[2-9][0-9]{6,7}$/.test(t)) {
replacev = '<a href="javascript:;" onclick="event.stopPropagation();tel:' + t + '">' + t + '</a>';
}
//手机号码
else if (/^1[34578]\d{9}$/.test(t) || /^\d{7,8}$/.test(t)) {
replacev = '<a href="javascript:;" onclick="event.stopPropagation();tel:' + t + '">' + t + '</a>';
}
else {
}
var reg = new RegExp("(?!<a .*?>.*?)" + t + "(?![^<]*<\/a>)", "gmi");
value = value.replace(reg, replacev);
}
return value;
}