[thelist] regex help - password pattern - javascript

Kowalkowski, Lee (ASPIRE) lee.kowalkowski at hmrcaspire.com
Tue Sep 27 07:50:51 CDT 2005


> -----Original Message-----
> From: Frank [mailto:lists at frankmarion.com]
> Sent: Tuesday, September 27, 2005 1:04 PM
> To: volkan.ozcelik at gmail.com; thelist at lists.evolt.org
> Subject: Re: [thelist] regex help - password pattern - javascript
> 
> an alpha and a numeric will always be side to side. This will catch it

Frank, this is only true if you are only allowed alpha and numeric, I'm sure
the rule was at least 2 alpha (excluding underscores) and at least 2
numeric, but as for the other 4 characters, they can be anything (percent
for example), so alpha and numeric won't necessarily always be adjacent.

> [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.

You could add {2} if you also specified that there could be zero or more
alphanumeric in between [a-z0-9]*.  Like this:

    ([a-z0-9]*([a-z][0-9]|[0-9][a-z])){2}

!

I doubt the "at least 8 characters" rule can be rolled into it once you
introduce *, + or ?.

- LK


===========================================================
Our e-mail domain has now changed from iraspire.com to hmrcaspire.com. Please update your address books.
===========================================================



More information about the thelist mailing list