Jump to content

Recommended Posts

Ok, so I've been reading about regex and I  think I get it.

I have one question that I think will prove I do or shoot me in the gut...

^([A-Z]+ [a-z]+ [\?\,\.!@#\$]+)${8,50} means the entire string must include at least 1 capital letter, at least 1 lowercase letter, at least one symbol, and be between 8 and 50 characters (inclusive). Is this correct? And if i wanted min 8 max infinity I'd just use 8 dots ( ........ ) in place of the {8,50}, correct?

Link to comment
https://forums.phpfreaks.com/topic/308145-regex-huh/
Share on other sites

Nope. It means the string must contain uppercase letters, followed by a space, followed by lowercase letters, another space, assorted symbols, followed by the end of the string, and if you weren't sure it was the end of the string it tests 8-50 times that it really is the end of the string.

So... not even close to correct. Going to try again or want a hint?

Link to comment
https://forums.phpfreaks.com/topic/308145-regex-huh/#findComment-1563441
Share on other sites

Ok. Hmmm. Well at least the space issue isnt there, i added those for readability when i put it here, but its good to know not to do in production. The rest ... arghhhhh

 ill re-read and try again.....  ?

Edited by Karaethon
Link to comment
https://forums.phpfreaks.com/topic/308145-regex-huh/#findComment-1563451
Share on other sites

On 1/11/2019 at 10:38 PM, maxxd said:

As someone who's really bad with RegEx, I've found this site very helpful while trying to figure out a pattern. Thanks to that, I've actually gotten my last couple regex's to work without having to bother people by posting it here.

Ok... umm now I'm a little confused.... that site (rocks btw) says that my pattern will do exactly what I thought it would do.... (when i flip the $ and {8,50})

Edit

Of course now I'm on past that, I'm trying to figure out how to use this password stuff on this site... 

https://nulab-inc.com/blog/nulab/password-strength/

Edited by Karaethon
Completing the thought
Link to comment
https://forums.phpfreaks.com/topic/308145-regex-huh/#findComment-1563531
Share on other sites

17 hours ago, Karaethon said:

Ok... umm now I'm a little confused.... that site (rocks btw) says that my pattern will do exactly what I thought it would do.... (when i flip the $ and {8,50})

You might think it says that, but nowhere in the explanation will it say that it'll match some thing or some other thing. It'll try them all in sequence which is not what you want.

17 hours ago, Karaethon said:

If you're talking about the basic principle then it's the same way you normally analyze passwords - contains letters, contains symbols, etc. - except you tell the user about how good the password is instead of enforcing it.

So you do it all in Javascript. A regex to find letters, another to find symbols, one for each test, then you examine the results (eg, how many tests passed) and display a sort of rank to the user (eg, more passed tests the better).

Link to comment
https://forums.phpfreaks.com/topic/308145-regex-huh/#findComment-1563550
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.