Maybe we need to && the conditional statements with three regex patterns:

r1 = [a-zA-Z0-9]{8}

r2 = [a-zA-Z]{1,7}

r3 = [0-9]{1,7}

or just use r2 "anded" to r3 with a string length of 8.

Eg.:

option 1: (I like this one better. It has a more definitive and tighter

constraint on the string pattern compared to opt2)

if ((Regex.IsMatch(sPassword, r1)) &&

(Regex.IsMatch(sPassword, r2)) &&

(Regex.IsMatch(sPassword, r3)))

option 2:

if ((Regex.IsMatch(sPassword, r2)) &&

(Regex.IsMatch(sPassword, r3)) &&

(sPassword.Length == 8))

http://www.regular-expressions.info/ has a good tutorial on regex.

Try it see if either works and good luck,

/Js.

"Roz Lee" <ro**@panztel.com> wrote in message

news:b7************************@posting.google.com ...

I am trying to work out a regular expression which will validate a

password box.

The following rules apply

Must be 8 characters

Must have at least one digit (0-9) and at least one character (a-z or

A-Z)

No special characters allowed except for full stop.

I am struggling to get to grips with regular expressions. Can anyone

help me with this please.

Thanks in anticipation

Ros Lee