Front page | perl.beginners |
Postings from April 2002
Re: regex
Thread Previous
From:
drieux
Date:
April 28, 2002 08:16
Subject:
Re: regex
Message ID:
C82BB818-5ABA-11D6-A835-0030654D3CAE@wetware.com
On Sunday, April 28, 2002, at 07:13 , Mat Harrison wrote:
> what sort of regex's should i be looking at to validate a username and
> password field so that input can only be up to and including 15 chars long
> and does not contain any special characters?
you want to limit usernames and passwd's to
[a-zA-Z0-9]
without any of the non-alphanumeric tokens....
{ not a good passwd strategy if I may kvetch }
my $MAXWORD = 15;
my $pattern = qr/^\w{1,$MAXWORD}$/;
cf perldoc perlre
ciao
drieux
---
Thread Previous