# File rename using regex

**URL:** <https://community.mp3tag.de/t/file-rename-using-regex/17482>\
**Category:** Support\
**Created:** [December 21, 2015, 4:09pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482 "2015-12-21T16:09:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![midhun](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/c57346/32.png) [@midhun](https://community.mp3tag.de/u/midhun)\
**Post date:** [December 21, 2015, 4:09pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482/1 "2015-12-21T16:09:27Z")

</div>

hello, please assist in renaming my mp3 file names.

for the below filename  
14. Cant Believe It Feat. Lil Wayne - The Usual Suspects, T-Pain & Akon.mp3

i would like to change it to  
Cant Believe It Feat. Lil Wayne - The Usual Suspects, T-Pain & Akon.mp3

i am trying to use this ^\s\*\d+.?\s\*-\s\* but its not working.

Also please provide me a regex for removing one or more "." dots from the filename without affecting the file type.

Any help would be highly appreciated.

---

<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:** [December 21, 2015, 4:26pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482/2 "2015-12-21T16:26:47Z")

</div>

Why not "Replace with regular expression" for \_FILENAME  
Search string: ^\d+.\s  
Replace:  
(leave empty)

---

<div class="post-metadata">

**Author:** ![midhun](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/c57346/32.png) [@midhun](https://community.mp3tag.de/u/midhun)\
**Post date:** [December 21, 2015, 4:38pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482/3 "2015-12-21T16:38:37Z")

</div>

![:rolleyes:](https://community.mp3tag.de/uploads/default/original/1X/3a79e8b0b7d169b30216785521d7c6f4f895c421.gif ":rolleyes:")

thanks a lot. would you please tell me why ^\s\*\d+.?\s\*-\s\* didnt work for that file name. I am a newbie to regex so could you please tell me where i went wrong.

---

<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 21, 2015, 4:39pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482/4 "2015-12-21T16:39:43Z")

</div>

> [@midhun](#):
>
> hello, please assist in renaming my mp3 file names. ...

**Formatstring: $trimLeft(%\_filename%,'0123456789. ') ... or ... Formatstring: $regexp(%\_filename%,'^[\d\s.]\*',) From: '14. Cant Believe It Feat. Lil Wayne - The Usual Suspects, T-Pain & Akon.mp3' To : 'Cant Believe It Feat. Lil Wayne - The Usual Suspects, T-Pain & Akon.mp3'**

DD.20151221.1839.CET

---

<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 21, 2015, 4:53pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482/5 "2015-12-21T16:53:56Z")

</div>

> [@midhun](#):
>
> ... please provide me a regex for removing one or more "." dots from the filename without affecting the file type. ...

**Convert "Tag - Tag" ... or ... Action "Format value" Field: \_FILENAME Formatstring: $replace(%\_filename%,'.',) From: '... and then there were three ... .mp3' To : ' and then there were three .mp3' ... or ... Convert "Tag - Tag" ... or ... Action "Format value" Field: \_FILENAME Formatstring: $trim($replace(%\_filename%,'.',)) From: '... and then there were three ... .mp3' To : 'and then there were three.mp3' ... or ... Convert "Tag - Tag" ... or ... Action "Format value" Field: \_FILENAME Formatstring: $regexp(%\_filename%,'^[\s.]|[\s.]$',) From: '... and then there were three ... .mp3' To : 'and then there were three.mp3' ... or ... Convert "Tag - Tag" ... or ... Action "Format value" Field: \_FILENAME Formatstring: $regexp(%\_filename%,'^[\s.]\*|[\s.]\*$|\s\*\.',) From: '... and ... then ... there were three ... .mp3' To : 'and then there were three.mp3'**

DD.20151221.1911.CET

---

<div class="post-metadata">

**Author:** ![midhun](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/c57346/32.png) [@midhun](https://community.mp3tag.de/u/midhun)\
**Post date:** [December 21, 2015, 5:20pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482/6 "2015-12-21T17:20:57Z")

</div>

> [@DetlevD](#):
>
> **Convert "Tag - Tag" ... or ... Action "Format value" Field: \_FILENAME Formatstring: $replace(%\_filename%,'.',) From: '... and then there were three ... .mp3' To : ' and then there were three .mp3' ... or ... Convert "Tag - Tag" ... or ... Action "Format value" Field: \_FILENAME Formatstring: $trim($replace(%\_filename%,'.',)) From: '... and then there were three ... .mp3' To : 'and then there were three.mp3' ... or ... Convert "Tag - Tag" ... or ... Action "Format value" Field: \_FILENAME Formatstring: $regexp(%\_filename%,'^[\s.]|[\s.]$',) From: '... and then there were three ... .mp3' To : 'and then there were three.mp3' ... or ... Convert "Tag - Tag" ... or ... Action "Format value" Field: \_FILENAME Formatstring: $regexp(%\_filename%,'^[\s.]\*|[\s.]\*$|\s\*\.',) From: '... and ... then ... there were three ... .mp3' To : 'and then there were three.mp3'**
> 
> DD.20151221.1911.CET

thanks a lot DetlevD . i have read many of your posts and it has been very useful.  
Again if its not too much could you please tell me what is wrong wth the regex ^\s\*\d+.?\s\*-\s\*  
which i am planning to use for removing the spaces,numbers and hyphen in a 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:** [December 21, 2015, 5:26pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482/7 "2015-12-21T17:26:17Z")

</div>

> [@midhun](#):
>
> thanks a lot DetlevD . i have read many of your posts and it has been very useful.  
> Again if its not too much could you please tell me what is wrong wth the regex ^\s\*\d+.?\s\*-\s\*  
> which i am planning to use for removing the spaces,numbers and hyphen in a filename.

In ^\s\*\d+.?\s\*-\s\*  
you only used the repetition indicator \* bu left out what should be repeated.  
Something like  
^\s\*\d+.?\s._-\s._  
may work ...

Still: why do you mess around with the filenames if they could be rewritten much easier with the Convert\>Tag-Filename function? You do not have to shift around the character positions in unstructured string data as you use structured data from the tag fields to create the string.

---

<div class="post-metadata">

**Author:** ![midhun](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/c57346/32.png) [@midhun](https://community.mp3tag.de/u/midhun)\
**Post date:** [December 21, 2015, 5:50pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482/8 "2015-12-21T17:50:53Z")

</div>

> [@ohrenkino](#):
>
> In ^\s\*\d+.?\s\*-\s\*  
> you only used the repetition indicator \* bu left out what should be repeated.  
> Something like  
> ^\s\*\d+.?\s._-\s._  
> may work ...
> 
> Still: why do you mess around with the filenames if they could be rewritten much easier with the Convert\>Tag-Filename function? You do not have to shift around the character positions in unstructured string data as you use structured data from the tag fields to create the string.

oh thanks i didnt know that. Much appreciated.

---

<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 21, 2015, 6:02pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482/9 "2015-12-21T18:02:50Z")

</div>

> [@midhun](#):
>
> ... please tell me what is wrong wth the regex ^\s\*\d+.?\s\*-\s\*

Have a look at this example ...  
and check out whether your filenames fit to the regexp or not ...  
or otherwise why the regexp does not fit to your filenames ...

**Convert "Tag - Tag" ... or ... Action "Format value" Field: \_FILENAME Formatstring: $regexp(%\_filename%,'^\s\*\d+\.?\s\*-\s\*',) Possible filenames, which should be affected by this regexp ... '3-test.mp3' '3 - test.mp3' '3 - test.mp3' '3.-test.mp3' '3. - test.mp3' '3. - test.mp3' '13-test.mp3' '13 - test.mp3' '13 - test.mp3' '13.-test.mp3' '13. - test.mp3' '13. - test.mp3' '3-test.mp3' ' 3 - test.mp3' ' 3 - test.mp3' ' 3.-test.mp3' ' 3. - test.mp3' ' 3. - test.mp3' '13-test.mp3' ' 13 - test.mp3' ' 13 - test.mp3' '13.-test.mp3' ' 13. - test.mp3' ' 13. - test.mp3' Result filename is always ... 'test.mp3' This filename does not match ... '13. ;-) test.mp3'**

DD.20151221.2002.CET

---

<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:26pm UTC](https://community.mp3tag.de/t/file-rename-using-regex/17482/10 "2026-02-09T12:26:01Z")

</div>

Closed on February 9, 2026, 12:26pm UTC


