# How to batch replace the last comma with ampersand (&) character.

**URL:** <https://community.mp3tag.de/t/how-to-batch-replace-the-last-comma-with-ampersand-character/17728>\
**Category:** Support\
**Created:** [March 8, 2016, 7:26am UTC](https://community.mp3tag.de/t/how-to-batch-replace-the-last-comma-with-ampersand-character/17728 "2016-03-08T07:26:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![imanish](https://community.mp3tag.de/user_avatar/community.mp3tag.de/imanish/32/467_2.png) [@imanish](https://community.mp3tag.de/u/imanish)\
**Post date:** [March 8, 2016, 7:26am UTC](https://community.mp3tag.de/t/how-to-batch-replace-the-last-comma-with-ampersand-character/17728/1 "2016-03-08T07:26:15Z")

</div>

In artist tag, I want to batch replace the last comma with ampersand (&) character.

e.g.

if artist tag is "Artist A, Artist B, Artist C"

result should be "Artist A, Artist B & Artist C".

and if "Artist A, Artist B"

result should be "Artist A & Artist B".

How to do it by action?

May I get the regular expression replace syntax for the same.

Thanks...

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [March 8, 2016, 7:49am UTC](https://community.mp3tag.de/t/how-to-batch-replace-the-last-comma-with-ampersand-character/17728/2 "2016-03-08T07:49:18Z")

</div>

Use an action of the type "Replace with regular expression" for ARTIST  
Search string: `(.*), (.*)`  
Replace string: $1 & $2

Due to the greediness of the expression, only the last comma is replaced. Should work with any Artist that has comma in the name.

Will produce problems for artists that already have an ampersand in the name like "Emerson, Lake & Palmer", "Earth, Wind & Fire", "Bell, Book & Candle".

---

<div class="post-metadata">

**Author:** ![imanish](https://community.mp3tag.de/user_avatar/community.mp3tag.de/imanish/32/467_2.png) [@imanish](https://community.mp3tag.de/u/imanish)\
**Post date:** [March 8, 2016, 10:31am UTC](https://community.mp3tag.de/t/how-to-batch-replace-the-last-comma-with-ampersand-character/17728/3 "2016-03-08T10:31:39Z")

</div>

Thank you....so muchh......

Got the exactly what I was looking for.. ![:book:](https://community.mp3tag.de/uploads/default/original/1X/0036d5b68f6226c53f6c68abfd0a7b8096fd4505.gif ":book:") ![:book:](https://community.mp3tag.de/uploads/default/original/1X/0036d5b68f6226c53f6c68abfd0a7b8096fd4505.gif ":book:")

![:music:](https://community.mp3tag.de/uploads/default/original/1X/2ba05d1ade5eb0d15fc173be6f717dbe63890a70.gif ":music:") ![:music:](https://community.mp3tag.de/uploads/default/original/1X/2ba05d1ade5eb0d15fc173be6f717dbe63890a70.gif ":music:") ![:music:](https://community.mp3tag.de/uploads/default/original/1X/2ba05d1ade5eb0d15fc173be6f717dbe63890a70.gif ":music:")

---

<div class="post-metadata">

**Author:** ![Rijkstra](https://community.mp3tag.de/user_avatar/community.mp3tag.de/rijkstra/32/22_2.png) [@Rijkstra](https://community.mp3tag.de/u/Rijkstra)\
**Post date:** [March 8, 2016, 3:45pm UTC](https://community.mp3tag.de/t/how-to-batch-replace-the-last-comma-with-ampersand-character/17728/4 "2016-03-08T15:45:53Z")

</div>

> [@ohrenkino](#):
>
> Use an action of the type "Replace with regular expression" for ARTIST Search string: (._), (._) Replace string: $1 & $2 Due to the greediness of the expression, only the last comma is replaced. Should work with any Artist that has comma in the name. Will produce problems for artists that already have an ampersand in the name like "Emerson, Lake & Palmer", "Earth, Wind & Fire", "Bell, Book & Candle".

It seems that the problem would be with the last artist having a **comma** in its name.

**IN: "Emerson, Lake & Palmer", "Earth, Wind & Fire", "Bell, Book & Candle"**

 

**```
OUT: "Emerson, Lake & Palmer", "Earth, Wind & Fire", "Bell & Book & Candle".</b>Usually the commas between the quotes would be represented by semicolons, especially if the artists are unquoted.**

**```**

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [March 9, 2016, 5:13am UTC](https://community.mp3tag.de/t/how-to-batch-replace-the-last-comma-with-ampersand-character/17728/5 "2016-03-09T05:13:47Z")

</div>

QUOTE (Rijkstra @ Mar 8 2016, 17:45) \<{POST\_SNAPBACK}\>

It seems that the problem would be with the last artist having a **comma** in its name. 

**IN"[/font]Emerson, Lake & Palmer", "Earth, Wind & Fire", "Bell, Book & Candle"**

```
OUT: "Emerson, Lake & Palmer", "Earth, Wind & Fire", "Bell & Book & Candle".</b>Usually the commas between the quotes would be represented by semicolons, especially if the artists are unquoted.<!--QuoteEnd--></div><!--QuoteEEnd-->

```

You do realize that the data in quotes actually represents individual groups and will probably never be part of a single artist field.  
So the "out" would look much more like this:  
Emerson & Lake & Palmer  
Earth & Wind & Fire  
Bell & Book & Candle

Oh, I just remembered one of my all-time favourites:  
Dave Dee, Dozy, Beaky, Mick & Tich  
would turn to, if you replace the "last" comma with an ampersand  
Dave Dee, Dozy, Beaky & Mick & Tich

I intended my excursion to these groups as a word of caution that the criterion "last comma" is not always valid and that you have to filter your data first to get the best results.

---

<div class="post-metadata">

**Author:** ![Rijkstra](https://community.mp3tag.de/user_avatar/community.mp3tag.de/rijkstra/32/22_2.png) [@Rijkstra](https://community.mp3tag.de/u/Rijkstra)\
**Post date:** [March 9, 2016, 5:49am UTC](https://community.mp3tag.de/t/how-to-batch-replace-the-last-comma-with-ampersand-character/17728/6 "2016-03-09T05:49:37Z")

</div>

> [@ohrenkino](#):
>
> You do realize that the data in quotes actually represents individual groups and will probably never be part of a single artist field.

No, not in an artist field, but I have seen garbage like that in a comment field. BTW, the example wasn't mine.

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:26pm UTC](https://community.mp3tag.de/t/how-to-batch-replace-the-last-comma-with-ampersand-character/17728/7 "2026-02-09T12:26:08Z")

</div>


