ASP regular expression check for password needing numerals and characters
am 14.05.2007 19:45:51 von ballz2wall
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
Re: ASP regular expression check for password needing numerals and characters
am 16.06.2007 17:11:07 von me
Your code works fine for me
try writing password to screen to check you passing the right string
response.write strpassword
".Net Sports" wrote in message
news:1179164751.643173.185430@l77g2000hsb.googlegroups.com.. .
> 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
>