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

219
Views
JS regular expression to validate alphanumeric values

looking for a regular expression in javascript which can test a string that has 4 alphabets and 7 Numeric values exp "ABCD1234567"

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Some regex basic of your requirements

^ means start
$ means end
[A-Z] means from A to Z in uppercase
[a-z] means from a to z in lowercase
\d or [0-9] means from 0 to 9
{4} means repeat times of the expression (eg. 4 here)

so for your case, this regex should works

/^[A-Z]{4}[0-9]{7}$/

Case insensitive

If both uppercase & lowercase need to be supported, you can write

/^[A-Za-z]{4}[0-9]{7}$/

or add a case insensitive regex flag i

/^[A-Z]{4}[0-9]{7}$/i

Reference

You can read about Regex document here

You can also reach out regex101 to learn more about regex and test it online.

about 4 years ago · Juan Pablo Isaza Report
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!