Filter expressions

This topic collects useful Filter expressions

If you have a useful filter expression, please post it here and give a short description of what it does.

These filter expressions can be used with the Mp3tag filter [F3].

Please look at https://docs.mp3tag.de/filter for the documentation.

Notes

  • All filter keywords must be uppercase.
  • All operations are case insensitive, for a workaround see this post.
2 Likes

Simple filter

All files without tags:
%_tag% IS ""

Files with flac and ID3v2 tags:
%_tag% HAS "flac id3v2"

Files with mp4 extension
%_extension% IS mp4

All files with a bitrate over 180
%_bitrate% GREATER 180

All files with embedded covers over 20 kbyte
%_cover_size% GREATER 20480

1 Like

Filter with Scripting

Check if a field is longer than 4 characters:
"$len(%bpm%)" GREATER 4

Files with multipe artist tags:
"$meta_sep(Artist,\\)" HAS \\

Check if two fields have the same value:
"$if($eql(%artist%,%albumartist%),yes,no)" IS yes

Check if the title is part of the filename:
"$ifgreater($strstr(%_filename%,%title%),0,yes,no)" IS yes

1 Like

Filter with Regular Expression (Regex)

Track numbers that have number/number syntax
track MATCHES \d\/\d

Filenames that start with two digits:
%_filename% MATCHES ^\d\d

Filenames that start with two digits not followed by another digit:
%_filename% MATCHES ^\d\d\D

Case sensitive filter:
title MATCHES (?-i)regex

Files with characters that are not in ISO-8859-1 in tag or filename
* MATCHES [\x{0100}-\x{FFFF}]

1 Like

Filenames with 2 hyphens
"$len($regexp(%_filename%,'[^-]',))" IS 2

Filenames with at least 2 hyphens
"$len($regexp(%_filename%,'[^-]',))" GREATER 1

Track number is a single digit
track MATCHES ^\d$

Title tag starts with four capital letters
"$if($eql($regexp(%title%,^\u\u\u\u,),%title%),yes,no)" IS no

1 Like

A post was split to a new topic: Filter not working as expected