Aaron Reist [AR], on Friday, February 25, 2005 at 01:58 (-0500) typed
the following:

AR> The program will check for two types of usernames - the first is #xxxxxxx#
AR> (9 alphanumeric characters. beginning and ending with a number)....the
AR> second is XxxxxxxxxxX (11 alphanumeric charactors, the first and last
AR> character in this case will always be a letter)  When this second format is
AR> encounterd the program must remove the leading and ending letters and leave
AR> me with the 9 characters in the center.

$pass = 'a123456789b';
print $pass = substr $pass,1,9 if length $pass == 11;

this will only check if password is 11 chars long, if yes, remove
starting and leading char. With regexp you could check if it is
according your rulez (starting/leading numbers in 9 char pass) and so
on, so you also don;t need to look up in db...so that should looks
like:

$pass = 'a123456789b';
if ( $pass =~ /^\d\w{7}\d$/ ) {
        checkpass($pass);
} elsif ( $pass =~ /^[a-z](\w{9})[a-z]$/i ) {
        checkpass($1);
} else {
        print "Your pass did not match rulez!\n";
}

I hope it helps you.

-- 

 ...m8s, cu l8r, Brano.

[TYNH þ "I really don't care where the comma goes."-Scot T]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to