Hi, I'm new to the list. I was looking for a nice regex list, and found this one. Let me start off with an interesting puzzle that someone sent me
A programmer wants to test a password, and he wants to do it in ONE expression. Here are the criteria for a well formed password
1) Minumum of eight characters in length 2) Two words [a-z_] are required 3) Two digits [0-9] are required.
I've been working on this all night, and what I've come up with is the following
An alpha and a numeric will always be side to side. This will catch it
[a-z_][0-9]|[0-9][a-z_]
<group alpha fb number OR number fb alpha>
The problem is that there might be a run of non-matches before, or following, or between each of these pairs. One might be inclined to say "Ah! Then the solution is to add {2,}. Not so, because then it would return the match of a1a1 but not a1xa1. It would catch a1 then 1x (it's the closest match).
This is the crux of the problem, as I've been able to figure so far.
It's a tough but interesting puzzle. I'd be interested in hearing your options.
Frank Marion lists@frankmarion.com Keep the signal high.
Hi!
On Tue, 27 Sep 2005 08:27:26 -0400, Frank lists@frankmarion.com wrote:
Hi, I'm new to the list. I was looking for a nice regex list, and found this one.
This is not a general regex list, it is specifically for the "Regex Coach" application.
A programmer wants to test a password, and he wants to do it in ONE expression. Here are the criteria for a well formed password
- Minumum of eight characters in length
- Two words [a-z_] are required
- Two digits [0-9] are required.
(?=.*[a-z_].*[a-z_])(?=.*[0-9].*[0-9]).{8,}
Cheers, Edi.