Site Tools


filter

# $EPIC: filter.txt,v 1.2 2006/08/01 02:45:08 sthalik Exp $

Synopsis:

$filter(<pattern> <word list>)

Technical:

  • If the <pattern> argument is omitted the empty string is returned.
  • This function returns a space separated word list of all of the words in <word list> that are NOT matched by <pattern>.
  • This is the complement to $pattern(), and the inverse of $rfilter().
  • Double quoted words are honored, but the double quotes will be lost in the return value.

Practical:

This function lets you “filter” <word list> through a pattern, removing all of the words that match the pattern and keeping all of the words that do not match the pattern. By appending * to a string and using this function, you can quickly find all words in a word list that do not start with a particular substring.

Returns:

The list of words from <word list> after all words matched by <pattern> have been removed.

History:

This function first appeared in “plus-2” (post-ircII, pre-EPIC)

Examples:

$filter(*oo* foobar blah booya)   returns "blah"
$filter(*a* hello there bob)      returns "hello there bob"
$filter(irc* $myservers())        returns all servers you are 
                                  connected to that don't start
                                  with the string "irc".
filter.txt · Last modified: 2006/08/01 03:13 by 127.0.0.1