Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
how in javascript to check with the help of regular expressions matches the mask and pattern to this mask?

I'm trying to make a special input that will check the mask by the pattern of this mask for the correctness of the entered characters. I thought that I need to create an array with regular expressions for each character for the pattern. The pattern should include Latin and Cyrillic characters, spaces, dashes and underscores. I'm trying now to check if the check works, but anything can get into my input. What is the correct way to make sure that it checks the pattern and mask which characters should be included in the input?

export default {
  data: ()=>({
    plate_pattern:{
      app11le: "AAA11AA",
      cherr11y:"AAAA11A",
      a111pricot: "A111AAAAA"
    },
    pattern_key: this.plate_pattern,
    handler: "",
    mask: [{app11le:' ___ __ __'}, {cherr11y: '____ ___'}, {a111pricot: '_ _______'}],
    placeholder: '_',
    start: 0,
    isRight: true,

  }),

 methods:{
    isNumber(checkIfNumber){
      return !isNaN(checkIfNumber) && parseInt(+checkIfNumber) == checkIfNumber() && !isNaN(parseInt(checkIfNumber, 10))
    },
    isLetter(checkIfLetter){
      return isNaN(checkIfLetter) && checkIfLetter.toLowerCase() != checkIfLetter.toLowerCase() && checkIfLetter.length == 1
    },
    isRightSymbol(checkIfSymbolInArray){
      let arraySymbolExist = [
          {name: 'app11le', regex: /^[\wа-я][\wа-я][\wа-я][0-9_][\wа-я][\wа-я]$/, check: true},
        {name:'cherr11y', regex:/^[\wа-я][\wа-я][\wа-я][\wа-я][\wа-я][0-9_][\wа-я]$/, check: true },
        {name:'a111pricot', regex: /^[\wа-я][0-9_][0-9_][0-9_][\wа-я][\wа-я][\wа-я][\wа-я][\wа-я][\wа-я]$/ }
      ]
  if(arraySymbolExist.length){
  for (let i = 0; i < arraySymbolExist.length; i++) {
    return !checkIfSymbolInArray.match(arraySymbolExist[i])
  }
}
    },
    inputFruitName(fruitsName){
      if(this.isNumber(fruitsName.key) || this.isLetter(fruitsName.key) && this.isRightSymbol(fruitsName.key)){
        this.isRight = false;
      }
    },
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda