develooper Front page | perl.beginners | Postings from April 2002

Re: regex

Thread Previous
April 28, 2002 08:16
Re: regex
Message ID:

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


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



Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About