I have been working with this script that I amalgamated from other scrips garnered here and I would like to get the second to last portion of this action to replace " / " with ", " except when there is only one " / " or it is the last " / ". If then, replace with " & "
I don't know what you really want to achieve with the action group that you offered ...
But if you first split the ARTIST field with the / as separator and then you remove all duplicate fields of the type ARTIST then you will never get the / as part of the field ARTIST, I would say.
From a plausibility point of view ..
you want to have artists like artist1, artist2 / artist3 & artist4?
instead of artist1, artist2, artist3 & artist4
I had set up some fields (sometimes it was the artist field and other times the artist sort field, an inconsistency I am trying to clean up) to list all the performers separated by " / ". So I would have:
Thea King / Gabrieli String Quartet / Kenneth Sillito / Brendan O'reilly / Ian Jewel / Keith Harvey
I want to copy this information to the involved people but then I need to convert the artist (sometimes artist sort field but I can change the script later to address that field) to read:
Thea King, Gabrieli String Quartet, Kenneth Sillito, Brendan O'reilly, Ian Jewel & Keith Harvey
However, some times I just have just two entities listed:
Andras Schiff / New Vienna Octet
and I would like it to read:
Andras Schiff & New Vienna Octet
Basically the last, or only " / " should be converted to " & "
Hopefully I have presented the state of affairs clearly. Thanks for your attention to this, it is appreciated!
Then try the following:
First (simple) replace all slashes / with a comma.
Then try the following "Replace with regular expression":
Search string: (.*), (.*)
Replace with: $1 & $2
The greadiness will take care that this always happens only to the last comma.
Thanks for the link. I know I have read this before but this stuff just leaks out of my mind if I don't use it regularly. I will re-read and hopefully it will someday stick.
....actually, I read it, or at least the part about non-greedy repeats. Still can't find the greedy explanation...
The standard quantifiers in regular expressions are greedy, meaning they match as much as they can, only giving back as necessary to match the remainder of the regex.
By using a lazy quantifier, the expression tries the minimal match first.
And for a long detailed explanation, you could read here for example.
Thanks LyricsLover, especially for the detailed link, which I have bookmarked. I am going to read that 100 times and let it digest.
Maybe if I took as much time learning scripting as I do music tagging I would be proficient, but alas, it is not a strong point of mine. That is why I so appreciate this community and the help of people like you, ohrenkino and Florian.
It is a very generous and kind and I really do appreciate it in this world where such qualities seem to be evaporating.