# Spaces before - and after

**URL:** <https://community.mp3tag.de/t/spaces-before-and-after/49482>\
**Category:** Support\
**Created:** [June 29, 2020, 2:51pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482 "2020-06-29T14:51:04Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![cornelcri](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/f19dbf/32.png) [@cornelcri](https://community.mp3tag.de/u/cornelcri)\
**Post date:** [June 29, 2020, 2:51pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/1 "2020-06-29T14:51:04Z")

</div>

Hi how can I remove spaces before - and after

 ![Untitled](https://community.mp3tag.de/uploads/default/original/2X/4/40fc911d2f68075568170758be475c9264f8a9db.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:** [June 29, 2020, 3:10pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/2 "2020-06-29T15:10:26Z")

</div>

As MP3tag is a tagging program: my advice is fill the tags with Convert\>Filename-Tag, then rename the files with Convert\>Tag-Filename in a way you like, with or without spaces and hyphens.

Then there is an action of the type "Replace" with which you can replace one text constant (blank hyphen blank) with another (just hyphen).

---

<div class="post-metadata">

**Author:** ![cornelcri](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/f19dbf/32.png) [@cornelcri](https://community.mp3tag.de/u/cornelcri)\
**Post date:** [June 29, 2020, 3:24pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/3 "2020-06-29T15:24:06Z")

</div>

I understand but there s no code to remove that spaces in filename I have 1000 tracks to rename

---

<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:** [June 29, 2020, 3:26pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/4 "2020-06-29T15:26:06Z")

</div>

What about the attempts to import the data from the filenames into the tags first?  
In Convert\>Filename-Tag something like  
%artist% - %title%  
should lead to a lot of imported data.

You could try Convert\>Filename-Filename with  
Source mask: %1 - %2  
Target mask: %1-%2

---

<div class="post-metadata">

**Author:** ![cornelcri](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/f19dbf/32.png) [@cornelcri](https://community.mp3tag.de/u/cornelcri)\
**Post date:** [June 29, 2020, 3:36pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/5 "2020-06-29T15:36:38Z")

</div>

I want to rename like this  
Florin Salam & Mr. Juve - De - ar avea inima glas  
to Florin Salam & Mr. Juve - De-ar avea inima glas

---

<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:** [June 29, 2020, 3:40pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/6 "2020-06-29T15:40:14Z")

</div>

Then you need a different pattern:  
Source: %1 - %2 - %3  
New: %1 - %2-%3

---

<div class="post-metadata">

**Author:** ![cornelcri](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/f19dbf/32.png) [@cornelcri](https://community.mp3tag.de/u/cornelcri)\
**Post date:** [June 29, 2020, 3:42pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/7 "2020-06-29T15:42:45Z")

</div>

Looks good but If somebody have a code there will be perfect... 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:** [June 29, 2020, 3:43pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/8 "2020-06-29T15:43:24Z")

</div>

What do you mean by

> [@cornelcri](#):
>
> code

?

---

<div class="post-metadata">

**Author:** ![cornelcri](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/f19dbf/32.png) [@cornelcri](https://community.mp3tag.de/u/cornelcri)\
**Post date:** [June 29, 2020, 3:46pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/9 "2020-06-29T15:46:10Z")

</div>

for example Regular Expression 😃 of Format Value ....

---

<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:** [June 29, 2020, 3:55pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/10 "2020-06-29T15:55:02Z")

</div>

If you dealt with structured information in tag fields instead of the amorphous string of a filename, everything would have been easier. You chose to reject this kind of procedure.  
And then - as I wrote earlier - if you replace one string constant with another you don't need a regular expression, it is just a simple "replace".  
Then I wonder how often a file needs to be renamed - do you really need an action? Or isn't a one-off with a preview much more suitable?  
I have the impression that an expression with %1, %2 looks a lot like code.

---

<div class="post-metadata">

**Author:** ![cornelcri](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/f19dbf/32.png) [@cornelcri](https://community.mp3tag.de/u/cornelcri)\
**Post date:** [June 29, 2020, 3:57pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/11 "2020-06-29T15:57:27Z")

</div>

I apologize .... I work more with regular expressions. I hope you do not mind 😇 😇

---

<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:** [June 29, 2020, 4:08pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/12 "2020-06-29T16:08:03Z")

</div>

If you look closely then you will recognize that the %1 etc... variables resemble a lot the $1... of regular expressions. I bet that you will be able to map the filename-filename patterns to a regular expression.

---

<div class="post-metadata">

**Author:** ![cornelcri](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/f19dbf/32.png) [@cornelcri](https://community.mp3tag.de/u/cornelcri)\
**Post date:** [June 29, 2020, 5:18pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/13 "2020-06-29T17:18:42Z")

</div>

How can I create a action for Filename Filename ?

---

<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:** [June 29, 2020, 5:23pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/14 "2020-06-29T17:23:44Z")

</div>

Not at all.  
You would need an equivalent in the shape of an action of the type "Replace with regular expression" or "Format value" with a scripting function or an action of the type "Replace", all for the pseudo-field \_FILENAME.  
The disadvantage is that you don't get a preview.  
As you can see, there is more than one way that leads to Rome.

---

<div class="post-metadata">

**Author:** ![cornelcri](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/f19dbf/32.png) [@cornelcri](https://community.mp3tag.de/u/cornelcri)\
**Post date:** [June 29, 2020, 5:38pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/15 "2020-06-29T17:38:51Z")

</div>

For example I try to make a action for this how can I?

 ![Untitled](https://community.mp3tag.de/uploads/default/original/2X/9/90b15bb09537416f36136e9cbddc61fcea014d7e.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:** [June 29, 2020, 6:12pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/16 "2020-06-29T18:12:54Z")

</div>

I still don't understand why you refuse to import data into the tag fields.  
Handling data in tag fields is easier as you do not have to separate the individual parts but can manipulate them directly.

---

<div class="post-metadata">

**Author:** ![cornelcri](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/f19dbf/32.png) [@cornelcri](https://community.mp3tag.de/u/cornelcri)\
**Post date:** [June 29, 2020, 6:46pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/17 "2020-06-29T18:46:25Z")

</div>

I tried to replace % with $ but doesnt work

---

<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:** [June 29, 2020, 6:53pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/18 "2020-06-29T18:53:00Z")

</div>

Of course it does not work.  
I am getting bored with this to and fro where I see not progress in respect to tagging. We are still in the state of fumbling the filename. For this purpose, I bet, there are numerous tools around to rename files.  
So perhaps someone else in the forum helps you.  
Or come back once you start tagging and not rename files.

---

<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:28pm UTC](https://community.mp3tag.de/t/spaces-before-and-after/49482/19 "2026-02-09T12:28:41Z")

</div>


