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 expression help needed
martythestickman
post Dec 10 2008, 11:26
Post #1


Member


Group: Full Members
Posts: 5
Joined: 17-July 08
Member No.: 7331
Mp3tag Version: 2.41



hey guys im in dire need of assistance.

what i would like to know is how to turn this...
toby dreher - pueblo (holger flinsch remix)

into this...
toby dreher - pueblo -- holger flinsch remix

and vice versa

cheers, marty wink.gif
Go to the top of the page
 
+Quote Post
DetlevD
post Dec 11 2008, 11:30
Post #2


Member


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



From: "toby dreher - pueblo (holger flinsch remix)"
To: "toby dreher - pueblo -- holger flinsch remix"

Action: Format Value
e. g.
$regexp('toby dreher - pueblo (holger flinsch remix)','^(.+?) - (.+?) \((.+?)\)$',$1 - $2 -- $3)


From: "toby dreher - pueblo -- holger flinsch remix.mp3"
To: "toby dreher - pueblo (holger flinsch remix)"

Action: Format Value
e. g.
$regexp('toby dreher - pueblo -- holger flinsch remix','^(.+?) - (.+?) -- (.+?)$',$1 - $2 ($3))

DD.20081211.1130.CET


--------------------
* 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
martythestickman
post Dec 11 2008, 21:19
Post #3


Member


Group: Full Members
Posts: 5
Joined: 17-July 08
Member No.: 7331
Mp3tag Version: 2.41



thank you so much DetlevD for the quick reply wink.gif but it seems i have wasted your time somewhat sad.gif

having looked at the string i realise now the specificity i failed to clarify...

i.e , i would like for it to be a generalised string that doesnt necessarily pertain to those particular words, simply something that is universally applied to anything before and after the - , and -- , and anythign inbetween the ( ) , with no set number of words or characters , just anythign and everythign that may or may not be there.

so with these examples to be precise....

from: xxx xxxxxxx - xxxx -- xxx xxxx xxxxxx xxx
to: xxx xxxxxxx - xxxx (xxx xxxx xxxxxx xxx)

AND

from: xxxx - xxxxxx xxx (xxxx xxx xxxxxx)
to: xxxx - xxxxxx xxx -- xxxx xxx xxxxxx

i apologise once again, and would really appreciate your help

cheers, marty wink.gif
Go to the top of the page
 
+Quote Post
DetlevD
post Dec 12 2008, 05:35
Post #4


Member


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



QUOTE (martythestickman @ Dec 11 2008, 21:19) *
... thank you so much DetlevD for the quick reply wink.gif but it seems i have wasted your time somewhat sad.gif ...

It seems so dry.gif because your second example is equivalent to your first example.

From: "xxx xxxxxxx - xxxx -- xxx xxxx xxxxxx xxx"
To: "xxx xxxxxxx - xxxx (xxx xxxx xxxxxx xxx)"
$regexp('xxx xxxxxxx - xxxx -- xxx xxxx xxxxxx xxx','^(.+?) - (.+?) -- (.+?)$',$1 - $2 ($3))

From: "xxx xxxxxxx - xxxx (xxx xxxx xxxxxx xxx)"
To: "xxx xxxxxxx - xxxx -- xxx xxxx xxxxxx xxx"
$regexp('xxx xxxxxxx - xxxx (xxx xxxx xxxxxx xxx)','^(.+?) - (.+?) \((.+?)\)$',$1 - $2 -- $3)

QUOTE (martythestickman @ Dec 11 2008, 21:19) *
... i would like for it to be a generalised string that doesnt necessarily pertain to those particular words, simply something that is universally applied to anything before and after the - , and -- , and anythign inbetween the ( ) , with no set number of words or characters , just anythign and everythign that may or may not be there. ...

Your response shows that you are not familiar with the philosophy of Mp3tag and Regular Expressions in general. What did I do for you? I took your example and built an adapted regex pattern and tried the regex with your example string (which I assumed to be a generalized example string that fits to your needs) to demonstrate that the regex pattern does what it should do.

Now it is your work to adapt the proposal to your special application: replace the 'what'-parameter of the $regex() function with the content from the tagfield of your choice; I assume that you can use the tagfield placeholder %TITLE% (your example looks like this case) or, may be, you want to use the content from the system tagfield _FILENAME, which can be adressed by the placeholder %_FILENAME%.

If you want to combine both regular expressions into a single one expression please study regular expressions in depth. There might be a chance to do that, but it will take more time than a tea break, which I've invested into your request.

If your example relies on the filename string you may try 'filename to tag' and 'tag to filename' options from Mp3tag's converter section. Try to understand the meaning of a delimiter character resp. a character sequence as a field separator.

DD.20081212.0535.CET

This post has been edited by DetlevD: Dec 12 2008, 11:50


--------------------
* 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
martythestickman
post Dec 13 2008, 10:58
Post #5


Member


Group: Full Members
Posts: 5
Joined: 17-July 08
Member No.: 7331
Mp3tag Version: 2.41



i apologise for my ignorance in advance, i have little to no understanding of the code and how to use it...

i attempted to add that string to a custom regular expression command, replacing the exampled name with %_FILENAME% and it doesnt work. im not sure if thats what u asked me to do...

there is a "replace matches with:" line that i dont know what to do with.

id be greatly appreciative of u to treat me like a complete noob on the subject and to show me ecactly how to set it up correctly if possible.

cheers again, marty wink.gif
Go to the top of the page
 
+Quote Post
DetlevD
post Dec 14 2008, 11:05
Post #6


Member


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



QUOTE (martythestickman @ Dec 13 2008, 10:58) *
... there is a "replace matches with:" line that i dont know what to do with. ...

See http://forums.mp3tag.de/index.php?s=&a...ost&p=34332
I've suggested to use the scripting function $regexp() together with the action 'Format value'.

DD.20081214.1105.CET


--------------------
* 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
martythestickman
post Dec 15 2008, 04:24
Post #7


Member


Group: Full Members
Posts: 5
Joined: 17-July 08
Member No.: 7331
Mp3tag Version: 2.41



DetlevD, you are an absolute legend!

thankyou so much for your time and patience, everythign works perfectly.

cheers, marty wink.gif
Go to the top of the page
 
+Quote Post
DetlevD
post Dec 15 2008, 09:42
Post #8


Member


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



QUOTE (martythestickman @ Dec 15 2008, 04:24) *
DetlevD, you are an absolute legend! thankyou so much for your time and patience, everythign works perfectly. cheers, marty wink.gif

Thank you for your nice feedback.
I am also glad that it works for you, can drink my tea now undisturbed.

DD.20081215.0941.CET


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

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: 23rd September 2017 - 13:51