# Filename to Tag - Logic

**URL:** https://community.mp3tag.de/t/filename-to-tag-logic/66628
**Category:** Support
**Created:** [November 26, 2024, 1:21am UTC](https://community.mp3tag.de/t/filename-to-tag-logic/66628 "2024-11-26T01:21:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![fcastro](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/b3f665/32.png) [@fcastro](https://community.mp3tag.de/u/fcastro)
#### Post date: [November 26, 2024, 1:21am UTC](https://community.mp3tag.de/t/filename-to-tag-logic/66628/1 "2024-11-26T01:21:43Z")

</div>

Hi all, having some problems with my logic statement.

Music file name is:  
Pitbull & Bon Jovi - Now Or Never (Intro Clean) 128.mp3

I am using filename to tag function: (code below on what I used)  
%artist% - %title% (%title%) %dummy%

That gives me:  
Pitbull & Bon Jovi - Now Or Never Intro Clean

Close, but I would like to keep the parathesis so it reads:  
Pitbull & Bon Jovi - Now Or Never (Intro Clean)

Tried:  
%artist% - %title% "("(%title%)")" %dummy%  
But that didn't work.

---

<div class="post-metadata">

### Author: ![Sergius](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@Sergius](https://community.mp3tag.de/u/Sergius)
#### Post date: [November 26, 2024, 5:42am UTC](https://community.mp3tag.de/t/filename-to-tag-logic/66628/2 "2024-11-26T05:42:00Z")

</div>

Hello fcastro, my audio files are tagged like this, to have the names of the artists and the name of the album while keeping the data in parentheses (xxx)  
%artist%-%album%

Result:  
Artist-Album(2024)

To have a space between the Artist and the Title and keep the data in the parentheses, you can do this very simple programming

%artist% - %title%

Result  
Artist - Title (Your Data)

---

<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: [November 26, 2024, 5:57am UTC](https://community.mp3tag.de/t/filename-to-tag-logic/66628/3 "2024-11-26T05:57:09Z")

</div>

> [@fcastro](#):
>
> I am using filename to tag function: (code below on what I used)  
> %artist% - %title% (%title%) %dummy%

The problem is: the space character is no unique separator.  
So, with Convert\>Filename-Tag you would get as close as

> [@fcastro](#):
>
> Now Or Never (Intro Clean

for TITLE, losing the closing parenthesis  
with  
`%artist% - %title%) %dummy%`  
You could alternatively use an action of the type "Guess value"  
Source string: `$regexp(%_filename%,(.*) \d+,$1)`  
Target format string: `%artist% - %title%`  
Or you stay with Convert\>Filename-Tag and apply a filter afterwards to reduce the list of files to those that have an opening but no closing bracket with  
`%title% HAS "(" AND NOT %title% HAS ")"`  
and then execute Convert\>Tag-Tag for TITLE  
Format string: `%title%)`

---

<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: [December 26, 2024, 5:57am UTC](https://community.mp3tag.de/t/filename-to-tag-logic/66628/4 "2024-12-26T05:57:55Z")

</div>

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