Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!