User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

corfilter [2007/03/02 02:32] (current)
Line 1: Line 1:
 +# $EPIC: corfilter.txt,​v 1.3 2007/03/02 02:32:04 jnelson Exp $
 +$[[corfilter]](<​string>​ <​var1>​ <​var2>​)
 +The <​string>​ argument is a [[what is a word|dword]],​ which is different
 +than most functions.
 +This function is the reverse operation of [[cofilter]],​ and the 
 +complementary operation of [[corpattern]].
 +This function is closely related to [[rfilter]],​ which returns all of the
 +wildcard patterns in a word list that do not match a literal string.
 +All of the cor* functions take a literal string, and two variable names.
 +The first variable should contain a word list of wildcard patterns, and 
 +the second variable should contain a word list.  The string is matched
 +against each of the patterns in the first list, and depending on the result,
 +the corresponding word in the second list is included or excluded in the
 +resturn value.
 +The [[corfilter]] function returns all those words in $<​var2>​ that 
 +correspond in position to those patterns in $<​var1>​ that do not
 +match the <​string>​.
 +Parsing ends whenever the shorter of the two word lists runs out of words.
 +Therefore, the two word lists should have the same number of words.
 +The literal <​string>​ may be optionally surrounded by double quotes,
 +if the word contains spaces. ​ The double quotes are not considered part
 +of the string for the purposes of matching.
 +The words from $<​var2>​ that correspond to all of the words in $<​var1> ​
 +that are not matched by <​pattern>​.
 +@ friends = [ooga!bob@* *!tom@*.com]
 +@ levels ​ = [20 10]
 +$corfilter(ooga! friends levels) ​      ​returns "​10"​
 +$corfilter(hype! friends levels) ​           returns "​20"​
corfilter.txt ยท Last modified: 2007/03/02 02:32 (external edit)