# How to remove from file name all characters that are out from a set

**URL:** https://community.mp3tag.de/t/how-to-remove-from-file-name-all-characters-that-are-out-from-a-set/12886
**Category:** Support
**Created:** [December 31, 2011, 2:22pm UTC](https://community.mp3tag.de/t/how-to-remove-from-file-name-all-characters-that-are-out-from-a-set/12886 "2011-12-31T14:22:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![walkman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/b487fb/32.png) [@walkman](https://community.mp3tag.de/u/walkman)
#### Post date: [December 31, 2011, 2:22pm UTC](https://community.mp3tag.de/t/how-to-remove-from-file-name-all-characters-that-are-out-from-a-set/12886/1 "2011-12-31T14:22:40Z")

</div>

Hi all.

I need help about Regular Expression. I've already read the FAQ and other topics about this argument without resolve my problem.

My target is remove from the file name all characters that are different from letters, numbers and some others characters. I really made many attempts without find the solution before open this thread.

Can someone help me?

Thanks in advance.

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [December 31, 2011, 2:56pm UTC](https://community.mp3tag.de/t/how-to-remove-from-file-name-all-characters-that-are-out-from-a-set/12886/2 "2011-12-31T14:56:59Z")

</div>

_Action type:_ **Replace with regular expression**  
_Field:_ **\_FILENAME**  
_Regular expression:_ **[^A-Za-z0-9 '.]**  
_Replace matches with:_   
[] _case-sensitive comparison_

This preserves all letters, digits and spaces, plus the chracters ' (single quote) and . (period). The "hat" (^) means any character _not_ included inside the brackets, so what you're doing is listing all the characters that you want to keep. Just add any additional characters that you like. Note that some special characters (like the period shown in the expression above) require escaping - that is, precede the character with a backslash (). Those special characters are . | \* ? + ( ) { } [] ^ $.

---

<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: [December 31, 2011, 3:46pm UTC](https://community.mp3tag.de/t/how-to-remove-from-file-name-all-characters-that-are-out-from-a-set/12886/3 "2011-12-31T15:46:52Z")

</div>

> [@walkman](#):
>
> ... My target is remove from the file name all characters that are different from letters, numbers and some others characters. ...

Start with this ...

Action: Format value  
Field: \_FILENAME  
Formatstring: $regexp(%\_filename%,'[^\w]',)

From:  
24#96 Vinyl Rip - aksman 2011 - 1999 Speakers Corner SP-3647 - DG 2513725  
To:  
2496VinylRipaksman20111999SpeakersCornerSP3647DG2513725

... then add 'some other characters' into the negated set (square brackets) to exclude them from removing.

Action: Format value  
Field: \_FILENAME  
Formatstring: $regexp(%\_filename%,'[^\w-]',)

From:  
24#96 Vinyl Rip - aksman 2011 - 1999 Speakers Corner SP-3647 - DG 2513725  
To:  
2496VinylRip-aksman2011-1999SpeakersCornerSP-3647-DG2513725

FYI:  
\w represents the character class [[:word:]]  
\W represents the character class [\[1\]]

DD.20111230.1748.CET

* * *

1. :word:

---

<div class="post-metadata">

### Author: ![walkman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/b487fb/32.png) [@walkman](https://community.mp3tag.de/u/walkman)
#### Post date: [December 31, 2011, 4:06pm UTC](https://community.mp3tag.de/t/how-to-remove-from-file-name-all-characters-that-are-out-from-a-set/12886/4 "2011-12-31T16:06:44Z")

</div>

It was very simple. Evidently, i'm not so intelligent. ![:huh:](https://community.mp3tag.de/uploads/default/original/1X/f15ee73c0fd9ec3b0db7481f0558638f8ee224ce.gif ":huh:")

Many thanks, people, and Happy New 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: [February 9, 2026, 12:23pm UTC](https://community.mp3tag.de/t/how-to-remove-from-file-name-all-characters-that-are-out-from-a-set/12886/5 "2026-02-09T12:23:33Z")

</div>


