ASP regular expression check for password needing numerals and characters

N

.Net Sports

I'm trying to only allow password entries that have at least one
numeric character, and 7 to 15 characters long. The below script is
not filtering it properly, it keeps saying all the entries are bad
when i am entering mixed passwords:

<%'' ASP validation for password criteria
dim strpassword
strpassword = request.form("password")
Function CheckString(strpassword, strRegExp)
Dim re
Set re = new RegExp

re.Pattern = strRegExp

CheckString = re.Test(strpassword)
End Function

'Make sure it's in the format of at least one numeral, 7 to 15
characters
If CheckString(strpassword, "^(?=.*\d).{7,15}$") then
response.write "good"
Else
response.write "bad"
End If

%>

???
netsports
 
T

ThatsIT.net.au

Your code works fine for me

try writing password to screen to check you passing the right string

response.write strpassword
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top