var t_tPipeId = $("#tPipeId").val();t_tPipeId = $.trim(t_tPipeId); t_tPipeId = t_tPipeId.replace(/\-/g,"_n");//特殊字符除外"-"
var t_tPipeLen = $("#tPipeLen").val();t_tPipeLen = $.trim(t_tPipeLen);
var t_tColor = $("#tColor").val();t_tColor = $.trim(t_tColor); t_tColor = t_tColor.replace("#","");//特殊字符#用%23替代
var reg = /^\d+$/;//请填写数字
var reg2 = /^[\u4E00-\u9FA5\uf900-\ufa2d\w\.\s]+$/;//不能输入特殊字符
$("#msgInfo").html("不能为空!");
return false;
}else if(!reg.test(t_tPipeLen) || !reg.test(t_tPipeDia) || !reg.test(t_tPipeMat) || !reg.test(t_tLvl)){
$("#msgInfo").html("请填写数字!");
return false;
}else if(!reg2.test(t_tPipeId)){
$("#msgInfo").html("不能输入特殊字符!");
return false;
}
var s = "abcdefgbb";
s = s.replace("b","n"); //将b替换成n,只能替换一次
s = s.replace(/\b/g,"n");//将所有的b替换成n
原文链接:https://www.f2er.com/regex/361156.html