match, rmatch

Synopsis:
$match(<pattern> <word list>)
$rmatch(<word list> <pattern>)

Technical:
The $match() function searches through a word list and returns the index to the word that best matches the given pattern. Its opposite is the $rmatch() function, which tries to match a pattern with a list of words. The index counts from 1.

Practical:
These functions are generally most useful for automated processes. For instance, one could try to match a person's address with a predefined list of address patterns to see if the client should automatically accept channel invitations or dcc chat requests. Because they return the index to the best match, and not the matching item, they are mostly useful for boolean-type comparisons.

Returns:
0 no matches found
>0 index to best match in list

Examples:
$match(*oo* blah foo booya) returns 2
$match(*oo* blah fubar erf) returns 0
$rmatch([email protected] *.com *jbriggs@*) returns 2
$rmatch([email protected] *.net *jimbob*) returns 0

See Also:
filter, rfilter
pattern, rpattern


 

Back

Hosted by www.Geocities.ws

1