项目中使用到的正则表达式

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

posted @ 2022-11-03 23:19  无相蛋  阅读(21)  评论(0)    收藏  举报