filter | |||||||||||||||||||
Type | command | ||||||||||||||||||
Dictionary | LCS | ||||||||||||||||||
Library | LiveCode Script | ||||||||||||||||||
Syntax |
| ||||||||||||||||||
Summary | Filters each line, item, key or element in a source container or expression, removing the lines, items, keys or elements that do or don't match a pattern. | ||||||||||||||||||
Introduced | 1.0 | ||||||||||||||||||
Changes | The filter...without form was added in version 2.1.1. In previous versions, the filter command could be used only to retrieve lines that matched a wildcard expression. The filter items... form was added in version 6.1. In previous versions, the filter command could be used only to retrieve lines. The ability to filter using a regular expression was added in version 6.1. In previous versions, the filter command only supported wildcard expressions. The ability to filter an expression was added in version 6.1. In previous versions, the filter command could be used only for a container. The filter...[not] matching form was added in version 6.1 to clarify the pattern handling. The filter...into form was added in version 6.1. In previous versions, the filter command always replaced the contents of the original container. Filtering of array keys and elements was added in version 8.1. The where form of the filter command was added in version 9.5. | ||||||||||||||||||
OS | mac, windows, linux, ios, android | ||||||||||||||||||
Platforms | desktop, server, mobile | ||||||||||||||||||
Parameters |
| ||||||||||||||||||
Example |
| ||||||||||||||||||
Values |
| ||||||||||||||||||
Related | Keyword: it, each Property: caseSensitive Command: replace, sort Function: matchChunk, matchText, replaceText Glossary: container, expression, regular expression | ||||||||||||||||||
Description | Use the filter command to pick specific lines, items, keys or elements in a container or expression. The The If you don't specify lines, items, keys or elements then lines are filtered by default. Note: If neither If the If the 'wildcard pattern' form is to be used, the wildcardPattern should consists of a string of characters to match, which may be combined with any number of the following special characters:
You can match instances of special chars as follows:
For example, the wildcardPattern The three bracketed forms can be combined to create more complex character classes, for example the pattern [!abcA-C] matches any character which is not a, b or c (upper or lower case) If no targetContainer is specified, and you filter a container, the container contents will be replaced by the filtered result. When using the where form of the filter command the each keyword may be used in the whereExpression for the value to be filtered. | ||||||||||||||||||
Tags | text processing |