When searching for entries in the list view with the command "search entry", only the matching entries are shown in the default configuration. This allows to easier spot the wanted entry especially for large directories. The matching characters are highlighted in the file name until the search is finished by moving the cursor or pressing Escape.
In the default configuration, the key "Ctrl-s" calls the "search entry" command and thus activates the search mode. Calling the command again (or pressing "Ctrl-s" again), will enter the search string previously used.
There are two ways of entering such filters. The first method is matching just the file name by entering a pattern. The second method, supported since Worker 3.6, supports more complex expressions.
The search string can contain wildcards like "*.c". If no entry matches, the so-called flexible matching is applied. With this mode, all entries matches that contain the characters in the given order no matter if any other character is between two search characters.
Since Worker 3.6, it is also possible to enter a more complex expression to allow more flexible filters. The idea is that multiple variables are defined and can be checked against specific values in a boolean expression. For example, if you want to show only those files which contains one of two different patterns and is of a minimum size, you can enter something like this: "((name == *foo* || name == *bar* ) && size > 10m)".
To use this matching method, the entered string must start with a "(". Then the whole string is parsed as a boolean expression and all entries will be shown, for which the expression evaluates to true.
The list view bar shows the valid part of the entered string to help identifying correct expressions.
A valid expression must contain of at least one of the following comparisons:
|Variable||Types of comparison||Description|
|name == pattern||==, !=, <, <=, >=, >, ~||
|type == pattern||==, !=, <, <=, >=, >, ~||The comparison is similar to the "name" variable, but in this case the file type is used for comparison instead.|
|size == value[modifier]||==, !=, <, <=, >=, >, ~||
|state == selected||==, !=||
|timemod == time description||==, !=, <, <=, >=, >||
|timeaccess == time description||==, !=, <, <=, >=, >||
Any of the basic expressions can be combined so that all or any of the expressions must be true.
- "&&" may be used to combine two (or multiple) basic expressions so that they all must be true so that the complete expression is true (AND expression).
- "||" may be used to combine two (or multiple) basic expressions so that any of those must be true so that the complete expression is true (OR expression).
- parentheses may be used to combine multiple AND and OR expressions.
- (name == *bar* && name == *.gz)
- (name == *bar* || name == "x - *foo*")
- (name == *.mp4 && size >= 10mb)
- (name == *.mp4 && size >= 10mb && size <= 100mb)
- ((type ~ video || type ~ audio) && size >= 1mb)
For convenience and faster typing, it is also possible to use shorter forms of the expressions. Most spaces are also not necessary to enter. The following abbreviations are possible:
|n||short form for "name"|
|s||short form for "size"|
|t||short form for "type"|
|st||short form for "state"|
|tm||short form for "timemod"|
|ta||short form for "timeaccess"|
|sel||short form for "selected"|
|=||short form for "=="|
||||short form for "||"|
|&&||short form for "&&"|
is the short form for
(name == *.mp4 && size >= 10mb && size <= 100mb)
To make entering filter expressions easier, Worker will show some help in the statebar listing all possible continuations for the current filter string. The help will appear one second after the last text change and will remain visible for five seconds.
The help tries to give hints about what the internal parser expects to see next, although it is not very strict. The possible abbreviations listed above are not taken into account, and elements like the file name pattern is only shown as a suggestion when the pattern is missing completely. After the first character, the next possible element is shown even though the pattern can still be modified.Examples:
- When entering "(", the help will show that you may enter "name", "size", etc.
- When entering "(name==" ,the help will indicate that it expects a file name pattern.
- When entering "(name==f", the help will suggest "&&", "||", ")" but the pattern can still be continued.
Example: Now the filter string is "orker". Since no file starts with "orker, the flexible matching is used. The highlighted characters are shown again making it easier to spot the relevant matches. The filter string in the list view bar starts with a tilde to indicate that the flexible matching is active.
The flexible matching actually saves you from entering wild cards. Usually this is much faster to enter since you only need to enter the characters and don't have to think about some unimportant characters in between.
Example: The expression ((n=*.cc|n=*.hh)&s<=10k) is applied to only show files ending with .cc or .hh and the size is less than 10k. The filter string in the list view bar starts with "e:" to indicate that the following expression is used to filter the list view.