mostafatalebi Posted March 7, 2013 Share Posted March 7, 2013 Hello I have two requests buddies: 1- I have a regular expression that I have downloaded from the net(source). This would check for the most strong password. Here is the regexp: /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$/; But I need to add a number to above regexp so that only passwords with more than 14 characters be considered as best. So i think i need something like {14,}, but I don't know where to put it. 2- Please check if this regexp is really complete for using as best password. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/275362-please-help-me-with-this-regular-expression/ Share on other sites More sharing options...
Christian F. Posted March 7, 2013 Share Posted March 7, 2013 (edited) Two quick answers, plus a bonus one: The star in regular expressions means "zero, or more", and the period means "any character, except newlines". Ignore the part in parentheses, as they're zero-width lookaheads, and what you need to change should become clear. Also, on a related note to the other thread, you should be removing that negative lookahead for whitespace in there. This RegExp requires alphanumerical characters, both upper and lower, but no special characters. I, personally, prefer to put a requirement on those too. Just to ensure that the entropy pool is as big as it can get. Makes it that much harder for people to come up with truly terrible passwords, even if it's not fool proof. For an example of what I use, I just posted a PHP function for password validation. The RegExp should be directly portable to JS. Edited March 7, 2013 by Christian F. Quote Link to comment https://forums.phpfreaks.com/topic/275362-please-help-me-with-this-regular-expression/#findComment-1417170 Share on other sites More sharing options...
mostafatalebi Posted March 7, 2013 Author Share Posted March 7, 2013 Sorry I found your function but would it be possible for you to post it as a clear string here? regexp I mean. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/275362-please-help-me-with-this-regular-expression/#findComment-1417175 Share on other sites More sharing options...
trq Posted March 7, 2013 Share Posted March 7, 2013 Just echo $passReg if you really want to see it. Quote Link to comment https://forums.phpfreaks.com/topic/275362-please-help-me-with-this-regular-expression/#findComment-1417177 Share on other sites More sharing options...
mostafatalebi Posted March 7, 2013 Author Share Posted March 7, 2013 (edited) Just echo $passReg if you really want to see it. I did buddy. nothing happened Edited March 7, 2013 by mostafatalebi Quote Link to comment https://forums.phpfreaks.com/topic/275362-please-help-me-with-this-regular-expression/#findComment-1417180 Share on other sites More sharing options...
trq Posted March 7, 2013 Share Posted March 7, 2013 Then your doing it wrong. Quote Link to comment https://forums.phpfreaks.com/topic/275362-please-help-me-with-this-regular-expression/#findComment-1417188 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.