Karaethon Posted January 11, 2019 Share Posted January 11, 2019 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? Quote Link to comment https://forums.phpfreaks.com/topic/308145-regex-huh/ Share on other sites More sharing options...
requinix Posted January 11, 2019 Share Posted January 11, 2019 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? Quote Link to comment https://forums.phpfreaks.com/topic/308145-regex-huh/#findComment-1563441 Share on other sites More sharing options...
Karaethon Posted January 11, 2019 Author Share Posted January 11, 2019 (edited) 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 January 11, 2019 by Karaethon Quote Link to comment https://forums.phpfreaks.com/topic/308145-regex-huh/#findComment-1563451 Share on other sites More sharing options...
maxxd Posted January 12, 2019 Share Posted January 12, 2019 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. Quote Link to comment https://forums.phpfreaks.com/topic/308145-regex-huh/#findComment-1563471 Share on other sites More sharing options...
Karaethon Posted January 14, 2019 Author Share Posted January 14, 2019 (edited) 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 January 14, 2019 by Karaethon Completing the thought Quote Link to comment https://forums.phpfreaks.com/topic/308145-regex-huh/#findComment-1563531 Share on other sites More sharing options...
requinix Posted January 14, 2019 Share Posted January 14, 2019 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: https://nulab-inc.com/blog/nulab/password-strength/ 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). Quote Link to comment https://forums.phpfreaks.com/topic/308145-regex-huh/#findComment-1563550 Share on other sites More sharing options...
Karaethon Posted January 15, 2019 Author Share Posted January 15, 2019 Hmm, you're right. I tried it with my password and it did not match it, but as I understood it I thought it would. Ugh. Quote Link to comment https://forums.phpfreaks.com/topic/308145-regex-huh/#findComment-1563592 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.