More > JRiver Media Center 27 for Windows
Removing "Junk" from Lyrics after Lookup Lyrics
zybex:
SkGe:
This one should work for you:
--- Code: ---=replace(regex([Lyrics],/#(?:^|\])\x0A?([^\[]+)#/,-2),;,)
--- End code ---
Still, a RegexReplace() would be nice, or even a ListReplace() to be used with Regex mode -2:
ListReplace(string, searchList, replacementList)
SkGe:
@ zybex
It works partially, but now it creates multiple empty lines, and if I use trimlines() to remove that it will break the lyrics format. It will make a line of texts and no space. I will try to have a look there and see a way to keep the empty lines untouched.
SkGe:
@ mvandyke sorry if I steal your post but maybe it can help us both :P
zybex:
@SkGe, that's likely due to CRLF instead of just LF. Try this:
--- Code: ---=trim(replace(regex([Lyrics],/#(?:^|\])[\r\n]*([^\[]+)#/,-2),;,))
--- End code ---
zybex:
--- Quote from: mvandyke on June 14, 2021, 08:26:31 am ---I copied that expression to a new expression field and I could not get it to work. I tried a couple of adjustments but REGEX has always been a challenge for me.
--- End quote ---
That's funny, it worked for me when I first tested it, but now it doesn't - this is again due to the line endings, I think.
Here's an alternative which I don't like that much, but should work:
--- Code: ---=regex([lyrics],/#([^<]+)<span#/,1)
--- End code ---
@Matt:
- It looks like "." doesn't match line endings. Would it break anything if you enabled the Regex SingleLine flag by default? If not, is there a way to enable it on the Regex() parameter itself? "(?s)" doesn't work.
- "((.|\r|\n)+)" should match an entire multiline string like the lyrics above, but it doesn't. Is it a bug, or am I missing something?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version