IPB

Welcome Guest ( Log In | Register )

> Notice!

Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.

Also make sure you've read the Forum Guidelines before posting in this forum.

 
Reply to this topicStart new topic
> Regular Expressions Baffle Me
Tinctoris
post Sep 7 2017, 19:25
Post #1


Member


Group: Full Members
Posts: 5
Joined: 7-September 17
Member No.: 23890
Mp3tag Version: 2.84a



I am trying to figure out how to remove these characters (BC A24) from the TITLE field. The numbers are different for each disc, however, so basically I want to remove (BC A##)

I can't figure out what regular expressions to use. Please help!

This post has been edited by Tinctoris: Sep 7 2017, 19:26
Go to the top of the page
 
+Quote Post
stevehero
post Sep 7 2017, 19:34
Post #2


Member


Group: Full Members
Posts: 830
Joined: 3-December 10
From: Ireland
Member No.: 13334
Mp3tag Version: 2.84



QUOTE (Tinctoris @ Sep 7 2017, 19:25) *
I am trying to figure out how to remove these characters (BC A24) from the TITLE field. The numbers are different for each disc, however, so basically I want to remove (BC A##)

I can't figure out what regular expressions to use. Please help!

\( matches (
BC matches BC
\s+ matches any number of spaces
A matches A
\d+ matches any number of digits
\) matches )

so that equals
\(BC\s+A\d+\)


--------------------
Go to the top of the page
 
+Quote Post
Tinctoris
post Sep 7 2017, 21:01
Post #3


Member


Group: Full Members
Posts: 5
Joined: 7-September 17
Member No.: 23890
Mp3tag Version: 2.84a



QUOTE (stevehero @ Sep 7 2017, 13:34) *
\( matches (
BC matches BC
\s+ matches any number of spaces
A matches A
\d+ matches any number of digits
\) matches )

so that equals
\(BC\s+A\d+\)


BRILLIANT. It worked, of course. I don't know why I can't wrap my mind around this, especially since I am pretty good with HTML. Maybe I just need to practice. THANK YOU!!!
Go to the top of the page
 
+Quote Post
stevehero
post Sep 7 2017, 21:31
Post #4


Member


Group: Full Members
Posts: 830
Joined: 3-December 10
From: Ireland
Member No.: 13334
Mp3tag Version: 2.84



QUOTE (Tinctoris @ Sep 7 2017, 21:01) *
BRILLIANT. It worked, of course. I don't know why I can't wrap my mind around this, especially since I am pretty good with HTML. Maybe I just need to practice. THANK YOU!!!

It's really easy. (for the basics)

You can use literals such as A, B, C or a,b,c which will match those letters dependant on casing.

But you can switch this behaviour for reg exp by placing (?i) before a,b,c so it matches any UPPERCASE letters too.

So to translate that, my 1st expression could be changed to: (?i) added to start
CODE
(?i)\(bc\s+a\d+\)


This would match:
(BC A24)
(Bc a24)
(bc a24)

Then you have characters like ( which need to be escaped for reg exp resulting in \( being used.

Whitespace regexp syntax is \s
digit is \d
letter is \w

then
\S is not a whitespace
\D is not a digit
\W is not a letter

If you're stuck google the char you want to match using reg exp you'll find the solution.

There's several regexp testers to try out your expressions on like these

And to learn: http://www.regular-expressions.info/

This post has been edited by stevehero: Sep 7 2017, 21:35


--------------------
Go to the top of the page
 
+Quote Post
Tinctoris
post Sep 9 2017, 00:58
Post #5


Member


Group: Full Members
Posts: 5
Joined: 7-September 17
Member No.: 23890
Mp3tag Version: 2.84a



QUOTE (stevehero @ Sep 7 2017, 15:31) *
It's really easy. (for the basics)

You can use literals such as A, B, C or a,b,c which will match those letters dependant on casing.

But you can switch this behaviour for reg exp by placing (?i) before a,b,c so it matches any UPPERCASE letters too.

So to translate that, my 1st expression could be changed to: (?i) added to start
CODE
(?i)\(bc\s+a\d+\)


This would match:
(BC A24)
(Bc a24)
(bc a24)

Then you have characters like ( which need to be escaped for reg exp resulting in \( being used.

Whitespace regexp syntax is \s
digit is \d
letter is \w

then
\S is not a whitespace
\D is not a digit
\W is not a letter

If you're stuck google the char you want to match using reg exp you'll find the solution.

There's several regexp testers to try out your expressions on like these

And to learn: http://www.regular-expressions.info/

Thanks again! I will do my best. blink.gif
Go to the top of the page
 
+Quote Post
Tinctoris
post Sep 9 2017, 21:18
Post #6


Member


Group: Full Members
Posts: 5
Joined: 7-September 17
Member No.: 23890
Mp3tag Version: 2.84a



QUOTE (Tinctoris @ Sep 8 2017, 18:58) *
Thanks again! I will do my best. blink.gif


Doing pretty well now, actually. But now I have a rather complex replacement that may not even be possible. I'm working with the complete Bach Cantatas, which I have ripped as FLAC from a 56-box set that I own. As you can see from the attached, some of the cantatas have ripped with each movement being numbered (BWV 150), while the majority have not, as seen in the three cantatas above it. Is there anyway to auto-number movement numbers after the BWV number and semicolon? This would require the numbering restarting for each cantata.

Since each disc holds multiple cantatas, the movement numbers do not equal the disc track numbers, except in the case of the first cantata on each disc. Further, the cantatas do not all have the same number of movements.

If this cannot be done in a single batch or even per disc, with the numbering restarting at 1. for each cantata, could it be done one cantata at a time? Otherwise, I will renumber each movement manually, which is quite time-consuming with 200 or so cantatas.

Thanks!

Attached thumbnail(s)
Attached Image
 
Go to the top of the page
 
+Quote Post
stevehero
post Sep 9 2017, 22:07
Post #7


Member


Group: Full Members
Posts: 830
Joined: 3-December 10
From: Ireland
Member No.: 13334
Mp3tag Version: 2.84



Best thing you could do and quickest is if you've got them files in each of their individual folders relative to their album then use the autonumbering wizard to number the tracks by directory.

Then use that number to fill in the value you want after the semi-colon.

Use format action on whatever tag you're using with, in this example it's TITLE

Format: TITLE
With: $replace(%title%,;,; %track%.)


I think that's what you're after?

Edit. Looking at your screen shot again it looks like you have the track filled in so just go to the replace bit.

This post has been edited by stevehero: Sep 9 2017, 22:35


--------------------
Go to the top of the page
 
+Quote Post
DetlevD
post Sep 10 2017, 02:27
Post #8


Member


Group: Full Members
Posts: 6672
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.84d



QUOTE (Tinctoris @ Sep 7 2017, 20:25) *
... how to remove these characters (BC A24) from the TITLE field. ...

You should consider that such a string value like '(BC A24)' is a special value, because it is the registering scheme for the "Bach Cantatas".
You should not loose such valuable data. Move those values into a different tagfield of your choice.

DD.20170910.0327.CEST


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
Tinctoris
post Sep 13 2017, 23:35
Post #9


Member


Group: Full Members
Posts: 5
Joined: 7-September 17
Member No.: 23890
Mp3tag Version: 2.84a



QUOTE (DetlevD @ Sep 9 2017, 20:27) *
You should consider that such a string value like '(BC A24)' is a special value, because it is the registering scheme for the "Bach Cantatas".
You should not loose such valuable data. Move those values into a different tagfield of your choice.

DD.20170910.0327.CEST

Yes, while I agree it is important from a musicological standpoint (I actually hold a Ph.D. in musicology), I don't want it in my music library as it is just too much information to display in the player. I'm happy with just the BWV number. But thanks!
Go to the top of the page
 
+Quote Post
ohrenkino
post Sep 14 2017, 06:26
Post #10


Member


Group: Full Members
Posts: 9133
Joined: 9-December 09
From: Norddeutschland / Northern Germany
Member No.: 11458
Mp3tag Version: 2.84d



ZITAT(Tinctoris @ Sep 14 2017, 00:35) *
...too much information to display in the player. ...

This may well be.
Yet, if you move the information to a user-defined field (or a standard one that you do not use) it will not be lost and you can recycle it if you change your mind.

And as most players do not display user-defined fields, you have the best of both worlds: no display but the information is still there.

It is very tedious to restore deleted information.


--------------------
42 - wie war die Frage / what was the question / quelle était la question
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th October 2017 - 04:20