Aaron Reist wrote:
Hello everyone,
Hello,
not quite sure if what I m trying to do is possible, but here is the
basic idea:
Currently I have a simple program takes a username from a html textbox
and checks against a list of values in a notepad document. If the name
is found the user is given access, if not they are prompted to try again.
What I am trying to do now is have the program check the username format
BEFORE it checks against the list.
The program will check for two types of usernames - the first is
#xxxxxxx# (9 alphanumeric characters. beginning and ending with a
number)....the second is XxxxxxxxxxX (11 alphanumeric charactors, the
first and last character in this case will always be a letter) When
this second format is encounterd the program must remove the leading and
ending letters and leave me with the 9 characters in the center.
is this somthing I should use the split function for?
any suggestions or examples would be greatly appreatiated.
You could use a regular expression to do that.
my $input = get_input_from_user();
$input =~ /\A(?:[[:alpha:]]([[:alnum:]]{9})[[:alpha:]]|(\d[[:alnum:]]{7}\d))\z/
and my $username = $+;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>