Artist from a part of the directory with regex


I have around 10.000 files that i want to organize. I am trying to fill the artist tag with a regexp expression that matches a part of the directory path. But nothing i try seems to work...

The folderpath is: D:\topfolder\subfolder\artist\album\

these are my settings in the replace with regular expression action:

Field: ARTIST(also tried %artist% btw)
Regular expression: $regexp(%_folderpath%,^D:\topfolder\subfolder\(.?)(?:\(.?)(.*?))?$)
Replace by: $1

I have tried quoting like this '^D:\topfolder\subfolder\(.?)(?:\(.?)(.*?))?$' but that is not working either...
I tested the regexp on with ' as a delimiter....

What should i do to get this to work?

There is the function Convert>Filename-Tag.
You could try:
Format string: %artist%\%dummy%\%dummy%
Format string: %artist%\%album%\%dummy%

If you want so see more about regular expressions in MP3tag, have a look at the help:

A good test environment to test your expression would be the function Convert>Tag-Tag.
Also, I think that the $regexp() function is invalid in the action "Replace with regular expression)".

1 Like

Ah, thank you very much. That's much easier!