Removing multiple timestamps from lyrics

Hello,

I'm trying to convert lyrics tagged with ESLyric within foobar2000 to a format which is recognized by MusicBee. The problem is that MusicBee only accepts one timestamp in front of each row. ESLyric (with KGMusic as a source) writes timestamps for every word (for most of the songs). So I'm trying to find a regex or script solution, to convert something like this:

[ar:Mac Miller]
[ti:Complicated]
[00:00.28]Mac [00:00.43]Miller [00:00.57]- [00:00.74]Complicated[00:00.84]
[00:00.84]Written [00:00.99]By[00:01.14]:[00:01.24]Jon [00:01.39]Brion[00:01.55]、[00:01.65]Mac [00:01.80]Miller[00:02.40]
[00:12.86]Outside [00:13.47]is [00:13.77]cloudy [00:14.63]but [00:14.99]I [00:15.34]like [00:15.74]that [00:16.14]better [00:17.05]Better [00:18.80]better [00:19.36]
[00:19.36]Behind [00:19.77]the [00:20.17]wheel [00:20.58]but [00:20.93]still [00:21.33]ain't [00:21.74]on [00:22.09]my [00:22.45]way[00:23.56]

to something like this:

[ar:Mac Miller]
[ti:Complicated]
[00:00.28]Mac Miller - Complicated
[00:00.84]Written By:Jon Brion、Mac Miller
[00:12.86]Outside is cloudy but I like that better Better better
[00:19.36]Behind the wheel but still ain't on my way

MusicBee can use them as synced lyrics, but everything after the first occurence of a timestamp is shown as well, which makes the lyrics unreadable.

I've tried various attempts to get rid of everything inside the brackets after the first timestamp with Actions or the Tag conversion, but my knowledge of regex is too limited to achieve that (if it's even possible).

Thanks for any help! :slight_smile:

I got this far:
$regexp($regexp($replace(%subtitle%,'[',$char(13)$char(10)'[',']',']'$char(13)$char(10)),'\[\d+\:\d+\.\d+\]...\r\n\[\d+\:\d+\.\d+\]\r\n',),'\]\r\n',']')
I copied the text to the field SUBTITLE - so feel free to replace that field name with the real one.

What it principally does:
It first hacks all the bits apart so that each timestamp has its own line (that's the $replace()).
Then it takes a string starting with "[" and several numbers closing with "]" followed by some characters (and here it is a shame that this is not always the same - this would have made it much easier)) and another string in "[ ]" - which gets deleted.
Finally I try to remove the superfluous linebreaks following the leftover "]" which works ... but there are still some linebreaks left which could either be removed with a separate action of another nesting of the already rather longish expression and another regexp().
The current output is:

[ar:Mac Miller]

[ti:Complicated]

[00:00.28]Mac Miller - Complicated

[00:00.84]Written By
Jon Brion
Mac Miller

[00:12.86]Outside is cloudy but I like that better Better better 

[00:19.36]Behind the wheel but still ain't on my way
[00:23.56]"
1 Like