# Action Definition Question replace first comma with feat

**URL:** https://community.mp3tag.de/t/action-definition-question-replace-first-comma-with-feat/61534
**Category:** Mac
**Created:** [July 13, 2023, 5:28am UTC](https://community.mp3tag.de/t/action-definition-question-replace-first-comma-with-feat/61534 "2023-07-13T05:28:28Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![djquartz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djquartz/32/12233_2.png) [@djquartz](https://community.mp3tag.de/u/djquartz)
#### Post date: [July 13, 2023, 5:28am UTC](https://community.mp3tag.de/t/action-definition-question-replace-first-comma-with-feat/61534/1 "2023-07-13T05:28:28Z")

</div>

This is going to sound like a weird one, but I'm not sure how to fix this one.

I have an action that I use both in Mac and Windows versions called,

'Comma replace with feat.'

What is does is find a comma followed by a space and replaces it with feat.

It works but it replaces all instances of this.

So I have to manually go and replace second and third instances with ,

I'm trying to emulate the function from from my old tagger because it would only replace the first found instance in every filename and tag and leave the rest.

I'm not sure how it did it but it would leave the rest alone unless I ran find/replace again, and so on.

Is there a way I could make it ignore the rest and just replace the first instance found?

These are the current rules,

![image](https://community.mp3tag.de/uploads/default/original/2X/3/3869bfa325a73ffef0c1505b9d089648dbeddf4b.png)

---

<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: [July 13, 2023, 5:32am UTC](https://community.mp3tag.de/t/action-definition-question-replace-first-comma-with-feat/61534/2 "2023-07-13T05:32:59Z")

</div>

Try something like  
`$regexp('Earth, Wind, Fire','(.*?), (.*)',$1 feat. $2)`

You would have to take care that it really makes sense to replace the comma with "feat."  
In my example, the original name would be "Earth, Wind & Fire" and even "Earth feat. Wind & Fire" would not be correct.  
There are some more examples:  
Bell, Book & Candle  
Emerson, Lake & Palmer  
Dave Dee, Dozy, Beaky, Mick & Titch  
Blood, Sweat & Tears  
Crosby, Stills, Nash & Young  
Choir of the New Church, Oxford  
Daniel Barenboim; Orchestre de Paris; Michel Debost  
Eins, Zwo  
Ellis, Beggs & Howard  
I Will, I Swear  
Pretentious, Moi?  
Robbi, Tobbi und das Fliewatüüt  
Stock, Aitken & Waterman  
Up, Bustle & Out

---

<div class="post-metadata">

### Author: ![djquartz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djquartz/32/12233_2.png) [@djquartz](https://community.mp3tag.de/u/djquartz)
#### Post date: [July 13, 2023, 6:06am UTC](https://community.mp3tag.de/t/action-definition-question-replace-first-comma-with-feat/61534/3 "2023-07-13T06:06:23Z")

</div>

Yes agreed, but the tracks I work with aren't setup in that way.

That's why I can do a mass replace and it worked in the past.

---

<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: [July 13, 2023, 6:19am UTC](https://community.mp3tag.de/t/action-definition-question-replace-first-comma-with-feat/61534/4 "2023-07-13T06:19:46Z")

</div>

Does my suggestion work?

---

<div class="post-metadata">

### Author: ![djquartz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djquartz/32/12233_2.png) [@djquartz](https://community.mp3tag.de/u/djquartz)
#### Post date: [July 13, 2023, 6:24am UTC](https://community.mp3tag.de/t/action-definition-question-replace-first-comma-with-feat/61534/5 "2023-07-13T06:24:09Z")

</div>

I haven't tried it yet,

But keep in mind with the rules I'm using. It does replace the , with feat.

However, it replaces all of them. So I'm not sure if you can stop it from replacing all of them it finds.

---

<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: [July 13, 2023, 6:29am UTC](https://community.mp3tag.de/t/action-definition-question-replace-first-comma-with-feat/61534/6 "2023-07-13T06:29:08Z")

</div>

Please note that you either have to use an action of the type "Replace with regular expression" and  
Search string: `(.*?), (.*)`  
Replace string: `$1 feat. $2`

or an action of the type "Format tag field" for ARTIST  
Format string: `$regexp(%artist%,'(.*?), (.*)',$1 feat. $2)`

I cannot reproduce your claim that a simple replace only replaces the first occurrance of a string.

---

<div class="post-metadata">

### Author: ![djquartz](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djquartz/32/12233_2.png) [@djquartz](https://community.mp3tag.de/u/djquartz)
#### Post date: [July 13, 2023, 5:51pm UTC](https://community.mp3tag.de/t/action-definition-question-replace-first-comma-with-feat/61534/7 "2023-07-13T17:51:09Z")

</div>

I will investigate it further. Thanks

---

<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: [August 12, 2023, 5:51pm UTC](https://community.mp3tag.de/t/action-definition-question-replace-first-comma-with-feat/61534/8 "2023-08-12T17:51:36Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
