Filters

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.

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

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

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.

It still filters out everything.

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.

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

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