# TITLE tag has "Artist - Title"

**URL:** https://community.mp3tag.de/t/title-tag-has-artist-title/9638
**Category:** Support
**Created:** [January 4, 2010, 2:18pm UTC](https://community.mp3tag.de/t/title-tag-has-artist-title/9638 "2010-01-04T14:18:54Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [January 4, 2010, 2:18pm UTC](https://community.mp3tag.de/t/title-tag-has-artist-title/9638/1 "2010-01-04T14:18:54Z")

</div>

Hi everyone, I've been using mp3tag for a few months now continuously rebuilding my music collection.  
I write my own scripts and have dozens of them that do everything I need in my own way (I'm very picky).  
I've read different forum topics, external sources, and the FAQ, but I can't solve this issue.

I often run into certain problems when ID-tags are not in their correct fields.  
Like, when the TITLE field has everything "ARTIST - TITLE", leaving the ARTIST field empty.

I always try writing my scripts to solve anything, even if it takes half an hour.  
So far this is my script, I would appreciate any help:

I'm using **Guess Values** :  
_Source Format:_  
**$regexp(%title%~%artist%,(\b._?\b)(._?-._?)(\b._?)~(.\*?),$if($len(%artist%)=0,($3~$1),(%title%~%artist%)))**  
_Guessing Pattern:_  
%title%~%artist%

I realize it is probably a bit messy code now, I'm not even sure if I'm using the $len function properly. Like, do I use == or =.  
I don't know **how to determine if the ARTIST field is empty**. because if it's not, and the TITLE already has a colon then I'm screwed.

Hope someone can help, thanks in advance! 🙂

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [January 5, 2010, 12:21pm UTC](https://community.mp3tag.de/t/title-tag-has-artist-title/9638/2 "2010-01-05T12:21:29Z")

</div>

OK, I figured it out, less complex than I expected.  
In case someone finds it useful, here it is... :

**$regexp(%title%~%artist%,(._?)(\s_-\s\*)(._?)~(._?),$iflonger(%artist%,0,%title%~$4,$3~$1)**

MAYBE if someone reads it, I wonder why "%title%~$4" works but "%title%~%artist%" simply duplicates teh Artist field (like "FanuFanu") ![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:")

---

<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: [January 5, 2010, 1:29pm UTC](https://community.mp3tag.de/t/title-tag-has-artist-title/9638/3 "2010-01-05T13:29:22Z")

</div>

> how to determine if the ARTIST field is empty

$if(%artist%,not empty,empty)

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [January 5, 2010, 4:51pm UTC](https://community.mp3tag.de/t/title-tag-has-artist-title/9638/4 "2010-01-05T16:51:52Z")

</div>

Oh that's quite straightforward, thank you.

(this works now)  
**$regexp(%title%~%artist%,(._?)(\s_-\s\*)(._?)~(._?),$iflonger(%artist%,0,%title%~$4,$3~$1))**

---

<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/title-tag-has-artist-title/9638/5 "2026-02-09T12:22:04Z")

</div>


