11-16-2010, 03:54 PM
(This post was last modified: 11-16-2010, 03:55 PM by ngocvo3103.)
Hi Ritesh,
I'm a bit confused with your requirements
1. The password contains 8 characters, and fifth character should be numeric, so what should the first 4 characters be? Alphabet letters or numeric or special characters?
2. Also, what should the sixth character be?
Anyway, I post my regular expression to solve your problem (hope I got you)
My regular expression will match with the password which has:
- 8 characters in total
- The first 4 characters should be Alphabet letters
- The fifth character should be numeric
- The sixth character should be Alphabet letters
- The last 2 characters should be special character except % and ^ (I added some special characters on keyboard, you can add some more if you want)
I'm a bit confused with your requirements
1. The password contains 8 characters, and fifth character should be numeric, so what should the first 4 characters be? Alphabet letters or numeric or special characters?
2. Also, what should the sixth character be?
Anyway, I post my regular expression to solve your problem (hope I got you)
Code:
^\w{4,4}\d\w[!@#$&*()-_=+\{\}\[\]|\\/;:'",.<>`~]{2,2}$
My regular expression will match with the password which has:
- 8 characters in total
- The first 4 characters should be Alphabet letters
- The fifth character should be numeric
- The sixth character should be Alphabet letters
- The last 2 characters should be special character except % and ^ (I added some special characters on keyboard, you can add some more if you want)