Search code examples
androidregexnotepad++

Converting .m3u playlists from Windows for Android media players using Notepad++


Winamp saves playlists that are saved in same folder as the music as relative paths for Windows, but copying and pasting into Android doesn't work unless I convert it to Linux relative paths. So

#EXTM3U
#EXTINF:262,Corona - Rhythm Of The Night
Unsorted\Corona - Rhythm Of The Night.mp3
#EXTINF:324,The B-52's - Love Shack
The B-52's - Love Shack.mp3

needs conversion to

#EXTM3U
#EXTINF:262,Corona - Rhythm Of The Night
./Unsorted/Corona - Rhythm Of The Night.mp3
#EXTINF:324,The B-52's - Love Shack
./The B-52's - Love Shack.mp3

for VLC Player on Android to read the playlist properly.

Well, figuring out how to convert \ to / on Notepad++ without regular expressions enabled was easy enough, but I'm too new at regex to get a grip on how to even read the table of contents on its guides even though all I want to do after that is to add ./ to the start of every odd line after the first line.


Solution

  • You may use

    (?:.*\R){2}\K
    

    and replace with ./.

    Details

    • (?:.*\R){2} - two consecutive occurrences ({2}) of any 0+ chars other than line break chars, as many as possible (.*),
    • \K - match reset operator discarding all text matched so far from the match buffer.

    The replacement is ./, i.e. it is inserted at the end of the match.

    enter image description here