The FILTER function compares each element in the specified set to the specified pattern and returns a new set containing only the elements that match the pattern. If the optional NOT operator is included, the FILTER function returns a new set containing only the elements that do not match the pattern.
The FILTER function has the following format:
FILTER(set, [NOT ]pattern)
The FILTER function accepts the following parameters:
set (string)
Specifies a string of elements that are separated by the caret character: 'element1^element2'. Each element is a string.
pattern (string)
Specifies a pattern of characters. A pattern can include single characters, ranges of characters, or both. A range of characters is expressed as two characters separated by a hyphen. The following are examples of valid character ranges: 0-9, a-z, and A-Z. The pattern parameter can also include characters that are reserved and have special meanings. The reserved characters are:
Character |
Meaning |
---|---|
? |
Matches any single character |
* |
Matches any sequence of characters, including one or none |
[set] |
Matches any single character in the specified set |
[!set] or [^set] |
Matches any single character not in the specified set |
\ |
Treats any reserved character as a regular character, such as \* |
NOT (operator)
(Optional) If the NOT operator is included, the function returns a new set containing only the elements that do not match the pattern.
The FILTER function returns a string of elements separated by the caret character: 'element1^element2'. Each element is a string.
Return_value=FILTER('Faith^Earl^Emilie^Fred', 'E*')
Return_value='Earl^Emilie'
Return_value=FILTER('Faith^Earl^Emilie^Fred', NOT 'E*')
Return_value='Faith^Fred'
Copyright © 2010 CA. All rights reserved. | Email CA about this topic |