Re: [Zope] FindOneOf?

2000-07-27 Thread Patrick Lewis
In a Python external method: import re def FindOneOf(to_find, search_str): match_obj = re.search("[%s]" % to_find, search_str) if match_obj: return match_obj.start() + 1 else: return 0 So, calling FindOneOf("ghd", "abcdefghij") returns 4. This will work as is unless

Re: [Zope] FindOneOf?

2000-07-27 Thread Chris Withers
"Mabe, Brad" wrote: > Will return a "4" because "d" is the fourth letter in the string > "abcdefghij". If no match is made, a 0 is returned. This is especially > useful when building a change password form, because I can easily check to > see that the new password contains at least one special c

[Zope] FindOneOf?

2000-07-27 Thread Mabe, Brad
ColdFusion (I know, a dirty word ;-) ) has a nifty string function called "FindOneOf" which returns the index of the occurrence of any character in a string. Example: FindOneOf("ghd", "abcdefghij", 1) Will return a "4" because "d" is the fourth letter in the string "abcdefghij". If no match i