正则校验值为数字或英文


import { Message } from 'element-ui'   mathOrEng(val, type, cases) {   let newVal = ''   const or = /^[A-Za-z0-9]+$/.test(val)   const or2 = /^[A-Za-z]+$/.test(val) || /^[0-9]+$/.test(val)   const or3 = /[\u4e00-\u9fa5]/g   const or4 = /[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/g   const or5 = /[\x21-\x2f\x3a-\x40\x5b-\x60\x7B-\x7F]/g   if (!type) {     if (val && !or) {       Message({         type: 'warning',         message: '请输入数字和英文!'       })     }   }   if (type) {    if (val && !or2) {       Message({         type: 'warning',         message: '请输入数字或英文!'       })     }   }   if (or3.test(val) || or4.test(val) || or5.test(val)) {     newVal = val.replace(or3, '')     newVal = newVal.replace(or4, '')     newVal = newVal.replace(or5, '')   }   if (or && val.length && cases !== false) {       newVal = val.toUpperCase()   }   return newVal }
js