# Extract part of filename

**URL:** <https://community.mp3tag.de/t/extract-part-of-filename/44058>\
**Category:** Support\
**Created:** [December 30, 2018, 5:14pm UTC](https://community.mp3tag.de/t/extract-part-of-filename/44058 "2018-12-30T17:14:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![willemvaneck](https://community.mp3tag.de/user_avatar/community.mp3tag.de/willemvaneck/32/5561_2.png) [@willemvaneck](https://community.mp3tag.de/u/willemvaneck)\
**Post date:** [December 30, 2018, 5:14pm UTC](https://community.mp3tag.de/t/extract-part-of-filename/44058/1 "2018-12-30T17:14:53Z")

</div>

Hi, hope you all have a good year end period!

I previously had a good response from ohrenkino on extracting from filename when my files were simply `%artist% - %title% ($eql(%title%,$regexp(%_filename%,'.*- (.*)',$1))` but meanwhile my filenames look like this:

`%albumartist% - %genre% - %album% - %track% - %artist% - %title%`

I did find a way to tag artist and title using the %dummy% function ... my request is to extract, individually, artist and title from the filename so i can compare with the actual tags.

Many thanks to whoever can help,

Willem VAN ECK

---

<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:** [December 30, 2018, 6:20pm UTC](https://community.mp3tag.de/t/extract-part-of-filename/44058/2 "2018-12-30T18:20:20Z")

</div>

It looks to me as though you have 4 pieces of data that you want to ignore - use %dummy% for that and 2 that you want to check.  
So if the orginal filename has the structure ...  
%albumartist% - %genre% - %album% - %track% - %artist% - %title%  
you can use  
%dummy% - %dummy% - %dummy% - %dummy% - %artist% - %title%

BUT: it could very well be that the filename is not like the contents of the tag fields as the tag fields could contain characters that are illegal for filenames. So MP3tag simply leaves them out.  
If you want to compare the filename and tag fields, then you can use a filter  
`"$if($eql(%_filename%,%albumartist% - %genre% - %album% - %track% - %artist% - %title%),1,0)" IS 0`

You can also import data from the filename into user-defined fields like  
%dummy% - %dummy% - %dummy% - %dummy% - %my\_artist% - %my\_title%  
and then compare %artist% with %my\_artist% and/or %title% with %my\_title%

---

<div class="post-metadata">

**Author:** ![willemvaneck](https://community.mp3tag.de/user_avatar/community.mp3tag.de/willemvaneck/32/5561_2.png) [@willemvaneck](https://community.mp3tag.de/u/willemvaneck)\
**Post date:** [December 30, 2018, 9:38pm UTC](https://community.mp3tag.de/t/extract-part-of-filename/44058/3 "2018-12-30T21:38:35Z")

</div>

Many thanks and much appreciated !

Nice and happy new year to all.

Willem VAN ECK

---

<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:** [February 6, 2022, 1:36pm UTC](https://community.mp3tag.de/t/extract-part-of-filename/44058/4 "2022-02-06T13:36:45Z")

</div>

2 posts were split to a new topic: [Leave out part in filename](https://community.mp3tag.de/t/leave-out-part-in-filename/56231)

---

<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:** [March 8, 2022, 1:36pm UTC](https://community.mp3tag.de/t/extract-part-of-filename/44058/5 "2022-03-08T13:36:46Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
