More > JRiver Media Center 27 for Windows

Manage links: how to replace spaces by a dash?

(1/1)

MarkCoutinho:
Hi everyone,

I'm trying to make a link in MC to search for songfacts about a song. I'm getting pretty close with this:
https:////www.songfacts.com//facts//regex([Artist]//[Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1)
(I don't want the query to contain 'extended version' - hence the exclusion of that word)

However the output is this: https://www.songfacts.com/facts/middle%20of%20the%20road/soley%20soley/
And it should be: https://www.songfacts.com/facts/middle-of-the-road/soley-soley/

Could someone tell me what to do to replace the spaces between the words by the - sign?

Thanks!

zybex:
Just add a Replace():

--- Code: ---https:////www.songfacts.com//facts//replace(regex([Artist]//[Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1),/ ,-)

--- End code ---

This may work better with a simpler Regex that cuts anything after a parenthesis/bracket:

--- Code: ---https:////www.songfacts.com//facts//replace(regex([Artist]//[Name], /#^(.+?)(\s?[\[(].*)?$#/, 1),/ ,-)

--- End code ---

MarkCoutinho:
Spot on!
Thank you very much!

Navigation

[0] Message Index

Go to full version