# Find a regular expression to split filename into fields

**URL:** <https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166>\
**Category:** Support\
**Created:** [December 21, 2023, 11:02am UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166 "2023-12-21T11:02:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 21, 2023, 11:02am UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/1 "2023-12-21T11:02:56Z")

</div>

Dear Team,  
How can I obtain this please?  
Original: Michael Jackson (Ft. Siedah Garrett) - I Just Can't Stop Loving You  
Should be: Michael Jackson - I Just Can't Stop Loving You (feat Siedah Garrett)  
Artist= Michael Jackson  
Album Artist= Michael Jackson  
Title= I Just Can't Stop Loving You (feat Siedah Garrett)

Thanks for your help!

---

<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, 2023, 11:05am UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/2 "2023-12-21T11:05:38Z")

</div>

It is not quite clear to me:  
Is

> [@Paelman](#):
>
> Original: Michael Jackson (Ft. Siedah Garrett) - I Just Can't Stop Loving You

the filename? Or the TITLE?  
And in the end you want to fill tag fields? Or do you want to modify the TITLE field?

---

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 21, 2023, 11:15am UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/3 "2023-12-21T11:15:33Z")

</div>

File Name should be as in example  
Title field should be as in example  
Album Artist should be as in example  
Michael Jackson is just an example, but this should be possible for all artists!

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [December 21, 2023, 11:16am UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/4 "2023-12-21T11:16:49Z")

</div>

> [@Paelman](#):
>
> Original: Michael Jackson (Ft. Siedah Garrett) - I Just Can't Stop Loving You

Is this the original filename or the original TITLE content?

---

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 21, 2023, 11:22am UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/5 "2023-12-21T11:22:13Z")

</div>

> [@LyricsLover](#):
>
> Is this the original filename or the original TITLE content?

The original file name

---

<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, 2023, 11:48am UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/6 "2023-12-21T11:48:52Z")

</div>

Try an action of the type "Guess value"  
Source: `$regexp(%_filename%,(.*) \(Ft. (.*)\) - (.*),$1==$1==$3 (feat. $2))`  
Target format string: %albumartist%==%artist%==%title%

---

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 21, 2023, 2:05pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/7 "2023-12-21T14:05:17Z")

</div>

Thank you very much for your response.  
You are very close to the solution.  
The title is now correct  
Only in the file name (feat Siedah garrett) still needs to be removed  
If you can do that, and I'm sure you can, I'll be overjoyed!!!  
Example result=  
Filename= Michael Jackson (feat Siedah Garrett) - I Just Can't Stop Loving You  
Should be= Michael Jackson - I Just Can't Stop Loving You  
Title= is perfect the way I want it

---

<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, 2023, 2:09pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/8 "2023-12-21T14:09:15Z")

</div>

What have you tried so far?  
I assume that you know that the function Convert\>Tag-Filename also supports scripting functions.

Are you sure that the filename should be different from the tag data? Most users don't want that.  
In the first post you wrote:

> [@Paelman](#):
>
> Original: Michael Jackson (Ft. Siedah Garrett) - I Just Can't Stop Loving You  
> Should be: Michael Jackson - I Just Can't Stop Loving You (feat Siedah Garrett)

which could easily be achieved with Convert\>Tag-Filename  
Format string: %artist% - %title%

---

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 21, 2023, 3:01pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/9 "2023-12-21T15:01:00Z")

</div>

Oh yes, I had just missed that now?  
Everything is perfect now!  
Thank you very much for the fast and great help!

---

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 22, 2023, 10:41am UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/10 "2023-12-22T10:41:11Z")

</div>

Hi ohrenkino,  
Can I please ask for your help based on the same topic?  
That's how it is: Michael Jackson & Testing - I Love You  
Should be: Michael Jackson - I Love You (feat Testing)

---

<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 22, 2023, 10:45am UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/11 "2023-12-22T10:45:53Z")

</div>

Try as  
Source: `$regexp(%_filename%,(.*) & (.*) - (.*),$1==$1==$3 (feat. $2))`

