正则表达式

   //颜色失焦验证
      colorBlur() {
        if (!(/^[a-zA-Zu4e00-u9fa5]+$/).test(this.color)) {
          this.$Message.warning('只能输入汉字和英文字母!')
          this.color = ''
        }

      },
      //颜色编码失焦验证
      shorthandBlur() {
        if (!(/^[A-Z]+$/).test(this.shorthand)) {
          this.$Message.warning('只能输入大写英文字母!')
          this.shorthand = ''
        }

      },
原文地址:https://www.cnblogs.com/wssdx/p/12193062.html