View Full Version : User Name preg_match not working.

06-03-2010, 05:15 PM
Sorry, it's the old nutshell again.
My password must have 10 alphanumerics and there must be one capital, one lower case and one digit. I found the following and it's not working. Would someone let me know why ?


I've tried variations of the above but none clear the error message.

Thanks -

06-04-2010, 10:14 AM
regex was created by the devil himself

I'll have a look later and report back

I need to be in a Jazz Trance

06-07-2010, 04:59 AM
http://gskinner.com/RegExr/ (http://www.php-developer.org/testpregmatch.php)

have a look here

06-07-2010, 09:55 PM
OK dj, edbr and other observers, I think I've cracked it. This:


seems to work for any variation of ten alphanumerics. For example:
Q1asdfghjk or Qasdfghjk1 or asdfghjk1Q or asdfQ1ghjk etc etc.
The thing that initially sent me on the wrong trail was a commentary referring to the initial .* I'd seen this but thought it was a look ahead linked to something like {10,} so I left it out because I only wanted ten characters. I think the .* at the end must be a look back but I'm not sure.
Linking these [A-Za-z] into one bracket was just fluke - I'm not clear why this works and the other one doesn't.
Anyway, the next one is a passkey which must have four digits and four lowercase letters - should be a doddle !
All the best -