If you want to combine both patterns in a single action:  
Source: `$regexp($replace(%_filename%,'('Ft. ,& ,') -', -),(.*) & (.*) - (.*),$1==$1==$3 (feat. $2))`

---

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 22, 2023, 11:48am UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/12 "2023-12-22T11:48:44Z")

</div>

Thanks, but neither works for me  
Result is: Michael Jackson - I Love you  
This is how I did it:  
Guess values  
Source: `$regexp(%_filename%,(.*) & (.*) - (.*),$1==$1==$3 (feat. $2))`  
Guessing pattern: `%albumartist%==%artist%==%title%`  
Probably wrong action on my part?

---

<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 22, 2023, 12:41pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/13 "2023-12-22T12:41:05Z")

</div>

> [@Paelman](#):
>
> Probably wrong action on my part?

It is still "Guess values".  
You can test the source expression in Convert\>Tag-Tag  
This is what I get:

 ![grafik](https://community.mp3tag.de/uploads/default/original/2X/6/6d67bd76b3fa7fa85a0b552d7d5390b7f3aee26f.png)

You see in the preview, if it works.  
Once you got the pattern right, replace the string with %\_filename%.

---

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 22, 2023, 2:58pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/14 "2023-12-22T14:58:37Z")

</div>

Sorry, it still doesn't work  
Format string is just the same as yours in the screenshot  
but instead of Michael Jackson== Michael Jackson==I Love You (feat. Testing)  
This appears:  
`- I Love you,(.*) & (.*),$1==$1==$3 (feat.$2))`  
Sorry, but this is driving me a bit crazy  
I want to do it well but I can't! (been trying for 2 hours)  
If possible, a little by little guide for this ignorant person (meaning me)

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [December 22, 2023, 3:16pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/15 "2023-12-22T15:16:28Z")

</div>

If you only get "I Love you", then your filename is not exactly  
`Michael Jackson & Testing - I Love You.mp3`

I just testet @ohrenkino's format string. It works perfectly for the above filename.  
Pleases double check your real existing filename. Especially if the hyphen (-) is really an ordinary hyphen, also called minus sign. You can check it [here](https://community.mp3tag.de/t/take-part-of-filename-and-copy-it-to-a-field/61477/5).

---

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 22, 2023, 3:44pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/16 "2023-12-22T15:44:28Z")

</div>

![Schermafbeelding 2023-12-22 164109](https://community.mp3tag.de/uploads/default/original/2X/2/2ab48d674a25637340bcf6c02a8a697b24ce7bb6.png)  
Thanks too, but it doesn't work!

---

<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 22, 2023, 3:49pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/17 "2023-12-22T15:49:07Z")

</div>

You have a closing bracket following "Testing"

---

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 22, 2023, 4:18pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/18 "2023-12-22T16:18:40Z")

</div>

> [@ohrenkino](#):
>
> $regexp(%\_filename%,(._) & (._) - (.\*),$1==$1==$3 (feat. $2))

Thank you for trying to help me, but it doesn't work!  
I won't bother you anymore, but I'm hopeless because I have tons of numbers to correct  
THANKS A LOT

---

<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 22, 2023, 4:27pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/19 "2023-12-22T16:27:17Z")

</div>

It would al be easier if you showed us a real filename and not a typed in one.  
I tried to point out that the test string that you used had an additional closing bracket.  
All should work if you delete that

---

<div class="post-metadata">

**Author:** ![Paelman](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/59ef9b/32.png) [@Paelman](https://community.mp3tag.de/u/Paelman)\
**Post date:** [December 22, 2023, 4:37pm UTC](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166/20 "2023-12-22T16:37:32Z")

</div>

Tom Jones & Paul Anka - Nights On Broadway  
Tom Jones & Isaac Hayes - Don' Let Go  
I can also give you permission to log in via AnyDesk if you wish

[Next page](https://community.mp3tag.de/t/find-a-regular-expression-to-split-filename-into-fields/63166.md?page=2)
