文章分类 -  正则验证

摘要:Vue.prototype.$validateLimitTwo = (str) => { const reg = /(^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d{1,2})?$)/ return reg.test(str) } var validateLimit = ( 阅读全文
posted @ 2020-08-24 13:37 小蓉儿 阅读(2889) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2019-12-05 13:53 小蓉儿 阅读(272) 评论(0) 推荐(0) 编辑
摘要:var IdCardNumberReg = /(^\d{15}$)|(^\d{17}([0-9]|X)$)/; var PassportNumberReg = /^1[45][0-9]{7}$|(^[P|p|S|s]\d{7}$)|(^[S|s|G|g|E|e]\d{8}$)|(^[Gg|Tt|Ss 阅读全文
posted @ 2019-11-21 15:35 小蓉儿 阅读(79) 评论(0) 推荐(0) 编辑
摘要:let phoneReg = /^1(3|4|5|6|7|8|9)\d{9}$/; console.log(this.form.value3,'shouji') if(this.form.value3){ if(phoneReg.test(this.form.value3)){ console.lo 阅读全文
posted @ 2019-11-21 15:32 小蓉儿 阅读(69) 评论(0) 推荐(0) 编辑
摘要:^([\u4e00-\u9fa5]{2,20}|[a-zA-Z.\s]{2,20})$ 姓名长度必须为2-20个字符 /*** 1.可以是中文2.可以是英文,允许输入点(英文名字中的那种点), 允许输入空格3.中文和英文不能同时出现4.长度在20个字符以内* @param name* @return 阅读全文
posted @ 2019-11-21 15:28 小蓉儿 阅读(4464) 评论(0) 推荐(1) 编辑
摘要:const ref = new RegExp(/^[/d-]*$/) ref.test(value); 阅读全文
posted @ 2019-10-21 10:55 小蓉儿 阅读(210) 评论(0) 推荐(0) 编辑
摘要:1.1111:true 1.111:true 1.11:true 1.1:true 11.1:true 111.1:true 1111.1:true 1.11111:false 58.62596:false 58.6260:true 1.1.11.:false 阅读全文
posted @ 2019-10-15 13:57 小蓉儿 阅读(1060) 评论(0) 推荐(0) 编辑
摘要:已验证: 方法一:/^(100|[1-9]\d|\d)(.\d{1,2})$/ 方法二:/^100$|^(\d|[1-9]\d)(\.\d{1,4})*$/ 可输入例子: 23.99、34、2.0000、23.09、34 阅读全文
posted @ 2019-10-14 10:19 小蓉儿 阅读(2839) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示