Extract catalogue number from album field

#1

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??

0 Likes

Regular Expressions
#2

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)

0 Likes

#3

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 #%

0 Likes

#4

It the data

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

0 Likes

#5

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

0 Likes

#6

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

0 Likes

#8

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

0 Likes

#9

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

0 Likes

#10

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

0 Likes