Get last words of string for tag


#1

I've been attempting to write an action to get the last 2 full words of a string in one field and pass those 2 words to another field.

Example:
"Diary of a Madman" in %album% would return "a Madman" and pass that to the %comments% field

I have looked endlessly through the forum and have experimented with:

$regexp - but that replaces a specified pattern

$left or $right/$cutleft or $cutright - but that calls for a predefined number of characters and that is impossible to predict

Also, I've been using "Format value" in the action to try and copy what I need over to the %comment% field.

Any and all help is greatly appreciated. I have very limited knowledge with regular expressions but have devoted over 2 days trying to get this to work correctly.

Thanks,
Kumba


#2

In this case this should work ...

$regexp(%ALBUM%,'^(.+)\s(.+)\s(.+)$','$2 $3')

DD.20120309.0712.CET


#3

Hi DetlevD,

That did exactly what I needed! THANK YOU!

I am truly grateful and so VERY impressed at the response, support, ingenuous, user friendly design of this software. Not only is it invaluable, but the people that designed and support it are such a tremendous asset to the software!

I appreciate and thank you deeply for what you do. Hence, I made a donation via Paypal a few minutes ago. I wish it was more but this recession is taking a toll on me here in my local area.

Oh, and I have sent an email to all my music loving friends recommending highly that if they don't have mp3tag....to get it!

Take care sir!
Kumba


#4

One more quick question.......(please)?

When exporting (to an XML), is it possible to convert a field either using $upper(string) or the 'Case Conversion' actions? Or does that have to be done prior to exporting?

I can get the action to work prior to export but not 'during' exporting.

Thanks,
Kumba


#5

Mp3tag provide the Mp3tag Export Scripting Language to create text output of any format.
Read there what placeholders are available ...
http://help.mp3tag.de/options_export.html
While in the export section, the main Mp3tag Scripting Language is available ...
http://help.mp3tag.de/main_scripting.html
The export section can work with tag-field data in a non-destructive way, that means, any tag-field content is read-only.

DD.20120309.1749.CET


#6

I can't believe I overlooked that! I need to take a break and decompress!

Thanks again DetlevD!