# Extract catalogue number from album field

**URL:** https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099
**Category:** Support
**Created:** [April 10, 2019, 9:41pm UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099 "2019-04-10T21:41:08Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![brains](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ec9cab/32.png) [@brains](https://community.mp3tag.de/u/brains)
#### Post date: [April 10, 2019, 9:41pm UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/1 "2019-04-10T21:41:08Z")

</div>

Hi, can someone who's good at this help? i'm not sure i have the brain for this coding but it would save me so much time. I have **a lot** of tags with a catalogue number in between square brackets amongst other stuff. How do i removed everything except the catalogue number. Here's an example: [BT 03] - 1995 - Spikey Trance. I just want it to say BT 03

is that possible??

---

<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: [April 11, 2019, 8:24am UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/2 "2019-04-11T08:24:32Z")

</div>

Which tag field does contain this data?  
You can use an action of the type "Guess value" (import tag fields)  
Source: %catalogue number%  
(please insert here the correct name for the tag field)  
Target:`[%catalogue number%] %dummy%`  
(here again: please insert the correct name for the tag field)

---

<div class="post-metadata">

### Author: ![brains](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ec9cab/32.png) [@brains](https://community.mp3tag.de/u/brains)
#### Post date: [April 11, 2019, 9:01am UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/3 "2019-04-11T09:01:07Z")

</div>

ah, ok i'll try that tonight, it's in album at the moment. I see, so i replace %dummy% with %album% and yes my fields exact target field name is %catalog #%

---

<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: [April 11, 2019, 9:21am UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/4 "2019-04-11T09:21:43Z")

</div>

It the data

> [@Regular Expressions](https://community.mp3tag.de/t/regular-expressions/521/63):
>
> [BT 03] - 1995 - Spikey Trance.

can be found in ALBUM, then the it is  
Source: %album%  
Target: `[%catalog #%] - %album%`  
and probably  
Target: `[%catalog #%] - %year% - %album%`

---

<div class="post-metadata">

### Author: ![brains](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ec9cab/32.png) [@brains](https://community.mp3tag.de/u/brains)
#### Post date: [April 11, 2019, 9:44am UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/5 "2019-04-11T09:44:51Z")

</div>

> [@Regular Expressions](https://community.mp3tag.de/t/regular-expressions/521/66):
>
> [BT 03] - 1995 - Spikey Trance

Ah, actually i don't think that is what im trying to do. Right now, the album field already says all of this " [BT 03] - 1995 - Spikey Trance" and the catalog # tag is blank. I want catalog # to say "BT 03"

My brother suggested maybe first, simply copy album field to catalog #, then use something like

`$regexp(%catalog #%, "^\.*[(.*?)\].*$", $1)`  
on the catalog # field to keep only whats inside the brackets  
and  
`$regexp(%album%, "[(.*?)\] ?", "")`  
on the album field to remove the brackets and everything inside them (as i don't want the catalog number in album field once its copied over to the catalog # field

perhaps that code needs correcting. I don't know if there's a better way

---

<div class="post-metadata">

### Author: ![brains](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ec9cab/32.png) [@brains](https://community.mp3tag.de/u/brains)
#### Post date: [April 11, 2019, 2:23pm UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/6 "2019-04-11T14:23:28Z")

</div>

2nd try  
$regexp(%catalog%, ^. _[(._ ?)].\*$, $1)  
Think should give you just what's in the brackets from catalog

$regexp(%album%, [(.\*?)] ?, );  
should replace [blahblah123] with empty strings

---

<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: [April 11, 2019, 3:41pm UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/8 "2019-04-11T15:41:21Z")

</div>

> [@brains](#):
>
> on the catalog # field to keep only whats inside the brackets  
> and  
> `$regexp(%album%, "[(.*?)\] ?", "")`  
> on the album field to remove the brackets and everything inside them (as i don't want the catalog number in album field once its copied over to the catalog # field

And all this can be achieved in one go (without the 2 steps of copying first and then removing) with that what I described in

> [@Extract catalogue number from album field](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/4):
>
> It the data can be found in ALBUM, then the it is Source: %album% Target: [%catalog #%] - %album% and probably Target: [%catalog #%] - %year% - %album%

---

<div class="post-metadata">

### Author: ![brains](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ec9cab/32.png) [@brains](https://community.mp3tag.de/u/brains)
#### Post date: [April 11, 2019, 5:48pm UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/9 "2019-04-11T17:48:30Z")

</div>

Ah sorry yes that totally works. Brilliant! I think i understand what the code is saying too (a bit) now.

---

<div class="post-metadata">

### Author: ![brains](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ec9cab/32.png) [@brains](https://community.mp3tag.de/u/brains)
#### Post date: [April 11, 2019, 6:07pm UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/10 "2019-04-11T18:07:02Z")

</div>

Just need 1 extra % sign [%catalog #%] - %year% - %album%

---

<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:28pm UTC](https://community.mp3tag.de/t/extract-catalogue-number-from-album-field/45099/11 "2026-02-09T12:28:01Z")

</div>


