# Search for \[TITLE-TEXT\] then write to Genre

**URL:** https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547
**Category:** General Discussion
**Created:** [February 27, 2014, 11:18pm UTC](https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547 "2014-02-27T23:18:12Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![DHoude](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@DHoude](https://community.mp3tag.de/u/DHoude)
#### Post date: [February 27, 2014, 11:18pm UTC](https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547/1 "2014-02-27T23:18:12Z")

</div>

I have a bunch of songs that have notes like "[Acapella]" in the title. I want to make an action that will scan for this in the title of the song and when it finds a song like this, overwrites the Genre field with "Acapella".

So it needs to find files like this "SONG TITLE [Acapella] - HD" and then over write the Genre with "Acapella"

Thanks for any help you can give!

---

<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 28, 2014, 6:32am UTC](https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547/2 "2014-02-28T06:32:17Z")

</div>

If all genres are inside square brackets the you can use an action of the type "Guess values" and the guessing pattern  
%title% [%genre%] - HD

If the square brackets are a problem, use  
%title% '['%genre%']' - HD

No, there is no generator that looks up a list of genres. You would have to be sure that the information that you want is inside the square brackets.

---

<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 28, 2014, 7:18am UTC](https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547/3 "2014-02-28T07:18:53Z")

</div>

> [@DJ Don](#):
>
> I have a bunch of songs that have notes like "[Acapella]" in the title. I want to make an action that will scan for this in the title of the song and when it finds a song like this, overwrites the Genre field with "Acapella". ...

Filter files with TITLE containing text enclosed in square brackets ...

 

**TITLE MATCHES "[.+]"  
... or ...  
TITLE MATCHES "[Acapella]"**  
   
Copy text enclosed in square brackets from TITLE to GENRE ...

  

Action "Format value"  
... or ...  
Converter "Tag - Tag"

 

**Field: GENRE  
Formatstring: $regexp(%TITLE%,'^._[(.+)]._$','$1')  
... or ...  
Formatstring: $regexp(%TITLE%,'^._[(Acapella)]._$','$1')**  
   
Remove text enclosed in square brackets from TITLE ...

  

Action "Format value"  
... or ...  
Converter "Tag - Tag"

 

**Field: TITLE  
Formatstring: $trim($regexp(%TITLE%,'\s\*[.+]\s\*',' '))  
... or ...  
Formatstring: $trim($regexp(%TITLE%,'\s\*[Acapella]\s\*',' '))**  
   
DD.20140228.0919.CET

---

<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 28, 2014, 12:47pm UTC](https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547/4 "2014-02-28T12:47:19Z")

</div>

> [@DJ Don](#):
>
> I have a bunch of songs that have notes like "[Acapella]" in the title. I want to make an action that will scan for this in the title of the song and when it finds a song like this, overwrites the Genre field with "Acapella". ...

If you want to set the GENRE tag-field within both tag-types ID3v1 and ID3v2 at once, then you have to use the proper GENRE name, from the list of defined names for ID3v1, and which will be encoded into one-byte-number within the ID3v1 tag.  
Be aware of that Mp3tag uses the correct spelling "A Cappella".

DD.20140228.1447.CET

---

<div class="post-metadata">

### Author: ![DHoude](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@DHoude](https://community.mp3tag.de/u/DHoude)
#### Post date: [February 28, 2014, 1:11pm UTC](https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547/5 "2014-02-28T13:11:01Z")

</div>

Thanks for the replies! I will try some of these tonight/weekend and get back. Love seeing the different approaches, helps me learn. Honestly I am having a hard time learning MP3Tag for some reason. Normally pretty good with stuff like this.

Thanks again! You guys are awesome here, so glad I found this place!

---

<div class="post-metadata">

### Author: ![DHoude](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@DHoude](https://community.mp3tag.de/u/DHoude)
#### Post date: [February 28, 2014, 1:13pm UTC](https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547/6 "2014-02-28T13:13:52Z")

</div>

> [@DetlevD](#):
>
> If you want to set the GENRE tag-field within both tag-types ID3v1 and ID3v2 at once, then you have to use the proper GENRE name, from the list of defined names for ID3v1, and which will be encoded into one-byte-number within the ID3v1 tag.  
> Be aware of that Mp3tag uses the correct spelling "A Cappella".

I don't fully understand why this is yet, I am pretty new to automating tasks like this, etc. I am use to doing this all manually in iTunes and not dealing with Tag formats and their limitations. I appreciate the warning and will keep this in mind.

---

<div class="post-metadata">

### Author: ![DHoude](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@DHoude](https://community.mp3tag.de/u/DHoude)
#### Post date: [February 28, 2014, 10:07pm UTC](https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547/7 "2014-02-28T22:07:02Z")

</div>

> [@DetlevD](#):
>
> Action "Format value"  
> ... or ...  
> Converter "Tag - Tag"
> 
> Field: GENRE  
> Formatstring: $regexp(%TITLE%,'^._[(.+)]._$','$1')  
> ... or ...  
> Formatstring: $regexp(%TITLE%,'^._[(Acapella)]._$','$1')

So I like both of these, but there is an issue. It does take "[Acapella]" and move that, without brackets to the Genre field just like I want. But on all the other songs it copies the whole song title and replaces the Genre field. Is there a way to fix that? Or is the only way to make a filter and only select Acapella tracks?

---

<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: [March 1, 2014, 6:33am UTC](https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547/8 "2014-03-01T06:33:57Z")

</div>

> [@DJ Don](#):
>
> So I like both of these, but there is an issue. It does take "[Acapella]" and move that, without brackets to the Genre field just like I want. But on all the other songs it copies the whole song title and replaces the Genre field. Is there a way to fix that? Or is the only way to make a filter and only select Acapella tracks?

In case of there is no match, then the function $regexp returns the unchanged source string.

To circumvent this result you can choose one from the alternatives:

- Set a filter which does a pre-selection of possible matches.

- Write the result of the formatstring into a temporary helper tag-field as the first step;  
in the second step check the temporary helper tag-field, whether it has the same content as the source string, then decide what to do:  
Let the GENRE tag-field as is or copy the content form the helper tag-field to the GENRE tag-field.  
In the third step remove the helper tag-field.

- Use an extended version of the given formatstring, which includes the check:

**Action "Format value" ... or ... Convert "Tag - Tag" Field: GENRE Formatstring: $if($eql($regexp(%TITLE%,'^.\*\[(Acapella)\].\*$','$1'),%TITLE%),%GENRE%, $regexp(%TITLE%,'^.\*\[(Acapella)\].\*$','$1')) ... or ... Formatstring: $if($neql(%TITLE%,$regexp(%TITLE%,'^.\*\[(Acapella)\].\*$','$1')), $regexp(%TITLE%,'^.\*\[(Acapella)\].\*$','$1'),%GENRE%)**

DD.20140301.0855.CET

---

<div class="post-metadata">

### Author: ![DHoude](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@DHoude](https://community.mp3tag.de/u/DHoude)
#### Post date: [March 1, 2014, 5:05pm UTC](https://community.mp3tag.de/t/search-for-title-text-then-write-to-genre/15547/9 "2014-03-01T17:05:49Z")

</div>

You have a pretty incredible grasp of this software. Thank you for your help. That seems to fix the issue. I would love to understand how, but that is a pretty crazy string.

Thank you again for the help!
