Can I replace last comma (,) with 'And'


#1

Have audiobook files, it contains lots of narrators, I when export to text file it shows multiple narrator all separated by commas. Can i replace the last comma with 'And'?

something like...
Author 1, Author 2, Author 3
to
Author 1, Author 2 And Author 3

and can i replace the only comma to 'And'
something like this...
Author 1, Author 2
to
Author 1 And Author 2

So some entry so that mp3tag replace the last comma to something and if thier is only one comma then it replace it with 'And'. I know simple trick of replacing wont do because then it will replace all commas with 'And'.

Please help.

Thanks for reading.


#2

The export to text file, how do you do it?

There may be several ways to go, here is one using Regular Expression.

$regexp('Author 1, Author 2','^(.+),\s(.+)$','$1 and $2')
==> 'Author 1 and Author 2'

$regexp('Author 1, Author 2, Author 3','^(.+),\s(.+)$','$1 and $2')
==> 'Author 1, Author 2 and Author 3

DD.20161218.1738.CET