IIS ASP - ASP regular expression check for password needing numerals and characters

This is Interesting: Free IT Magazines  
Home > Archive > IIS ASP > June 2007 > ASP regular expression check for password needing numerals and characters





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author ASP regular expression check for password needing numerals and characters
.Net Sports

2007-05-14, 1:19 pm

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

ThatsIT.net.au

2007-06-16, 1:22 pm

Your code works fine for me

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

response.write strpassword



".Net Sports" <ballz2wall@cox.net> 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
>


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com