# Replacing a Portion of Title with the Discnumber Value

**URL:** https://community.mp3tag.de/t/replacing-a-portion-of-title-with-the-discnumber-value/63624
**Category:** Support
**Created:** [January 31, 2024, 2:07am UTC](https://community.mp3tag.de/t/replacing-a-portion-of-title-with-the-discnumber-value/63624 "2024-01-31T02:07:51Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jprobins](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/e36b37/32.png) [@jprobins](https://community.mp3tag.de/u/jprobins)
#### Post date: [January 31, 2024, 2:07am UTC](https://community.mp3tag.de/t/replacing-a-portion-of-title-with-the-discnumber-value/63624/1 "2024-01-31T02:07:51Z")

</div>

I am attempting to use a regular expression action to delete a portion of the title field and replace it with the numerical value from the discnumber tag. I presumed that I could use %discnumber% in the replace with field. However, that only results in the deleted text being replaced with "%discnumber%" not the value from the Discnumber tag. What would be the correct vocabulary to accomplish this?

Thank you.

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [January 31, 2024, 6:04am UTC](https://community.mp3tag.de/t/replacing-a-portion-of-title-with-the-discnumber-value/63624/2 "2024-01-31T06:04:17Z")

</div>

Is the part of the title to be replaced variable or is it always the same text?  
It's best to give an examples of the actual situation so that you can get an idea.

---

<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: [January 31, 2024, 6:05am UTC](https://community.mp3tag.de/t/replacing-a-portion-of-title-with-the-discnumber-value/63624/3 "2024-01-31T06:05:23Z")

</div>

Please show us the expression that you have used so far.  
And also, a screenshot of the extended tags dialogue Alt-T of one of the files would be nice.

---

<div class="post-metadata">

### Author: ![jprobins](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/e36b37/32.png) [@jprobins](https://community.mp3tag.de/u/jprobins)
#### Post date: [January 31, 2024, 3:41pm UTC](https://community.mp3tag.de/t/replacing-a-portion-of-title-with-the-discnumber-value/63624/4 "2024-01-31T15:41:48Z")

</div>

The Regular Expression Action I am using is:  
Field: TITLE  
Regular Expression:` \s*\([^\)]+?\)\s*`  
Replace Matches With: %Discnumber%

The portion of title to be deleted and replaces is variable, but is always in paranthesis. That portion of the action is working perfectly. THe problem is the "Replace Matches With". I am trying to replace with the value from the Discnumber field not with the character string %Discnumber%.

 ![10 Untitled](https://community.mp3tag.de/uploads/default/original/3X/b/9/b98d6fabbc83815145ccd8404e080c4f6b912d23.png)

---

<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: [January 31, 2024, 3:51pm UTC](https://community.mp3tag.de/t/replacing-a-portion-of-title-with-the-discnumber-value/63624/5 "2024-01-31T15:51:36Z")

</div>

Try Convert\>tag-Tag as that has a preview to test your expression:  
Format string: `$regexp(%title%,\(.*\) (.*),%discnumber% $1)`

---

<div class="post-metadata">

### Author: ![jprobins](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/e36b37/32.png) [@jprobins](https://community.mp3tag.de/u/jprobins)
#### Post date: [January 31, 2024, 8:14pm UTC](https://community.mp3tag.de/t/replacing-a-portion-of-title-with-the-discnumber-value/63624/6 "2024-01-31T20:14:11Z")

</div>

Works like a charm. Thank you!!

---

<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 1, 2024, 8:14pm UTC](https://community.mp3tag.de/t/replacing-a-portion-of-title-with-the-discnumber-value/63624/7 "2024-03-01T20:14:33Z")

</div>

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