JAVA Regular Expression Errors
Posted
by Berkay
on Stack Overflow
See other posts from Stack Overflow
or by Berkay
Published on 2010-04-01T16:16:11Z
Indexed on
2010/04/01
16:23 UTC
Read the original article
Hit count: 553
I'm working on a simply password strength checker and i can not success applying regular expressions. In different resources different kinds of regular expressions are defined. i also find javascript regular expressions but had some problems to adapt.
First, these are the regular expressions i need for JAVA:
- at least one lower case letter
- at least one upper case letter at least
- one number at least three numbers at
- least one special character at least
- two special characters both letters
- and numbers both upper and lower case
- letters, numbers, and special characters
My goal is not being a regular expression expert i just want to use the parts i need.If you direct me good tutorials which discusses above for java, will be appreciated.
Second, in this link some of them are mentioned but i'm getting problems to apply them.
here does not catch the lower case letter (my pass: A5677a)
if (passwd.matches("(?=.*[a-z])")) // [verified] at least one lower case letter {Score = Score+5;}
Also here i'm getting error : illegal escape character.
if (passwd.matches("(?=.*\d)")) // [verified] at least one number
Finally, are these expressions all different in different kind of programming or script languages?
© Stack Overflow or respective owner