Your test is returning false because the regex [a-z]
means "exactly one letter".
A regex that works with String.matches()
is:
(?i)(?=.*a)(?=.*b)(?=.*c)...(?=.*z).*
This uses one look ahead for each letter, each of which asserts that the letter is present. The (?i)
switch turns on case insensitivity.