Regular expression to seperate "aaa-aaa" into "aaa aaa"

Hello all,

Was wondering if anyone here could help me out with a little RegEx. :slight_smile:

I have several track names with artist and title only seperated by a dash and would like to use RegEx to seperate them, because it allows me to use another criteria; namely if the words that are being seperated are of at least 3 letters in size.
The reason i want to do this is because some artist names actually use a dash and i don't want to mess those up (eg. D-Sturb).

But in my case i have a few track names that are named: "artist name-title of the song (album)"
and i would like to use a RegEx expression to identify the dash in these cases (eg. 3 letters or more on both sides of the dash).

Can anyone help me with that? :slight_smile:

Perhaps not the most elegant solution
Action of the type "Replace with regular expression" for whatever field you have
Search string: (...)-(...)
Replace string: $1 - $2

From "D-Sturb-The best of"
to "D-Sturb - The best of"

If you want to separate artist from title I would not use a hyphen (or even a plain blank) but a character that is usually not part of everyday writing - like the underscore _.
So it may be better to use
Replace string: $1_$2

Example to try out how it can work.

$regexp('abc D-Sturb def name-title xyz','(\b...+\b)-(\b...+\b)','$1 - $2')

==> "abc D-Sturb def name - title xyz"

DD.20180426.1143.CEST

Hi guys,

Thanks for the tips so far. I tried both but they do not seem to have the desired result.

On a sidenote, i also want to use Metamorphose 2 to change the folder name (which has exactly the same 'issue').

I'd still like to use the dash to seperate both names, but i want to introduce spaces before and after.

Here's an example of a few names... you can already tell the first name is tricky, because i would not like to mess up the artist name (so not just D-sturb, but there are various names like that). :slight_smile:

image

[Edit]
Just noticed that the labelnames/release names at the back should also not be changed either....
Too complicated for me... :hushed:

Did you know that you can rename the folder with MP3tag?

So right now it looks to me as though you are fiddling about with the filename.
As MP3tag is a tagging program, you should first fill the tag fields with data.
And then you can rename the files with the contents of the field variables and / or string constants.
An import into the fields for artist, title and release should make it much easier.