String search in tag


#1

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.


#2

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.


#3

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


#4

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