# Replace hyphen with en-dash only after 4-digit years

**URL:** <https://community.mp3tag.de/t/replace-hyphen-with-en-dash-only-after-4-digit-years/50381>\
**Category:** Support\
**Created:** [October 6, 2020, 12:17am UTC](https://community.mp3tag.de/t/replace-hyphen-with-en-dash-only-after-4-digit-years/50381 "2020-10-06T00:17:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![KHS](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@KHS](https://community.mp3tag.de/u/KHS)\
**Post date:** [October 6, 2020, 12:17am UTC](https://community.mp3tag.de/t/replace-hyphen-with-en-dash-only-after-4-digit-years/50381/1 "2020-10-06T00:17:56Z")

</div>

In Composer, Lyricist, and Conductor fields, I format all names as, e.g.:  
Joe Jones (German 1901-1990)  
and sometimes have more than one separated by & or by \ or by | [don't ask--my point there is only that it may need to perform more than one replacement per field

I want to replace all THOSE hyphens (but NO OTHERS) with an en-dash (Alt-0150).

I'm new to the Replace action and to the Replace With Regular Expression action.

I'm willing to have the search part simply look for 4 digits followed by a hyphen and replace that with the same 4 digits followed by "–" (Alt-0150). That would isolate the only hyphens I want to replace.

What's my best method? [I'm also new to this Forum and I did spend an hour or more in the help system and on this Forum before posting]

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:** [October 6, 2020, 4:26am UTC](https://community.mp3tag.de/t/replace-hyphen-with-en-dash-only-after-4-digit-years/50381/2 "2020-10-06T04:26:27Z")

</div>

Try an action of the type "Replace with regular expression"  
Search string: `(\d{4})-`  
Replace string: `$1–`

---

<div class="post-metadata">

**Author:** ![KHS](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@KHS](https://community.mp3tag.de/u/KHS)\
**Post date:** [October 6, 2020, 10:39pm UTC](https://community.mp3tag.de/t/replace-hyphen-with-en-dash-only-after-4-digit-years/50381/3 "2020-10-06T22:39:56Z")

</div>

> [@ohrenkino](#):
>
> (\d{4})-

Thanks! Works great! What resource should I have gone to first to get this fairly simple solution?

---

<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 7, 2020, 4:40am UTC](https://community.mp3tag.de/t/replace-hyphen-with-en-dash-only-after-4-digit-years/50381/4 "2020-10-07T04:40:53Z")

</div>

Perhaps the help?

> **[Replace with Regular Expression – Mp3tag Documentation](https://docs.mp3tag.de/actions/replace-regexp/)**
>
> Documentation on the Replace with Regular Expression action type that can be performed as Quick Action or as reusable workflow from Action Groups. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

**Author:** ![KHS](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@KHS](https://community.mp3tag.de/u/KHS)\
**Post date:** [October 7, 2020, 5:41pm UTC](https://community.mp3tag.de/t/replace-hyphen-with-en-dash-only-after-4-digit-years/50381/5 "2020-10-07T17:41:04Z")

</div>

Very funny! Trust me, I was there for a long time and tried many unsuccessful trial-and-errors before I posted. EXAMPLES would be VERY helpful to that Help section!

---

<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 7, 2020, 6:03pm UTC](https://community.mp3tag.de/t/replace-hyphen-with-en-dash-only-after-4-digit-years/50381/6 "2020-10-07T18:03:26Z")

</div>

The examples can be found here in the forum, e.g. here:

> [@Help with an action to change two-digit years to four-digit years](https://community.mp3tag.de/t/help-with-an-action-to-change-two-digit-years-to-four-digit-years/18640):
>
> Can anyone help me with an action that will look at the year, determine if it's four or two digits, and if it's two digits, prepend "19" to those digits. I need four digit years to remain in place unaltered. I figured out how to write the year to a custom field, prepend the "19" and then write that back to the year field. That doesn't work because my four digit years wind up being six digit years such as "192017". Any help is appreciated.

I found this thread with the search words "digit year".

---

<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:** [December 2, 2025, 2:48am UTC](https://community.mp3tag.de/t/replace-hyphen-with-en-dash-only-after-4-digit-years/50381/7 "2025-12-02T02:48:51Z")

</div>

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