# Artist tag replace multiple "and" with commas and "and"

**URL:** <https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833>\
**Category:** Support\
**Created:** [March 27, 2022, 12:15pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833 "2022-03-27T12:15:13Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)\
**Post date:** [March 27, 2022, 12:15pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/1 "2022-03-27T12:15:13Z")

</div>

Artist tag replace multiple "and" with commas and "and"

First as a tip, i have this regex(s) for artist tag that converts things like this:

(1)----------------------------------------------------------------------------------------

Regular expression  
`(?(?=.*\s+(and|&)\s+.*)[†]|(^(\s?(\w|[][{()_+=!@#$%^&*:;"'?><.~`|`¨¨΄΄΅}/-]))+)(\s*,\s*)((\s?(\w|[][{()_+=!@#$%^&*:;"'?><.~``|¨¨΄΄΅}/-])\s?)*$))`

Replace matches with  
`\2 and \6`

converts this:

bla bla bla, bla bla bla  
bla bla bla , bla bla bla  
bla bla bla ,bla bla bla

to this:

bla bla bla and bla bla bla  
bla bla bla and bla bla bla  
bla bla bla and bla bla bla

(2)----------------------------------------------------------------------------------------

Regular expression  
`((.+)(,)(.+))+((.+\b)(\s*(,|\sand\s|\s&\s)\s*)(\b.+$))`

Replace matches with  
`\1\6 and \9`

converts this:

bla bla bla, bla bla bla, bla bla bla, bla bla bla  
bla bla bla , bla bla bla , bla bla bla , bla bla bla  
bla bla bla ,bla bla bla ,bla bla bla ,bla bla bla

to this:

bla bla bla, bla bla bla, bla bla bla and bla bla bla  
bla bla bla , bla bla bla , bla bla bla and bla bla bla  
bla bla bla ,bla bla bla ,bla bla bla and bla bla bla

* * *

Now the difficult part for me is to:

converts this:

bla bla bla and bla bla bla and bla bla bla and bla bla bla

to this:

bla bla bla, bla bla bla, bla bla bla and bla bla bla

I don't care if the comma is at left, center or right because i am fixing it later.

---

<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 27, 2022, 12:28pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/2 "2022-03-27T12:28:08Z")

</div>

You could try:  
`$regexp($replace('bla bla bla and bla bla bla and bla bla bla and bla bla bla', and ,', '),'(.*), (.*)','$1 and $2')`

---

<div class="post-metadata">

**Author:** ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)\
**Post date:** [March 27, 2022, 12:44pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/3 "2022-03-27T12:44:33Z")

</div>

This example:

bla bla bla and bla bla bla and bla bla bla and bla bla bla

it is not always the same.  
It could be:

bla (bla) bla and bla b'la and Ba bla blabla

and all kinds of artist names.

---

<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 27, 2022, 12:46pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/4 "2022-03-27T12:46:14Z")

</div>

> [@Stem75](#):
>
> and all kinds of artist names.

then replace the string constant with the "bla"s with the field variable.

---

<div class="post-metadata">

**Author:** ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)\
**Post date:** [March 27, 2022, 12:51pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/5 "2022-03-27T12:51:25Z")

</div>

And you mean?

The bla isn't a constant if i understand it right.

Is a quick example. It could be michael, Cowboy ... any variation of a name.

---

<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 27, 2022, 12:52pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/6 "2022-03-27T12:52:20Z")

</div>

> [@ohrenkino](#):
>
> `$regexp($replace('bla bla bla and bla bla bla and bla bla bla and bla bla bla', and ,', '),'(.*), (.*)','$1 and $2')`

-\>  
`$regexp($replace(%artist%, and ,', '),'(.*), (.*)','$1 and $2')`

---

<div class="post-metadata">

**Author:** ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)\
**Post date:** [March 27, 2022, 12:59pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/7 "2022-03-27T12:59:04Z")

</div>

Sorry for the question but i am not used to work your way.  
where you add this?  
In format value, Replace with regular expression or filter.

---

<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 27, 2022, 1:00pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/8 "2022-03-27T13:00:19Z")

</div>

It's either Converter\>Tag-Tag or an action of the type "Format value" for ARTIST

---

<div class="post-metadata">

**Author:** ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)\
**Post date:** [March 27, 2022, 1:16pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/9 "2022-03-27T13:16:33Z")

</div>

INTERESTING!!!

If i am not asking to much can you explain how it works as a mini tut. Or is it in the help?

Thank you.

---

<div class="post-metadata">

**Author:** ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)\
**Post date:** [March 27, 2022, 1:24pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/10 "2022-03-27T13:24:02Z")

</div>

Well i found it in help $regexp(x,expr,repl) but i can't understand how you keep only the one and with this '$1 and $2'

---

<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 27, 2022, 1:24pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/11 "2022-03-27T13:24:08Z")

</div>

> [@Stem75](#):
>
> Or is it in the help?

In a way: yes.  
The idea was to get all the "and"s into a comma - which is done with the $replace() function.  
The result is then treated by the regular expression where a comma is replaced with an "and". Due to the greadiness of the `(.*)` repeater, only the last comma gets replaced. Done.

---

<div class="post-metadata">

**Author:** ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)\
**Post date:** [March 27, 2022, 1:26pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/12 "2022-03-27T13:26:34Z")

</div>

Ah!  
Yes now i got it.  
Thank you again. Very helpful.

---

<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 27, 2022, 1:28pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/13 "2022-03-27T13:28:01Z")

</div>

Just one extra thing:  
I prefer to use the scripting function over the action for regular expressions as the scripting function can be tested in Converter\>Tag-Tag which has a preview.

---

<div class="post-metadata">

**Author:** ![Stem75](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stem75/32/5007_2.png) [@Stem75](https://community.mp3tag.de/u/Stem75)\
**Post date:** [March 27, 2022, 1:35pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/14 "2022-03-27T13:35:37Z")

</div>

Good point. I'll try it out.

---

<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:29pm UTC](https://community.mp3tag.de/t/artist-tag-replace-multiple-and-with-commas-and-and/56833/15 "2026-02-09T12:29:43Z")

</div>


