0

I want to match the strings which has atleast a diit , atleast three letters and the length of the string must be at least 6. And the string won't contain any character other than letters or digits.

So far the best i got is

"^(?=.?[0-9])(?=(?:.?[A-Za-z]){3})[a-zA-Z0-9]{6,}$

  • possible duplicate of [Reference - What does this regex mean?](http://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean) – Javier Feb 23 '15 at 11:30
  • Furthermor, what is the regex engine you are using? – Willem Van Onsem Feb 23 '15 at 11:34
  • To debug your regular expression, check out http://www.regexr.com/ or http://regexper.com/ – Richard Ev Feb 23 '15 at 11:35
  • Your description is not quite clear. Do you mean "one to six numbers followed by three letters" or do you mean "one to six numbers and three letters in any order"? – Lorenz Meyer Feb 23 '15 at 12:04

1 Answers1

1

It seems like you want to match the strings which has atleast a diit , atleast three letters and the length of the string must be atleast 6. And the string won't contain any character other than letters or digits.

^(?=.*?[0-9])(?=(?:.*?[A-Za-z]){3})[a-zA-Z0-9]{6,}$

DEMO

Avinash Raj
  • 160,498
  • 22
  • 182
  • 229