Help - Search - Members - Calendar
Full Version: Get last words of string for tag
Mp3tag Forums > Mp3tag - International > Support
kumba
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

DetlevD
QUOTE (kumba @ Mar 9 2012, 04:15) *
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" ...

In this case this should work ...
$regexp(%ALBUM%,'^(.+)\s(.+)\s(.+)$','$2 $3')

DD.20120309.0712.CET
kumba
QUOTE (DetlevD @ Mar 8 2012, 22:11) *
In this case this should work ...
$regexp(%ALBUM%,'^(.+)\s(.+)\s(.+)$','$2 $3')

DD.20120309.0712.CET


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
kumba
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
DetlevD
QUOTE (kumba @ Mar 9 2012, 16:49) *
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

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
kumba
QUOTE (DetlevD @ Mar 9 2012, 08:48) *
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


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

Thanks again DetlevD!
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.