Good day, Everybody 
Could you please help me out with an regular expression (or two), which will, in effect:
-
Retain the last word only, in a sentence in a field.
-
Retain the first word only, in a sentence in a field.
Thank you.
Good day, Everybody 
Could you please help me out with an regular expression (or two), which will, in effect:
Retain the last word only, in a sentence in a field.
Retain the first word only, in a sentence in a field.
Thank you.
DD.20171016.1102.CEST
Thank you, DetlevD, that was QUICK. ![]()
Is there perhaps a way to do this using the TRIM-script too?
Please show us the content from the tagfield ALBUMARTIST in question.
DD.20171016.1128.CEST
Sorry, my error, and I fixed it: I erred by going straight for a regular expression action. Now created a format value action with your regex, and all is well now.
I revised my earlier post.
For interest sake, I would still like to know if the same result can be achieved using the trim-script?
Thank you very much again.
Note: Within Mp3tag there is no "trim-script".
Do open ...
https://docs.mp3tag.de/scripting
... and read how the functions $trim, $trimLeft, $trimRight do work.
DD.20171016.1205.CEST
OK, got it. Thank you.
A problem arose: How should I adapt the two given expressions to retain hyphenated words as one?
Example "Saint-Saens".
DD.20171016.2000.CEST
Thank you DetlevD. I appreciate your help very much indeed.
First off thankyou for this it has eased my workflow immensely. It resolved months of banging head on desk and having to have multiple scripts to do the same thing for slight variants.
My question here is this can this script be modified slightly to include a character that is at the end of a word but is not an actual word character. Case in point, I have ORKUS! as a publisher/label with a number of volumes and best of compilations underneath it now using the 1st word option, I get the ORKUS (Minus the !)..would like to include the ! but when I try to apply the \W to replace the \w that you are using which works perfectly it goes awry? Any suggestions?
$regexp('aaa bbb-ccc!','^.*\s([\w!-]+)$','$1') ==> 'bbb-ccc!'
DD.20171102.2136.CET
Well that is simple must have been overthinking it .... which is why I read and reread the forums to see what can be useful...
Thanks as always...to DetlevD