Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

163
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda