关于邮件系统收件人地址格式判断的问题 本帖最后由 kksse 于 2009-12-28 17:19:49 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var datas = ['[email protected]','a','[email protected],[email protected],[email protected]','a,b,c','a,[email protected],c'];function remendinput(oInput) { oInput = oInput.replace(/(^|,)(\w+(\.\w+)?)(?!@)/g, "[email protected]"); //document.getElementById("ss").value = oInput; document.write(oInput + '<br/>');}document.open(); for (var i = 0; i < datas.length; i++) { remendinput(datas[i]); }document.close(); 使用此表达式,会对@前超过1个字符的邮件地址判断错误。输入结果:[email protected]@xxx.comvar datas = ['[email protected]'];function remendinput(oInput) { oInput = oInput.replace(/(^|,)(\w+(\.\w+)?)(?!@)/g, "[email protected]"); //document.getElementById("ss").value = oInput; document.write(oInput + '<br/>');}document.open(); for (var i = 0; i < datas.length; i++) { remendinput(datas[i]); }document.close(); var datas = ['[email protected]'];function remendinput(oInput) { oInput = oInput.replace(/(^|,)(\w+(\.\w+)?)(?!@|\w)/g, "[email protected]"); //document.getElementById("ss").value = oInput; document.write(oInput + '<br/>');}document.open(); for (var i = 0; i < datas.length; i++) { remendinput(datas[i]); }document.close(); 谢谢,非常感谢,搞定了,不过还是一点不明白,如下红色部分(^|,)(\w+(\.\w+)?)(?!@|\w)为什么我写(\w+(\.\w+)*)也没有错误写(\w+)也可以,为什么要加上(\.\w+)? 呢。 用脚本对文本框赋值,事件oninput不会触发,这个怎么解决呢 高手进 js访问webserivce xml解析问题(不会的捧人场刷每天分) Ext 如何设置页面所有textfield 为不可编辑啊 function spawn(),这个javascript函数我看不懂! cookie的跨域,我解决不了了........ 实在想不通 请教这6行代码输出为什么是这样 求数据表该如何设计呢 怎样取得页面最底部的坐标? 昨天问的已结贴了,但答案不是我要的。再问 烦琐的日期校验问题--在页面实现 哪位给解释一下这段代码的功能 求高手帮助完成以下功能,附上代码。 DIV切换与超链接的比较
'a',
'[email protected],[email protected],[email protected]',
'a,b,c',
'a,[email protected],c'];function remendinput(oInput) {
oInput = oInput.replace(/(^|,)(\w+(\.\w+)?)(?!@)/g, "[email protected]");
//document.getElementById("ss").value = oInput;
document.write(oInput + '<br/>');
}document.open();
for (var i = 0; i < datas.length; i++) {
remendinput(datas[i]);
}
document.close();
var datas = ['[email protected]'];function remendinput(oInput) {
oInput = oInput.replace(/(^|,)(\w+(\.\w+)?)(?!@)/g, "[email protected]");
//document.getElementById("ss").value = oInput;
document.write(oInput + '<br/>');
}document.open();
for (var i = 0; i < datas.length; i++) {
remendinput(datas[i]);
}
document.close();
oInput = oInput.replace(/(^|,)(\w+(\.\w+)?)(?!@|\w)/g, "[email protected]");
//document.getElementById("ss").value = oInput;
document.write(oInput + '<br/>');
}document.open();
for (var i = 0; i < datas.length; i++) {
remendinput(datas[i]);
}
document.close();
写(\w+)也可以,
为什么要加上(\.\w+)? 呢。