Hi,
-- I have to enforce a password strength check with the following rules.
To archive the above what I have tried is ( ( aPassword prefixMatchesRegex: '[\w!,@#$%^&*?_~_/-]*[a-z]+[\w!,@#$%^&*?_~_/-]*' ) and: [ ( aPassword prefixMatchesRegex: '[\w!,@#$%^&*?_~_/-]*[A-Z]+[\w!,@#$%^&*?_~_/-]*' ) and: [ ( aPassword prefixMatchesRegex: '[\w!,@#$%^&*?_~_/-]*[0-9]+[\w!,@#$%^&*?_~_/-]*' ) and: [ ( aPassword prefixMatchesRegex: '[\w!,@#$%^&*?_~_/-]*[!,@#$%^&*?_~_/-]+[\w!,@#$%^&*?_~_/-]*' ) ]] ]) I know its a clumsy code.. But I have tried to add using a single regex statement with ? and all.. but as soon as the regEx seems a $? it throws an error. Any suggestions let me know. best Regards, Sreenath You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Administrator
|
On Tuesday, October 13, 2015 at 5:32:51 AM UTC-7, Sreenath G K wrote:
My eyes! :-) I suggest you write Smalltalk. Those rules are so trivial. Count by "character class". Ensure each class is represented. Ensure the string is long enough. Why would you want to add unreadable expressions into a Smalltalk program? -- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Richard,
-- I am glad you wrote that, because that is what I had in mind as well. A hand full of detect: or anySatisfy: would be much easier to read and (much more important) maintain and I guess also be faster (although probably in rather irrelevant dimensions). Am Donnerstag, 15. Oktober 2015 21:38:42 UTC+2 schrieb Richard Sargent: On Tuesday, October 13, 2015 at 5:32:51 AM UTC-7, Sreenath G K wrote: myString anySatisfy: [:c| c isLetter and: [c isLowercase]]. "Not sure, but maybe you can even drop the isLetter test"
myString anySatisfy: [:c| c isLetter and: [c isUppercase]]. "Not sure, but maybe you can even drop the isLetter test"
myString anySatisfy: [:c| c isDigit].
myString anySatisfy: [:c| listOfSpecialChars includes: c ].
myString size >= 8 This is all that's needed... You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
regular expressions have their good usages and there are people out there, who have no problems reading those statements (I am NOT one of those) - and they are configurable, which is not possible with static Smalltalk expressions.
-- I rather would investiagate, why there are problems with specific expressions ... You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Marten,
-- there are many good uses for Regexes, like sharing them between your server app and reusing them for html5 input fields. OTOH, there are so many subtle differences in what certain parsers interpret how, that it can get hard to really reuse them if they get really smart (not that I could write or even read these ;-) ). BUT if the only purpose here is to check these simple rules in a Smalltalk application, I'd rather forget about Regex. Especially since most Smalltalk implementations miss important functionalities (most are based on Vasilly's implementation which is about a decade old or so). Joachim Am Freitag, 16. Oktober 2015 12:33:53 UTC+2 schrieb Marten Feldtmann:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Sreenath
Hi Sreenath,
On Tuesday, October 13, 2015 at 8:32:51 AM UTC-4, Sreenath G K wrote:
Hi All, I'm with my Smalltalk friends on thinking this should be done in Smalltalk if it can be run in the server. I'm also of no help with regex. The question got me thinking about how to do this in Smalltalk and came up with this:
I also tried a simple version that would come up with a rank of the password. It is not a very good ranking, I just wanted to get the structure.
Lou You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Sreenath
Hi All,
-- I appreciate all your above comments..Thanks. What i was asking is that in java for example we can do that with a single line of regEx expression.
The problem for me is that if I put a "?" immediatitely the regEx gives me an error. Once again I appreciate and will consider your views. Best Regards, Sree On Tuesday, October 13, 2015 at 6:02:51 PM UTC+5:30, Sreenath G K wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Administrator
|
In reply to this post by Sreenath
On Tuesday, October 13, 2015 at 5:32:51 AM UTC-7, Sreenath G K wrote:
I think the issue is one of standards. In scanning https://en.wikipedia.org/wiki/Regular_expression, I see there is a section called Standards. It begins "The IEEE POSIX standard has three sets of compliance: BRE,[24] ERE, and SRE for Basic, Extended, and Simple Regular Expressions." I am guessing that the VA implementation is BRE rather than ERE, if it conforms to the standard at all.
Reiterating my original point, stick to Smalltalk, and keep it readable. Regular expressions might as well be APL (my second favourite language) where readability is concerned. -- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Sreenath
HI All.
-- I have changed the code from regex to Smalltalk..!!! Thanks everyone Bets Regards, Sree On Tuesday, October 13, 2015 at 6:02:51 PM UTC+5:30, Sreenath G K wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |