Re: regular expression no match on set if subset matches
From: Gunnar Hjalmarsson (noreply_at_gunnar.cc)
Date: 01/24/04
- Next message: edgrsprj: "Re: Perl speed test questions Jan. 21, 2004"
- Previous message: Jeff 'japhy' Pinyan: "Re: regular expression no match on set if subset matches"
- In reply to: Dave: "regular expression no match on set if subset matches"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 24 Jan 2004 04:21:52 +0100
Dave wrote:
> I am trying to define a regular expression to validate a password
> format so that the password is valid if it contains from 4 to 10
> characters except in the one special case where it has the format
> of three letters followed by two numbers.
>
> That is, "abc13edl" is fine but "abc13" is not.
>
> Is there a solution to this
This uses two regexes:
$_ = 'mypassword';
print "OK\n" if /^\S{4,10}$/ and !/^[a-z]{3}\d{2}$/i;
> (using the gnu Java regular expression package)?
Have no idea. We talk Perl here.
-- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
- Next message: edgrsprj: "Re: Perl speed test questions Jan. 21, 2004"
- Previous message: Jeff 'japhy' Pinyan: "Re: regular expression no match on set if subset matches"
- In reply to: Dave: "regular expression no match on set if subset matches"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
Loading