- Index
- Menus
- Convert
- Actions
- Export
- Scripting
- Filter
- Columns
- Options
- Donate

# Filtering files and tags (Searching)

## Introduction

The Filter allows for searching files that meet a certain criteria (e.g., the filename contains specific characters or a tag field has a specific content). By default it is located at the bottom of the file list and can be enabled and disabled via 'View > Filter' or the F3 keyboard shortcut.

To filter the file list simply start typing in the filter field. As a result, all files that contain the specified filter string in their tag or file name are listed in the file view.

Sometimes it is necessary to use more complex criteria to search for files (e.g., all files of a specific genre but not of that artist). To achieve this, Mp3tag has the notion of filter expressions. Filter expressions are simple expressions that consist of tag field names, filter keywords and text.

## Notes

- If <field> or <string> contains spaces, it should be enclosed in double quotation marks, e.g., album IS "Moon Safari".
- If <field> in HAS/IS/GREATER/LESS/EQUAL/MATCHES contains $ or % it should be enclosed in double quotation marks and will be treated as a format string instead of a tag field name. This will decrease search speed on large libraries since the format strings need to be evaluated before filtering.
- It is not possible to filter by strings containing double quotations marks. This is a limitation of the feature.
- All operations are non-case sensitive. All filter keywords must be uppercase.

## Examples of filter expressions

artist IS Air AND album IS Moon Safari

Artist is "Air" and album is "Moon Safari"

genre IS Rock AND artist HAS Stone

Genre is "Rock" and artist contains "Stone"

NOT genre IS Rock

Genre is not "Rock"

%_covers% IS ""

All files that do not contain cover art.

## Description of the Filter Expression Language

<string>

Returns only files that contain every word in the string as a word or substring thereof. A word is a contiguous sequence of characters excluding the space character.

<field> HAS <string>

Returns only files that have all words from <string> in their tag field named <field>. You can use * to address all fields.

<field> IS <string>

Returns only files that where the content of at least one tag field named <field> is equal to <string>.

<expr1> AND <expr2>
<expr1> OR <expr2>

Combines the filter expressions <expr1> and <expr2> by logical and or or. Parentheses can be used to group combined expressions.

NOT <expr>

Inverts the result of <expr>.

<field> GREATER <number>
<field> LESS <number>
<field> EQUAL <number>

Returns all files where the content of tag field named <field> is greater, equal, or less that the integer value specified by <number>.

<field> ABSENT
<field> MISSING

Returns all files where tag field named <field> is absent.

<field> PRESENT

Returns all files where tag field named <field> is present.

<field> MATCHES <regexp>

Returns only files where the content of the tag field named <field> matches against the regular expression <regexp>. You can use * to address all fields.

## More examples ...

%_tag% IS ""

All files without tags

%_tag% HAS "flac id3v2"

Files with flac and ID3v2 tags

%_extension% IS mp4

Files with mp4 extension

%_bitrate% GREATER 180

All files with a bitrate over 180

%_cover_size% GREATER 20480

All files with embedded covers over 20 kbyte

"$len(%bpm%)" GREATER 4

Check if a field is longer than 4 characters

"$if($eql(%artist%,%albumartist%),yes,no)" IS yes

Check if two fields have the same value

"$ifgreater($strstr(%_filename%,%title%),0,yes,no)" IS yes

Check if the title is part of the filename

track MATCHES \d\/\d

Track numbers that have number/number syntax

%_filename% MATCHES ^\d\d

Filenames that start with two digits

If you also use foobar2000 the filter language should look very familiar (because this is where we got the idea from).

Back to main page

Made with love in Dresden. Copyright © 1999-2021 Florian Heidenreich. All rights reserved.