# $EPIC: rmatch.txt,v 1.5 2006/08/29 18:22:56 sthalik Exp $ ======Synopsis:====== $__rmatch__( ) ======Technical:====== * If the argument is omitted the empty string is returned. * contains zero or more space separated "extended words" * Each pattern in is taken as a wildcard pattern, which is matched against , which is taken as literal text. * If none of the patterns in match , then the return value of $__rmatch__() is 0 (zero). * Otherwise, the return value is the word from for the pattern which "best" matches . A pattern's "value" is the number of literal (non-wildcard) characters it contains. The pattern that matches and has the most "value" is the "best" match. * The return value begins counting words FROM ONE, like [[match]]. You will have to subtract one from the return value before using it in some other functions, like $[[word]](). * If none of the patterns in contain wildcards, then you should use the $[[findw]]() function instead. * If contains only one word, you should use the =~ operator instead. ======Practical:====== This function can be used to match a bunch of patterns against a single literal word. This is often used to match the $[[userhost function|userhost]]() value against a list of userhosts in an access list. Since ircII does not include the =~ operator, this was the standard way to do pattern matching on one word against one string in scripts. Also, since ircII does not include the $[[findw]]() function, this was the standard way to determine if a literal word was present in a literal word list. The $__rmatch__() function is still generally useful for matching one word against a list of patterns. ======Returns:====== 0 no matches found >0 index to "best" pattern in list -- counting from one! ======Examples:====== $rmatch(one o* t* f*) returns 1 $rmatch(one z* t* f*) returns 0 $rmatch(one o* on* t* f*) returns 2 ======History:====== This function first appeared in ircII.