# Filter expressions

**URL:** https://community.mp3tag.de/t/filter-expressions/10080
**Category:** Howto
**Created:** [March 11, 2010, 5:37pm UTC](https://community.mp3tag.de/t/filter-expressions/10080 "2010-03-11T17:37:11Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [March 11, 2010, 5:37pm UTC](https://community.mp3tag.de/t/filter-expressions/10080/1 "2010-03-11T17:37:11Z")

</div>

## 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](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](https://community.mp3tag.de/t/10080/4).

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [March 11, 2010, 5:38pm UTC](https://community.mp3tag.de/t/filter-expressions/10080/2 "2010-03-11T17:38:10Z")

</div>

### 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`

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [March 11, 2010, 5:38pm UTC](https://community.mp3tag.de/t/filter-expressions/10080/3 "2010-03-11T17:38:57Z")

</div>

### 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`

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [March 16, 2010, 7:10pm UTC](https://community.mp3tag.de/t/filter-expressions/10080/4 "2010-03-16T19:10:57Z")

</div>

### 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}]`

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [December 6, 2010, 9:24am UTC](https://community.mp3tag.de/t/filter-expressions/10080/5 "2010-12-06T09:24:12Z")

</div>

**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`

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [May 10, 2023, 5:19am UTC](https://community.mp3tag.de/t/filter-expressions/10080/6 "2023-05-10T05:19:57Z")

</div>

A post was split to a new topic: [Filter not working as expected](https://community.mp3tag.de/t/filter-not-working-as-expected/60928)

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [June 20, 2024, 1:05pm UTC](https://community.mp3tag.de/t/filter-expressions/10080/7 "2024-06-20T13:05:34Z")

</div>

A post was split to a new topic: [Filter for capitals does not work](https://community.mp3tag.de/t/filter-for-capitals-does-not-work/65093)

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [June 20, 2024, 2:11pm UTC](https://community.mp3tag.de/t/filter-expressions/10080/8 "2024-06-20T14:11:03Z")

</div>


