# Regex to export valid filenames

**URL:** https://community.mp3tag.de/t/regex-to-export-valid-filenames/4745
**Category:** Support
**Created:** [April 15, 2007, 3:02am UTC](https://community.mp3tag.de/t/regex-to-export-valid-filenames/4745 "2007-04-15T03:02:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lbardh](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@lbardh](https://community.mp3tag.de/u/lbardh)
#### Post date: [April 15, 2007, 3:02am UTC](https://community.mp3tag.de/t/regex-to-export-valid-filenames/4745/1 "2007-04-15T03:02:10Z")

</div>

Hi, I'm fairly new to using regex in mp3tag.

I'm trying to bulk export the cover art to all of my albums to directory using the 'quick action' -\> 'export cover to file' 'c:\Covers\%artist%-%album%'

This works great unless there are special characters in the album name (i.e. : or \ etc.).

What regex expression can I use to remove (or replace) any instance of a non-alphanumeric character in the album name? I need to do this without retagging the original files?

I'd like to replace %album% = 'Star Wars - Episode 1: The Phantom Menace'  
with 'Star Wars - Episode 1 The Phantom Menace'  
or 'Star Wars - Episode 1- The Phantom Menace'

Thanks

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 15, 2007, 8:00am UTC](https://community.mp3tag.de/t/regex-to-export-valid-filenames/4745/2 "2007-04-15T08:00:03Z")

</div>

$replace(%album%,:,,,)  
or  
$replace(%album%,:,-,,-)

! This syntax only works since 2.37i

[https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)

---

<div class="post-metadata">

### Author: ![lbardh](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@lbardh](https://community.mp3tag.de/u/lbardh)
#### Post date: [April 15, 2007, 11:56am UTC](https://community.mp3tag.de/t/regex-to-export-valid-filenames/4745/3 "2007-04-15T11:56:45Z")

</div>

Thank a lot. That worked great. I must have overlooked the scripting page.

I found what will eliminate all invalid characters is:  
$validate(%artist% - %album%,-)

---

<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:20pm UTC](https://community.mp3tag.de/t/regex-to-export-valid-filenames/4745/4 "2026-02-09T12:20:15Z")

</div>


