What’s wrong with simply: function stringsAreEqual p1, p2 return (p1 & "z") = (p2 & "z") end stringsAreEqual
As Terry Judd and Mark Wieder suggested yesterday? .Jerry > On Sep 3, 2015, at 8:56 PM, Thierry Douez <th.do...@gmail.com> wrote: > > Hi, > >> Ahhhhhhhhh, > > Well, nothing very dangerous here :) > >>> if matchText( userTyping, myVeryStrongPassword) then ... > > This was a direct answer to this thread: > > "compare numeric strings with leading zeros" ! > > >> I would caution against using matchText for this purpose, >> because the second >> parameter is treated by the function as a regular expression. > > > Yes, > myVeryStrongPassword is a regular expression in a pure litteral form. > > >> >> For instance, matchText would return true if you were to reverse your >> example values: > > Yes, the order of the parameters have a meaning, but this is true > for so much functions in LC. So, I don't get it :( > > >> In addition, >> since passwords are typically allowed to contain any character > > Was not asked by the OP. > > Ok then, so new rules here:) > >> local userTyping = "5" >> local myVeryStrongPassword = "^5$" > > If your password can contains any chars, > Just tell it to matchText(): > > my password can be any character and I don't want you to > interpret them in any ways! > > For that, > enclose your myVeryStrongPassword by "\Q" & "\E" and it > will be interpreted as litteral characters. > > >> Since Ralph is looking to use this for password validation, >> I would throw in a case sensitivity check as well: > > For this one, there is nothing special to do. > If it will be case insensitive you could add a prefix to the regex: (?i) > > so the final matchText() solution is: > > put "\Q^5$\E" into myVeryStrongPassword > if matchText( userTyping, myVeryStrongPassword ) then ... > > > Ok, now I'm waiting for what I've missed... > > Have all a nice day or night. > > Thierry > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode