# Help with a regular expression action to replace & with 'and'

**URL:** <https://community.mp3tag.de/t/help-with-a-regular-expression-action-to-replace-with-and/58718>\
**Category:** Support\
**Created:** [October 8, 2022, 6:00am UTC](https://community.mp3tag.de/t/help-with-a-regular-expression-action-to-replace-with-and/58718 "2022-10-08T06:00:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdog](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d07c76/32.png) [@tdog](https://community.mp3tag.de/u/tdog)\
**Post date:** [October 8, 2022, 6:00am UTC](https://community.mp3tag.de/t/help-with-a-regular-expression-action-to-replace-with-and/58718/1 "2022-10-08T06:00:24Z")

</div>

I need to create an action that will replace the "&" sign with "And" only when & is the first word in either the title or the artist.

I read the regular expression help but I can't say I understood much 🙂

---

<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:** [October 8, 2022, 6:47am UTC](https://community.mp3tag.de/t/help-with-a-regular-expression-action-to-replace-with-and/58718/2 "2022-10-08T06:47:16Z")

</div>

Could you give a real example of text in which you want to have it replaced an where you don't?  
An action of the type "Format value" for ARTIST and  
Format string: `$regexp(%artist%,'^\&',And)`  
may work - but I hardly know any Artist that starts with &

---

<div class="post-metadata">

**Author:** ![tdog](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d07c76/32.png) [@tdog](https://community.mp3tag.de/u/tdog)\
**Post date:** [October 8, 2022, 7:02am UTC](https://community.mp3tag.de/t/help-with-a-regular-expression-action-to-replace-with-and/58718/3 "2022-10-08T07:02:57Z")

</div>

Your fellow Germans "And One" is the perfect example.  
I think I may have just figured it out.  
Field: ALL  
RegExp: ^&\s+  
Replace with: And

Seems to have worked for me.  
I may have found a small glitch. I created an action called Replace & with And. The action display shows "\_" instead of the "&" under Actions. It displays correctly under Action Groups.

---

<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:** [October 8, 2022, 7:06am UTC](https://community.mp3tag.de/t/help-with-a-regular-expression-action-to-replace-with-and/58718/4 "2022-10-08T07:06:14Z")

</div>

> [@tdog](#):
>
> I may have found a small glitch.

No glitch, a feature.  
The & is used to markup keyboard shortcuts.  
See the documentation on actions:

> **[Actions – Mp3tag Documentation](https://docs.mp3tag.de/actions/)**
>
> Documentation on Quick Actions and Action Groups that covers replace text, case conversion, tag to tag conversion, duplicate field handling, batch cover import/export, and more. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

**Author:** ![tdog](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d07c76/32.png) [@tdog](https://community.mp3tag.de/u/tdog)\
**Post date:** [October 8, 2022, 7:16am UTC](https://community.mp3tag.de/t/help-with-a-regular-expression-action-to-replace-with-and/58718/5 "2022-10-08T07:16:27Z")

</div>

Thanks, I read it, can't say I understand. Coding is not my strong side, sorry.

---

<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:** [October 8, 2022, 7:18am UTC](https://community.mp3tag.de/t/help-with-a-regular-expression-action-to-replace-with-and/58718/6 "2022-10-08T07:18:00Z")

</div>

I was referring to the section on how to create keyboard shortcuts with the ampersand.

---

<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:** [October 9, 2022, 8:35am UTC](https://community.mp3tag.de/t/help-with-a-regular-expression-action-to-replace-with-and/58718/7 "2022-10-09T08:35:35Z")

</div>

16 posts were split to a new topic: [Moving "feat." from title to artist](https://community.mp3tag.de/t/moving-feat-from-title-to-artist/58744)

---

<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:** [November 8, 2022, 8:35am UTC](https://community.mp3tag.de/t/help-with-a-regular-expression-action-to-replace-with-and/58718/8 "2022-11-08T08:35:50Z")

</div>

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