彭煜

导航

element-ui的rules中正则表达式

 

rules: {
    loseEfficacyReason: [
          { required: true, message: '请输入原因', trigger: 'blur' },
          { min: 2, message: '请输入不少于2个字符', trigger: 'blur' },
          { pattern: /^[A-Za-z0-9\u4e00-\u9fa5]+$/, message: '不允许输入空格等特殊符号' }
      ]
}

  

1. 大于0的数,最多可以有两位小数正则表达式

  (^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)

 

2. 利率:  ^([1-9]|[1-9]\d)(\.\d{1,2})?$|(^0\.[1-9])$|(^0\.\d[1-9])$

 

3. 利率正则表达式

  ^\\d+(\\.\\d)?\\d{0,1}%$

  /^(([1-9]\\d{0,9})|0)(\\.\\d{1,2})?%$/

 

 

 

参考链接: https://blog.csdn.net/wujinsong2010/article/details/46119243?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522159238204819725211955103%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=159238204819725211955103&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_v2~rank_v25-2-46119243.first_rank_v2_rank_v25&utm_term=%E5%88%A9%E7%8E%87%E6%AD%A3%E5%88%99%E6%A0%A1%E9%AA%8C

 

posted on 2020-06-17 16:33  彭煜ฅ˙-˙ฅ  阅读(565)  评论(0编辑  收藏  举报