# Change the space to hypen in filename

**URL:** https://community.mp3tag.de/t/change-the-space-to-hypen-in-filename/69573
**Category:** Support
**Created:** [August 30, 2025, 10:22am UTC](https://community.mp3tag.de/t/change-the-space-to-hypen-in-filename/69573 "2025-08-30T10:22:22Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mamyllyn](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/71c47a/32.png) [@mamyllyn](https://community.mp3tag.de/u/mamyllyn)
#### Post date: [August 30, 2025, 10:22am UTC](https://community.mp3tag.de/t/change-the-space-to-hypen-in-filename/69573/1 "2025-08-30T10:22:22Z")

</div>

I think that this might be a basic question but wonder what is the easiest way to do it:  
I have filename that is in format: 01 W.A.S.P. and I want to add a hypen JUST to replace this empty space.

So the right filename should be: 01 - W.A.S.P.

What is the easiest function to do this?

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [August 30, 2025, 10:25am UTC](https://community.mp3tag.de/t/change-the-space-to-hypen-in-filename/69573/2 "2025-08-30T10:25:19Z")

</div>

> [@mamyllyn](#):
>
> What is the easiest function to do this?

Use an Action "[Replace](https://docs.mp3tag.de/actions/replace/)"  
or  
Use the Convert Tag -\> Tag for \_FILENAME with `$replace`

---

<div class="post-metadata">

### Author: ![mamyllyn](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/71c47a/32.png) [@mamyllyn](https://community.mp3tag.de/u/mamyllyn)
#### Post date: [August 30, 2025, 10:28am UTC](https://community.mp3tag.de/t/change-the-space-to-hypen-in-filename/69573/3 "2025-08-30T10:28:38Z")

</div>

Thank you for the fast answer.  
Before adding my question here I did try to make it with the replace function.

The problem is that is adds the hypen then on every space and I do not know how to limit it only to the first instance. I have some kind of feeling that I have found that function ages ago.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [August 30, 2025, 10:34am UTC](https://community.mp3tag.de/t/change-the-space-to-hypen-in-filename/69573/4 "2025-08-30T10:34:40Z")

</div>

To only replace the first space between the tracknumber and the title in the filename:

Convert Tag - Tag  
Field: \_FILENAME  
Format string:  
`$regexp(%_FILENAME%,(\d+)\s(.*),$1 - $2)`  
Would convert  
`01 W.A.S.P. and other titles.mp3`  
to  
`01 - W.A.S.P. and other titles.mp3`

Or with an Action "Replace with regular expression":  
Field: \_FILENAME  
Regular expression:  
`(\d+)\s(.*)`  
Replace matches with:  
`$1 - $2`

 ![image](https://community.mp3tag.de/uploads/default/original/3X/f/5/f5259996d5d4ef19c70584b2a47639f56fc8115c.png)

> [@mamyllyn](#):
>
> The problem is that is adds the hypen then on every space and I do not know how to limit it only to the first instance

Please include this information in future questions, providing examples that demonstrate this requirement.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [August 30, 2025, 10:44am UTC](https://community.mp3tag.de/t/change-the-space-to-hypen-in-filename/69573/5 "2025-08-30T10:44:42Z")

</div>

> [@mamyllyn](#):
>
> What is the easiest function to do this?

BTW:  
Assuming that you have filled your fields already as mentioned [here](https://community.mp3tag.de/t/add-hyphen-in-filename-for-all-tracks/69346/3), you could also rebuild your filename with the content of your fields like this:  
Convert Tag - Filename:  
`%track% - %title%`

 ![image](https://community.mp3tag.de/uploads/default/original/3X/b/e/bec18c2d4e1bb2a3b1dc0d4b49d039022b6d5863.png)

---

<div class="post-metadata">

### Author: ![mamyllyn](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/71c47a/32.png) [@mamyllyn](https://community.mp3tag.de/u/mamyllyn)
#### Post date: [August 30, 2025, 11:05am UTC](https://community.mp3tag.de/t/change-the-space-to-hypen-in-filename/69573/6 "2025-08-30T11:05:09Z")

</div>

Thank you a lot and I will try with these methods!

The “convert Tag - Tag” hint worked like a charm and I will use this one in the future as well.

---

<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: [September 29, 2025, 11:06am UTC](https://community.mp3tag.de/t/change-the-space-to-hypen-in-filename/69573/7 "2025-09-29T11:06:03Z")

</div>

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