# String search in tag

**URL:** https://community.mp3tag.de/t/string-search-in-tag/4033
**Category:** Support
**Created:** [November 9, 2006, 1:16am UTC](https://community.mp3tag.de/t/string-search-in-tag/4033 "2006-11-09T01:16:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Chris\_J](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/e480ec/32.png) [@Chris\_J](https://community.mp3tag.de/u/Chris_J)
#### Post date: [November 9, 2006, 1:16am UTC](https://community.mp3tag.de/t/string-search-in-tag/4033/1 "2006-11-09T01:16:32Z")

</div>

Hi all, please help.

I have a two fold problem. I am trying to search for a specific character string, in this instance **(CD 1)**, in the "ALBUM" tag. I wish to copy the disc # into the "DISC #" tag and remove the searched for characters in the "ALBUM" tag.

My thinking was to create a new action with two separate functions I came up with the following but it doesn't work. Am I on the right track or way off base?

First step:  
Format Value  
Field: DISCNUMBER  
Formatstring: $if($eql(%ALBUM%,\*.(CD (\d))),$3,%DISCNUMBER%)

Second step:  
Format Value  
Field: ALBUM  
Regular Expression: (.).(CD\s+(\d+)).  
Replace matches with: $1

I'm sure there are some prettier ways to do this as well. The Album tag I have been working with is: **At The Half Note Cafe Vols 1 & 2 (CD 2)** However, the string I am looking for may or may not be at the end of the file, or in it at all, and may or may not be in some form of parenthesis, bracket etc.

Many thanks, I've spent all day working on this.

Chris

PS. Thanks, Florian, for a truly "top drawer" program.

---

<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: [November 9, 2006, 8:48am UTC](https://community.mp3tag.de/t/string-search-in-tag/4033/2 "2006-11-09T08:48:17Z")

</div>

> [@Chris J](#):
>
> ... I am trying to search for a specific character string, in this instance **(CD 1)**, in the "ALBUM" tag. I wish to copy the disc # into the "DISC #" tag and remove the searched for characters in the "ALBUM" tag.

Create a new Action Group 'Get DISCNUMBER from ALBUM' or so.  
Create four new actions:

Action #1:  
_Action type:_ **Format value**  
_Field:_ **DISCNUMBER**  
_Formatstring:_ **%ALBUM%**

Action #2:  
_Action type:_ **Replace with regular expression**  
_Field:_ **DISCNUMBER**  
_Regular expression:_ **^(._)(.CD.(\d+).)(._)$**  
_Replace matches with:_ **$num($trim($2),1)**

[] case-sensitive comparison

Action #3:  
_Action type:_ **Replace with regular expression**  
_Field:_ **ALBUM**  
_Regular expression:_ **^(._)(.CD.(\d+).)(._)$**  
_Replace matches with:_ **$trim($1$3)**

[] case-sensitive comparison

Action #4:  
_Action type:_ **Replace**  
_Field:_ **ALBUM**  
_Original:_ {2 spaces}  
_Replace with:_ {1 space}

[] only as whole word

case-sensitive comparison

 

Try it out.  
If it does not work, ask again.

 

DD.20061109.1046  
DD.20061109.1246 Edit  
DD.20061109.1835 Edit, sorry about the \\ failure.

---

<div class="post-metadata">

### Author: ![Chris\_J](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/e480ec/32.png) [@Chris\_J](https://community.mp3tag.de/u/Chris_J)
#### Post date: [November 9, 2006, 3:25pm UTC](https://community.mp3tag.de/t/string-search-in-tag/4033/3 "2006-11-09T15:25:00Z")

</div>

Hi Detlev,

Thank you for the quick response, alas, it did not work. The breakdown started at "action 2". I have tried different expressions but to no avail.

Any other bright ideas would be greatly welcomed.

Chris

---

<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: [November 9, 2006, 4:16pm UTC](https://community.mp3tag.de/t/string-search-in-tag/4033/4 "2006-11-09T16:16:57Z")

</div>

You must change the \\ to \ in actions 2 and 3

---

<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:19pm UTC](https://community.mp3tag.de/t/string-search-in-tag/4033/5 "2026-02-09T12:19:59Z")

</div>


