Suppose I have 2 strings:
string1 = "home/lisa/Music/some_files/01.05 - Garden Ground.mp3"
string2 = "Music/Jim Smith/Unknown/(Deluxe Version/Garden Ground).mp3"
string4 = "Music/Jim Smith/Unknown/00 - Garden Ground.mp3"
Basically, I want to know if string 2 contains the same mp3 file as string 1. In the above example, you can see this is the case with Garden Ground.mp3. What's the best way to go about this? Should I try Levenshtein distance? I thought about doing a regular expression, but there's no guarantee string 2 will be formatted with parentheses in the exact same place every time. In fact, string 2 could look like string 4, for example.
basename
? What is that slash in(Deluxe Version/Garden Ground).mp3
? do you mean '\/` instead? – Aitch Mar 14 '15 at 10:50soundex
phonetic algorithm is maybe what you are looking for? it's quite easy and you can compare if two strings are phonetical similar. Of course again applied to thebasename
. – Aitch Mar 14 '15 at 13:56