# Filters

**URL:** https://community.mp3tag.de/t/filters/9832
**Category:** Support
**Created:** [February 5, 2010, 11:19pm UTC](https://community.mp3tag.de/t/filters/9832 "2010-02-05T23:19:19Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![jason825](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/f08c70/32.png) [@jason825](https://community.mp3tag.de/u/jason825)
#### Post date: [February 5, 2010, 11:19pm UTC](https://community.mp3tag.de/t/filters/9832/1 "2010-02-05T23:19:19Z")

</div>

I have MP3 files with various filename formats such as:

Artist - Year - Album - Track - Song.mp3  
Artist - Year - Album - Song.mp3  
Artist - Song.mp3

I am trying to use the file name to write the tags, but can't figure out the filter. Any ideas? Thanks.

---

<div class="post-metadata">

### Author: ![NoToneS](https://community.mp3tag.de/user_avatar/community.mp3tag.de/notones/32/307_2.png) [@NoToneS](https://community.mp3tag.de/u/NoToneS)
#### Post date: [February 6, 2010, 12:03am UTC](https://community.mp3tag.de/t/filters/9832/2 "2010-02-06T00:03:00Z")

</div>

%artist% - %year% - %album% - %track% - %title%  
%artist% - %year% - %album% - %title%  
%artist% - %title%

---

<div class="post-metadata">

### Author: ![jason825](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/f08c70/32.png) [@jason825](https://community.mp3tag.de/u/jason825)
#### Post date: [February 6, 2010, 12:33am UTC](https://community.mp3tag.de/t/filters/9832/3 "2010-02-06T00:33:18Z")

</div>

I thought that would work too, but as soon as I put in the first %, all the files disappear.

---

<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: [February 6, 2010, 2:10pm UTC](https://community.mp3tag.de/t/filters/9832/4 "2010-02-06T14:10:32Z")

</div>

i take it that you want to filter for a pattern, right?  
so it must be something like  
%\_filename% MATCHES "^.\* - .\*.mp3"

which should suit any filename that consists of two groups of strings separated by a hyphen and ends with mp3. I think ths would be the case for %artist% - %title%.mp3.  
for a construction like  
Artist - Year - Album - Song.mp3  
you could use something like  
%\_filename% MATCHES "^.\* - \d - .\* - .\*"  
the \d standing for the numbers in Year.

---

<div class="post-metadata">

### Author: ![jason825](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/f08c70/32.png) [@jason825](https://community.mp3tag.de/u/jason825)
#### Post date: [February 7, 2010, 5:21am UTC](https://community.mp3tag.de/t/filters/9832/5 "2010-02-07T05:21:16Z")

</div>

It still filters out everything.

---

<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: [February 7, 2010, 8:16am UTC](https://community.mp3tag.de/t/filters/9832/6 "2010-02-07T08:16:32Z")

</div>

Have you written the MATCHES in capitals? Otherwise it is not recognized as a keyword.  
Then: I think the ".mp3" is not part of the %\_filename% as it is the extension.

so a filter would look like this:

%\_filename% MATCHES "^.\* - .\*$"  
for any filename that consists of two segments (like artist and title)  
the ^says "Beginning of the tag" and the "$" says "end of the tag" so it limits the filter expression to just two sections separated by a hyphen.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 7, 2010, 8:35am UTC](https://community.mp3tag.de/t/filters/9832/7 "2010-02-07T08:35:50Z")

</div>

> [@jason825](#):
>
> It still filters out everything.

jason825, we speak of using the filter section in Mp3tag, right?

Following example demonstrates how to filter a bunch of tracks so that all tracks with filenames of the wanted format will be in view, and all other filenames are out of view.

For example, given is this complete FileBaseName:  
"32 - BACH - SICUT LOCUTUS EST.mp3"  
You can see three different parts divided by delimiter strings of " - " ([space][hyphen][space]).

And given is this complete FileBaseName:  
"Angela Hewitt - 01 - The Well-Tempered Clavier (48), collection of preludes & fugues in 2 Books, BWV 846-893 (BC L80-127); Book 1. No. 1 in C major. Prelude.mp3"

The second filename follows the same format structure as the first filename.  
There are three parts divided by a delimiter string " - ".

Well, the sequence and significance of the parts are different in both cases, but this is not relevant for this observation ("track - artist - title" vs. "artist - track - title").

To simplify the given problem, the basic format can be written as:  
"A - B - C".  
There are three parts divided by delimiter string " - ".

The Mp3tag filtering section provides the usage of so called _regular expressions_.  
(_How to read and write a regular expression find other sources for yourself._)  
For the above example someone can write a regular expression notated as following:  
(.+) - (.+) - (.+)

To complete this into a well formatted filter expression including a bit of fuzzyness regarding the delimiter strings ("\s" means any character that looks like a space character) will give:  
**%\_FILENAME% MATCHES "^(.+)\s-\s(.+)\s-\s(.+)$"**

While at the filter section, the round brackets are not needed in general, so the following expression behaves the same:  
%\_FILENAME% MATCHES "^.+\s-\s.+\s-\s.+$"  
This filter expression displays all filenames with a structure of "A - B - C"

To put such filenames into view that matches the inverse case:  
**NOT %\_FILENAME% MATCHES "^(.+)\s+-\s+(.+)\s+-\s+(.+)$"**

Now you should be able to adapt it to your needs. Good luck!

DD.20100207.1043.CET

---

<div class="post-metadata">

### Author: ![jason825](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/f08c70/32.png) [@jason825](https://community.mp3tag.de/u/jason825)
#### Post date: [February 8, 2010, 3:32am UTC](https://community.mp3tag.de/t/filters/9832/8 "2010-02-08T03:32:55Z")

</div>

Thanks for the help, DetlevD. I was able to use your method and get the job done!

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:22pm UTC](https://community.mp3tag.de/t/filters/9832/9 "2026-02-09T12:22:09Z")

</div>


