En réponse à Ariel Scolnicov <[EMAIL PROTECTED]>:

> Robin Houston <[EMAIL PROTECTED]> writes:
> 
> > It's interesting to try & do it as a single regex. The shortest
> > I've found is:
> > 
> >   /(?=[a-z].*[a-z].*[a-z]).*\d.*\d/
> 
>     /(?=(.*[a-z])){3}(.*\d){2}/i
> 
> (you also need the i I guess).

But yours is wrong: you are testing 3 times the same thing.
Since the lookahead is zero-length, you'll "match" 3 times the first letter.
So a23 would match.

This one

      /(?=(.*[a-z]){3})(.*\d){2}/i

should work.

-- 
 Philippe BRUHAT - BooK

 When you run from your problem, you make it that much harder for good
 fortune to catch you, as well.     (Moral from Groo The Wanderer #14 (Epic))

Reply via email to