# RegEx Help

**URL:** https://community.mp3tag.de/t/regex-help/16155
**Category:** Support
**Created:** [September 19, 2014, 7:44am UTC](https://community.mp3tag.de/t/regex-help/16155 "2014-09-19T07:44:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Bola](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@Bola](https://community.mp3tag.de/u/Bola)
#### Post date: [September 19, 2014, 7:44am UTC](https://community.mp3tag.de/t/regex-help/16155/1 "2014-09-19T07:44:41Z")

</div>

> [@Regular Expressions](https://community.mp3tag.de/t/regular-expressions/521/1):
>
> **And the other way around**
> 
> **Move "The " to the end**
> 
> Regular expression: ^The (.+)  
> Replace with: $1, The
> 
> So "The Cure" becomes "Cure, The"  
> And "The a whole lot of words" becomes "a whole lot of words, The"

I'm trying to use this to rename Folders.

The Black Keys - Attack & Release (2008) becomes Black Keys - Attack & Release (2008), The

I could use some help to make it place the ", The" before the " -" instead of the the very end.

---

<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: [September 19, 2014, 7:51am UTC](https://community.mp3tag.de/t/regex-help/16155/2 "2014-09-19T07:51:02Z")

</div>

> [@Bola](#):
>
> I'm trying to use this to rename Folders.
> 
> The Black Keys - Attack & Release (2008) becomes Black Keys - Attack & Release (2008), The
> 
> I could use some help to make it place the ", The" before the " -" instead of the the very end.

You then would probably rename the ARTIST or ALBUMARTIST first, I hope. As fiddling with the filename is hardly ever effective.  
And then use the Convert\>Tag-Tag function for \_directory:  
%artist% - %album%

The regular expression could be:  
Search: ^The (._) - (._)  
Replace: $1, The - $2

---

<div class="post-metadata">

### Author: ![Bola](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@Bola](https://community.mp3tag.de/u/Bola)
#### Post date: [September 19, 2014, 9:09am UTC](https://community.mp3tag.de/t/regex-help/16155/3 "2014-09-19T09:09:56Z")

</div>

> [@ohrenkino](#):
>
> You then would probably rename the ARTIST or ALBUMARTIST first, I hope. As fiddling with the filename is hardly ever effective.  
> And then use the Convert\>Tag-Tag function for \_directory:  
> %artist% - %album%
> 
> The regular expression could be:  
> Search: ^The (._) - (._)  
> Replace: $1, The - $2

I didn't touch the ARTIST or ALBUMARTIST in the tags as I still want them to read with "The" in the front. I just set an Action that runs "Replace with regular expression" with "\_DIRECTORY" as the field.

Your suggestion worked flawlessly, thank you.

---

<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: [September 19, 2014, 3:22pm UTC](https://community.mp3tag.de/t/regex-help/16155/4 "2014-09-19T15:22:59Z")

</div>

> [@Bola](#):
>
> I didn't touch the ARTIST or ALBUMARTIST in the tags as I still want them to read with "The" in the front. I just set an Action that runs "Replace with regular expression" with "\_DIRECTORY" as the field.
> 
> Your suggestion worked flawlessly, thank you.

It could be that you want to write a directory name straight away without first getting the one with "the" in front and then the need to replace it with the moved "the".  
If you want to move the files to their correct location, you can use something like:  
$regexp(%artist%,'^The (.\*)','$1, The') - %album%  
This applies to actions of the type "Format value" for \_DIRECTORY or Convert\>Tag-Tag for \_DIRECTORY.  
The $regexp() performs the "Replace with regular expression" while creating the new directory name.

---

<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:25pm UTC](https://community.mp3tag.de/t/regex-help/16155/5 "2026-02-09T12:25:17Z")

</div>


