Jump to content

Regex huh?


Karaethon

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
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
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/

Link to comment
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
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.