I've written up a regex to extract the actual song title without the junk, like 'remastered' or '(mono).
I've used a regular expression to get rid of the things I don't care for. I have collected a few test pieces to match with. 60s rock seems to be popular subjects to remastering. Here are my subjects:
- My Generation - Stereo Mix
- Born To Be Wild - Single Version
- Surf City - Remastered 1990 / Stereo Mix
- Turn! Turn! Turn! (To Everything There Is A Season) - version 1 - take 2; Previously Unissued
You can't top that last one. It seems we need to look for blank + hyphen ánd blank + opening bracket and remove what follows. For the first case, the regex is:
- (.*). Which practically means "search for blank+hyphen and match everything after that".
For the second case we look for the bracket:
\((.*) Which means: "search for the blank+bracket and match everything after that". An OR expression is done with the
|symbol. Resulting in the following, working regex:
\((.*)| - (.*)
Test it out here if you like. Now it is just the question to pass the song title through the regex, match the pattern and replace it with nothing. Easy enough:
var cleansongname = item.name.replace(/ \((.*)| - (.*)/g, "");
Resulting song titles after regex
And now the songs titles look much better:
- My Generation
- Born To Be Wild
- Surf City
- Turn! Turn! Turn!
Ah. Much better.