As the title says, I have a problem regarding the swapping of firstname lastname. If it is just one set, I can do it with a regex. But having a list (FN LN; FN LN; FN LN;...), I don't get the propper result. I tried a few examples from the forum and ended with:
[#0]
T=5
F=COMPOSERSORT
1=%COMPOSER%
[#1]
T=2
F=COMPOSERSORT
1=;
2=;
3=0|0
[#2]
T=4
F=COMPOSERSORT
1=([^;]+)\\\\s([^;]+)
2= $2, $1
3=0which leaves me with the right result, only I still have to cut away a leading extra space.
But my problem is, that I need it all in one action, not three. What I wood like to have is something like that:
T=5
F=COMPOSERSORT
1=$if2(%composersort%,$regexp($regexp(%composer%,(.*?) (\\\\w*)(', '|$),$2', '$1; ),; $,))But working with a list, and not just one name. As I only want to change the field, if it not filled, I can't use the long example, as it would make changes regardless if it is empty or not.
Has anyone of you a good idea?
See there ...
Composersort mit mehreren Personen
Does it work for you?
DD.20151204.0550.CET
Thank You Detlev!
I had it in my collection allready, but it does not seem to work for me.
Tell me if I used it correctly: [#1]
T=5
F=COMPOSERSORT
1=$cutRight($regexp(%COMPOSER%', ','(.*?)\\\\s(\\\\w*),\\\\s','$2, $1; '),2)If I use it, I on: FN1 LN1; FN2 LN2; FN3 LN3
I get: LN3, FN1 LN1; FN2 LN2; FN3
Using Pone solution from the same thread, I get the same result.
I don't know if I implemented it correctly, but it is not the result I hoped for.
I thing I found almost all the offered solutions from the forum, but either it is my missusing them or they don't work for me.
The example formatstring accepts the comma as the input separator and writes the semicolon as the output separator:
$cutRight($regexp(%COMPOSER%', ','(.*?)\s(\w*),\s','$2, $1; '),2)
Example:
"Johann Sebastian Bach, Wolfgang Amadeus Mozart, Ferruccio Busoni" ->
"Bach, Johann Sebastian; Mozart, Wolfgang Amadeus; Busoni, Ferruccio"
You have to adapt the example formatstring to your case, which uses the semicolon as the input separator:
$cutRight($regexp(%COMPOSER%'; ','(.*?)\s(\w*);\s','$2, $1; '),2)
Example:
"Johann Sebastian Bach; Wolfgang Amadeus Mozart; Ferruccio Busoni" ->
"Bach, Johann Sebastian; Mozart, Wolfgang Amadeus; Busoni, Ferruccio"
DD.20151204.1115.CET
That's it. Now it works.
Once again thank you for your help!