# Disc Number action based on album title?

**URL:** https://community.mp3tag.de/t/disc-number-action-based-on-album-title/13392
**Category:** Support
**Created:** [May 4, 2012, 7:47am UTC](https://community.mp3tag.de/t/disc-number-action-based-on-album-title/13392 "2012-05-04T07:47:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sobeitjedi](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@sobeitjedi](https://community.mp3tag.de/u/sobeitjedi)
#### Post date: [May 4, 2012, 7:47am UTC](https://community.mp3tag.de/t/disc-number-action-based-on-album-title/13392/1 "2012-05-04T07:47:24Z")

</div>

Hi.

Is there a way I can create an action so that when (CD1) or (CD2) or (CD3) etc is detected in the album field (for example)

Greatest Hits (CD2)

the disc number gets auto-filled with this number?

---

<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: [May 4, 2012, 8:17am UTC](https://community.mp3tag.de/t/disc-number-action-based-on-album-title/13392/2 "2012-05-04T08:17:41Z")

</div>

> [@sobeitjedi](#):
>
> Hi. Is there a way I can create an action so that when (CD1) or (CD2) or (CD3) etc is detected in the album field (for example) Greatest Hits (CD2) the disc number gets auto-filled with this number?

What do you mean with "auto-filled"?  
Using a converter?  
Using an action?

See there ...  
[/t/4117/1](https://community.mp3tag.de/t/4117/1)  
... maybe you can adapt something.

DD.20120504.1220.CEST

---

<div class="post-metadata">

### Author: ![sobeitjedi](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@sobeitjedi](https://community.mp3tag.de/u/sobeitjedi)
#### Post date: [May 4, 2012, 8:27am UTC](https://community.mp3tag.de/t/disc-number-action-based-on-album-title/13392/3 "2012-05-04T08:27:06Z")

</div>

> [@DetlevD](#):
>
> What do you mean with "auto-filled"?  
> Using a converter?  
> Using an action?
> 
> DD.20120504.1210.CEST

I would like to click an action so the number following CDX gets put in the disc number field.

---

<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: [May 4, 2012, 8:45am UTC](https://community.mp3tag.de/t/disc-number-action-based-on-album-title/13392/4 "2012-05-04T08:45:43Z")

</div>

> [@sobeitjedi](#):
>
> I would like to click an action so the number following CDX gets put in the disc number field.

Action: Format value  
Field: DISCNUMBER  
Formatstring: **$regexp(%ALBUM%,'^._[\s({[]?CD\s?(\d+)[]})\s]?._$','$1',0)**

DD.20120504.1239.CEST

---

<div class="post-metadata">

### Author: ![sobeitjedi](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@sobeitjedi](https://community.mp3tag.de/u/sobeitjedi)
#### Post date: [May 4, 2012, 8:58am UTC](https://community.mp3tag.de/t/disc-number-action-based-on-album-title/13392/5 "2012-05-04T08:58:27Z")

</div>

> [@DetlevD](#):
>
> Action: Format value  
> Field: DISCNUMBER  
> Formatstring: **$regexp(%ALBUM%,'^._[\s({[]?CD\s?(\d+)[]})\s]?._$','$1',0)**
> 
> DD.20120504.1239.CEST

While that does appear to work, it doesn't work on albums where (CDX) isn't in the album title. Only albums with more than one disc get named with CDX. I would like the default to be 1.

Does this make sense?

For example  
Be Here Now  
Greatest Hits  
Best Album (CD1)  
Best Album (CD2)  
Zooropa

etc

---

<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: [May 4, 2012, 9:14am UTC](https://community.mp3tag.de/t/disc-number-action-based-on-album-title/13392/6 "2012-05-04T09:14:48Z")

</div>

> [@sobeitjedi](#):
>
> While that does appear to work, it doesn't work on albums where (CDX) isn't in the album title. Only albums with more than one disc get named with CDX. I would like the default to be 1. ...

This is a new question.

**Answer 1:**  
Activate Filter [F3]  
Filterexpression: **%ALBUM% MATCHES "^._[\s({[]?CD\s?(\d+)[]})\s]?._$"**

Action: Format value  
Field: DISCNUMBER  
Formatstring: **$regexp(%ALBUM%,'^._[\s({[]?CD\s?(\d+)[]})\s]?._$','$1',0)**

Activate Filter [F3]  
Filterexpression: **NOT %ALBUM% MATCHES "^._[\s({[]?CD\s?(\d+)[]})\s]?._$"**

Action: Format value  
Field: DISCNUMBER  
Formatstring: **'1'**

**Answer 2:**  
Action: Format value  
Field: DISCNUMBER  
Formatstring:

**$if($eql(%ALBUM%,$regexp(%ALBUM%,'^.\*[\s({[]?CD\s?(\d+)[]})\s]?.\*$','$1',0)),'1',$regexp(%ALBUM%,'^.\*[\s({[]?CD\s?(\d+)[]})\s]?.\*$','$1',0))**

**Answer 3:**  
Action 1: Format value  
Field: DISCNUMBER  
Formatstring: **$regexp(%ALBUM%,'^._[\s({[]?CD\s?(\d+)[]})\s]?._$','$1',0)**

Action 2: Format value  
Field: DISCNUMBER  
Formatstring: **[$if($isdigit(%DISCNUMBER%),%DISCNUMBER%,'1')]**

DD.20120504.1342.CEST

---

<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:23pm UTC](https://community.mp3tag.de/t/disc-number-action-based-on-album-title/13392/7 "2026-02-09T12:23:49Z")

</div>


