项目中使用到的正则表达式
正整数:
if(!(/(^[1-9]\d*$)/.test(effective_time))){ alert("有效时间只能为正整数"); }
文件格式:
if (!/\.(jpg|jpeg|png|JPG|PNG)$/.test(img.name)) { alert("文件格式错误"); $(this).val(""); }
正整数:
if(!(/(^[1-9]\d*$)/.test(effective_time))){ alert("有效时间只能为正整数"); }
文件格式:
if (!/\.(jpg|jpeg|png|JPG|PNG)$/.test(img.name)) { alert("文件格式错误"); $(this).val(""); }