Help - Search - Members - Calendar
Full Version: Remove random number in title
Mp3tag Forums > Mp3tag - International > Support
motom
HI,

Thanks to the forum, I managed to make some big changes on the title of the podcast i downloaded
Filename to tag, make action group to add and remove text on title and thing like that. However I'm not so good with the regular expressions or scripting, not sure what you calls it.

So here's the last problem i'm facing.

the podcast file name is something like this
revolution_2010-11-26_1_91fc.mp3,
revolution_2010-11-26_2_c7d6.mp3,
revolution_2010-11-26_3_f5c1.mp3
...etc

while 91fc, c7d6, f5c1 are random numbers and char

They all don't have titles.
i've managed to put titles and add the date to the title also remove revolution_ using action group.

so the title look like this.
2010-11-26_1_91fc_Bele Bala 女同事
2010-11-26_2_c7d6_職場上位要埋堆
2010-11-26_3_f5c1_點搞女波士?

...etc

So i'm wondering how can i remove the random numbers and char.

The action group i use is
Field: TITLE
Regualr expression: ^\l*_

Is there anything i can add to the action group to remove those random numbers and char or should I make another action group and what would it be?

Thanks for the help smile.gif))

stevehero
QUOTE (motom @ Jun 12 2012, 19:41) *
so the title look like this.
2010-11-26_1_91fc_Bele Bala 女同事
2010-11-26_2_c7d6_職場上位要埋堆
2010-11-26_3_f5c1_點搞女波士?

...etc

So i'm wondering how can i remove the random numbers and char.

Use the following:

Action type: Format value
Field: TITLE
Formatstring: $regexp(%title%,'^(\d{4}-\d{2}-\d{2}_\d+_)[\w]+_(.+)',$1$2)
motom
QUOTE (stevehero @ Jun 13 2012, 05:43) *
Use the following:

Action type: Format value
Field: TITLE
Formatstring: $regexp(%title%,'^(\d{4}-\d{2}-\d{2}_\d+_)[\w]+_(.+)',$1$2)


Thank you It works perfectly smile.gif

I can understand the meaning of most of the code.
If I want to learn about the expression. where can I find tutorial. I'm looking at the help page but it didnt say much.
I can understand ^(\d{4}-\d{2}-\d{2}_\d+_), but not [\w]+_(.+)',$1$2) and the use of ' '

Thanks again
stevehero
QUOTE (motom @ Jun 13 2012, 05:26) *
but not [\w]+_(.+)',$1$2) and the use of ' '

No prob, I've attached this screenshot of the program where I basically learned regexp. Its called 'RegexBuddy' See the video for it HERE.

ATTACHMENT Study this book.gif Notice where you can put the specific text you want in the box and it automatically brings back the result.
Click to view attachment

In http://help.mp3tag.de/options_format.html it states that:
\w Any word character - all alphanumeric characters plus the underscore

Wrapping that in '[]' doesn't make any difference in this case.

For the ' ' in the regexp http://help.mp3tag.de/main_scripting.html states there that:
,() These characters must only be escaped when they are inside a scripting function.

As you can see there is so thats why. Is the same for the part of $regexp(what,expr,repl) highlighted bold. If you want the repl to have a ,() then you have to escape it otherwise it won't work.

But to learn more this is a good place to start:
http://www.regular-expressions.info/tutorialcnt.html

regexp is really additive once you start and its a godsend when you want to batch rename files on your computer not JUST your audio files.
motom
QUOTE (stevehero @ Jun 13 2012, 23:05) *
ATTACHMENT Study this book.gif Notice where you can put the specific text you want in the box and it automatically brings back the result.
Click to view attachment

regexp is really additive once you start and its a godsend when you want to batch rename files on your computer not JUST your audio files.


haha thank you. I understand a bit more again now. laugh.gif
Still trying to understand what escape means. Is that why you have to use '' ? for "escape"?

yeah actually just know about regexp not long ago. I just start to know I can use it to edit text with notepad++, only the basic stuff tho.
just started to use mp3tag, I have a collection of songs. It should be useful to make changing to them.

Thanks a lot with the link. gonna take time to learn about it now.
How long does it take for you to become good at regexp ? tongue.gif
stevehero
QUOTE (motom @ Jun 13 2012, 16:13) *
haha thank you. I understand a bit more again now. laugh.gif
Still trying to understand what escape means. Is that why you have to use '' ? for "escape"?

the the following regexp ^(\d{4}-\d{2}-\d{2}_\d+_)[\w]+_(.+) must be wrapped with '' because it contains both ( and ). The can be said for the , character.

QUOTE (motom @ Jun 13 2012, 16:13) *
How long does it take for you to become good at regexp ? tongue.gif

if you get stuck in prob a couple of days.

I just googled ph34r.gif a free tester and came back with this wedsite http://regexpal.com/ so just type in the bottom box the specific text you want to match the it will give you live feedback as to what's doing what.

Glad to be of help.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.