IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Can I replace last comma (,) with 'And'
vvikkass
post Dec 17 2016, 21:54
Post #1


Member


Group: Full Members
Posts: 40
Joined: 13-October 16
Member No.: 22612
Mp3tag Version: 2.78



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.
Go to the top of the page
 
+Quote Post
DetlevD
post Dec 18 2016, 17:38
Post #2


Member


Group: Full Members
Posts: 6718
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.85



QUOTE (vvikkass @ Dec 17 2016, 21:54) *
... when export to text file it shows multiple narrator all separated by commas. ...

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

QUOTE (vvikkass @ Dec 17 2016, 21:54) *
... 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
...


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


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd November 2017 - 00:44