Replace


#1

I have searched on the forum but can't find the answer, apologies if it is just that I am blind!
Ok, I have files with the length in the title such as :
"La Notte Etterna [ 5:43 ]"
"Just You & I [ 5:36 ]"

Specifically I want to know how to replace everything between the "[" and "]" using a wildcard. Also to replace the "[" and "]" for another folder.
Thanks in advance for any help


#2

How should the final title looks like?
"Just You & I [ ]"
"Just You & I []"
"Just You & I "
"Just You & I"

Something else?


#3

To be honest I'd like to know (if possible) how to achieve all of the above variations!
Thanks again for any help


#4

Aktionstyp: Ersetzen mit regulären Ausdrücken
Feld: TITLE
Regulärer Ausdruck: [(.*)]
Treffer ersetzen durch:

This regular expression will match your [ xx:yy ]. If you replace it with nothing, you get the title without any length-information.

JFYI: You will get a space at the end of the title!

It's up to you to change this regular expression for your other variations. :wink:


#5

Thanks for the reply but is there any chance of an explanation then I don't have to keep pestering people for replies! It works great, but I can't understand why it works!
[(.*)] If you have time I would appreciate a quick rundown of how you arrived at this solution. For example what does the "" character do? How do I eliminate everything between 2 characters such as "[" and "]" and leave the "[" and "]" behind, or replace what is between those characters with something else?
I appreciate your help and totally understand if you don't get a chance to explain it, or indeed if the explanation is too involved for a mere mortal like me to grasp!
Once again, thanks a lot


#6

[ and ] are special characters just like . is for example. In order to treat those brackets as brackets and not as special character you have to escape them with a backslash. This is described in the help file: http://help.mp3tag.de/en/options_format.html#regexp. The paranthesis denotes that the characters inside it should be seen as a group and is only needed when you need to access that group later by using $1, or $2 or whatever (depending how many groups you have). A dot stands for a character and the asterisk means that it can occur any number of times, so .* matches an unlimited number of characters. The final string [(.)] or [.] which would be OK for you too says that the RegExp engine should look for a square bracket followed by an unlimited number of characters followed by another closing square bracket. All this should be replaced with nothing -> should be deleted.


#7

@Sebastian: Thanks!

@percepto: Just Google for RegExp. Maybe this http://www.greenend.org.uk/rjk/2002/06/regexp.html or this http://www.regular-expressions.info/ can be a starting point.