0

I'm looking for a regex that only allows numbers from 0-9, and letters from a-z or A-Z. No max length. Digits can't be all the same. For example,

Not allowed: 000000 11111111 aaaaaaaaa BBBBB

Allowed: 00000001 11111111112 AAAAAAAAAAAAAB

I've tried /^(?!(.)\1{5})[0-9a-zA-Z]+$/ but looks like it only checks if the first 5 letter repeats.

Is there a way to check the pattern without giving a fixed length?

kelsny
  • 23,009
  • 3
  • 19
  • 48
Yuelin
  • 1

0 Answers0