# Replace blanks with underscores

**URL:** https://community.mp3tag.de/t/replace-blanks-with-underscores/7469
**Category:** Support
**Created:** [November 13, 2008, 3:06pm UTC](https://community.mp3tag.de/t/replace-blanks-with-underscores/7469 "2008-11-13T15:06:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Messcalin](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/41988e/32.png) [@Messcalin](https://community.mp3tag.de/u/Messcalin)
#### Post date: [November 13, 2008, 3:06pm UTC](https://community.mp3tag.de/t/replace-blanks-with-underscores/7469/1 "2008-11-13T15:06:06Z")

</div>

Hi guys,

I am not really familiar with regular expressions and I need someones help in this case.

example:  
Folder: The Beach Boys - Super Album  
Filename: The Beach Boys - First Track.mp3

Output should be  
Folder: The\_Beach\_Boys\_-_Super\_Album  
Filename: 01-The\_Beach\_Boys_-\_First\_Track.mp3

I can achieve most of it with this Rename Tag to Filename line

%artist%_-_%album%\%track%-%artist%_-_%title%

But I need help with the "blank -\> underscore" replacement which should apply to the complete string.

Thanks in advance.  
Andy

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [November 13, 2008, 4:17pm UTC](https://community.mp3tag.de/t/replace-blanks-with-underscores/7469/2 "2008-11-13T16:17:50Z")

</div>

See section 'Replace' on [https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)

DD.20081113.1817.CET

---

<div class="post-metadata">

### Author: ![Messcalin](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/41988e/32.png) [@Messcalin](https://community.mp3tag.de/u/Messcalin)
#### Post date: [November 13, 2008, 9:14pm UTC](https://community.mp3tag.de/t/replace-blanks-with-underscores/7469/3 "2008-11-13T21:14:42Z")

</div>

Thanks very much...works perfectly

$replace(%artist%_-_%album%\%track%-%artist%_-_%title%, ,\_)

---

<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:21pm UTC](https://community.mp3tag.de/t/replace-blanks-with-underscores/7469/4 "2026-02-09T12:21:12Z")

</div>


