Author Topic: Clickable URLs  (Read 3536 times)

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7623
Code
$RxMatch(<Comment>,"(^|\s)https?\:\S*|(^|\s)www\.\S*")
Seems to work nicely. There may be a few "http:\\" floating around. I changed your code to
Code
http?\:\S*|
And it didn't show anything. I tried with
Code
http*?\:\S*|
and
Code
http*?\:\S*|
and again nothing.
And it did find one that had no protocol, but simply "www.website.com" so that was a nice touch.
My thinking is that the ? after http in your original is a single character wildcard and therefore should show both "http" and "https". Is that correct? If so, and it's not turning up any "http:\\" then perhaps I have none.

Thanks for putting this together.
Download the latest MusicBee v3.4 patch from here.
Download the latest MusicBee v3.5 beta patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
Check out the MusicBee Wiki.
How to post screenshots is here

hiccup

  • Hero Member
  • *****
  • Posts: 5879
The 's?' part in https? means that the letter s may or may not be present, and so both http and https will be matched.
(same as e.g. "bees?" would match both one bee and a swarm of the little f*ers)

I first looked on da webz for examples of url-finding regexes. But pretty much all of them were quite complicated, and I couldn't even get them to work.
So I built something simpler. Probably too simple ;-)

Can you post a couple of comments containing url's that fail using this formula?
Perhaps I (or somebody else more talented with regex) can create a better regex.

edit:
Having read your comment again, and now probably digesting it a bit better, I suspect that the regex/formula is actually working perfectly fine?
Last Edit: January 12, 2022, 05:18:51 PM by hiccup

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7623
(same as e.g. "bees?" would match both one bee and a swarm of the little f*ers)
Ah HAH!!
I have finally found a mistake you made. "bees?" would -not- match "bee" but would match "bees" and "bees" plus one other character. To match both "bee' and "bees" it should be "bee?".

I may not know RegEx, but I know my wildcards.

Quote
Having read your comment again, and now probably digesting it a bit better, I suspect that the regex/formula is actually working perfectly fine?
Yes, it's working fine. Your confusion may have come from my statement that I -think- there are some "http:\\" strings out there, but so far I haven't been able to find them. So if your RegEx isn't finding them, and I'm not finding them, then they don't exist. And to proof it to myself (and to you) I changed one instance of "https:" to "http" and it showed up.

A tip of the ol' phred hat to Mr. Hiccup.
Last Edit: January 12, 2022, 06:01:54 PM by phred
Download the latest MusicBee v3.4 patch from here.
Download the latest MusicBee v3.5 beta patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
Check out the MusicBee Wiki.
How to post screenshots is here

hiccup

  • Hero Member
  • *****
  • Posts: 5879
"bees?" would -not- match "bee"
It surely would ;-)

Quote
I may not know RegEx, but I know my wildcards.
It is kind-of-a wildcard, but a special one that only looks one step back.
(don't you have leftfield members in your family that do weird things?)
Last Edit: January 12, 2022, 05:52:49 PM by hiccup

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7623
"bees?" would -not- match "bee"
It surely would ;-)
I'm not convinced. My understanding in the use of the question mark as a wildcard is that where the question mark is, it will allow any one character. So in said example, "bees?" would return the first four characters (bees) plus any other -one- character in the fifth position. Whereas " bees* would return "bees", "beeshit", or "beeswax".


Quote
It is kind-of-a wildcard, but a special one that only looks one step back.
Again, I think not. Unless RegEx is different from BASIC. But lookee here:
Quote from: https://support.cleo.com/hc/en-us/articles/360027263194-Using-Wildcards-and-Regular-Expressions
Wildcards
Wildcards are represented by * or ?, where * matches multiple characters and ? matches only a single character.  For example, assume the outbox has the following files.
ab1.edi
ab2.edi
ab11.edi
ab12.edi
The following commands produce the following results.
Command Result
PUT ab*.edi Sends all four files from the outbox
PUT ab?.edi Sends only ab1.edi and ab2.edi

Quote
(don't you have leftfield members in your family that do weird things?)
I'm the only member of my family that does weird things. I'm not left-handed and I'm not out of left field.
Download the latest MusicBee v3.4 patch from here.
Download the latest MusicBee v3.5 beta patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
Check out the MusicBee Wiki.
How to post screenshots is here

hiccup

  • Hero Member
  • *****
  • Posts: 5879
https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference
"? Matches the previous element zero or one time."
Also, doesn't my formula by itself prove that this is how it works?

But this has drifted off-topic:
Does my suggested virtual tag extract any url present, in all the comment fields that you have tested it on?
If not, please share an example of a specific comment where it fails, so that I (or someone else) can try to improve it.

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7623
Does my suggested virtual tag extract any url present, in all the comment fields that you have tested it on?
If not, please share an example of a specific comment where it fails, so that I (or someone else) can try to improve it.
Yes, it works. I stated as such in Reply #17.
Upon further review, my understanding of ? and * as wildcards comes from DOS and BASIC. RegEx is different. Yes, I'm old.
Download the latest MusicBee v3.4 patch from here.
Download the latest MusicBee v3.5 beta patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
Check out the MusicBee Wiki.
How to post screenshots is here

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 32757
This has the change:
https://getmusicbee.com/patches/MusicBee35_Patched.zip
unzip and replace the existing musicbee application files

hiccup

  • Hero Member
  • *****
  • Posts: 5879
Yes, it works. I stated as such in Reply #17.
That reply mentioned 'it seems to work'.
Followed by other things you tried editing the regex.

It's probably me (sometimes being a bit too Aspergic about words) but I didn't read that as a definite confirmation that the regex/formula is functioning to complete satisfaction.
But I now guess the conclusion is that it does? Which frees up the assigned brain cells to other tasks. (such as dreaming sweat dreams)
Last Edit: January 12, 2022, 10:21:21 PM by hiccup

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7623
This has the change:
https://getmusicbee.com/patches/MusicBee35_Patched.zip
Thanks Steven. It works great and is a real time-saver.

Onward and upward to 3.5!
Download the latest MusicBee v3.4 patch from here.
Download the latest MusicBee v3.5 beta patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
Check out the MusicBee Wiki.
How to post screenshots is here

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7623
Using 3.5.8048 P

I set up a custom tab and named it "Link" and set it to new URL type.

When I do a custom search and set the first field to "Link" the second criteria field has nothing in its dropdown. At the very least I was expecting "has a value" or "has no value" but it would be nice if all the options available for the other first field tags were available here. This feels more like an oversight than a bug, which is why I've added it to this thread.
Last Edit: January 14, 2022, 11:50:27 AM by phred
Download the latest MusicBee v3.4 patch from here.
Download the latest MusicBee v3.5 beta patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
Check out the MusicBee Wiki.
How to post screenshots is here


phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7623
Download the latest MusicBee v3.4 patch from here.
Download the latest MusicBee v3.5 beta patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
Check out the MusicBee Wiki.
How to post screenshots is here

Nighthawk_NL

  • Jr. Member
  • **
  • Posts: 24
Great, when this is possible can anyone explain to me how I can add a clickable link so I can also choose a YouTube video instead of the local MP3 file.

phred

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7623
It's available in the latest 3.5 patch. See my signature for link and instructions.

- Preferences > Tags (1) > custom tags > name the tag (I used "Link") and save it as a tag you're not, and will not, be using for anything else. This keeps the tag embedded in the music file and not in MB's database.

- Preferences > Tags (2) > tag handling > fields: configure fields > find your newly created custom tag > set the type to "URL." Note that you will not find the newly created tag in alphabetical order. It will be under CustomX, where X is the number of the custom tag.

- Select the file(s) where you want to have the link appear > Tag Editor > Tags (2) > find the custom tag you created in step 1 > enter the link

- Make sure you have the Track Information panel showing in your layout > click on the header where it says "Details" > Customize Panel > in the fields section add the custom tag you created in step 1 > save

You're all set.
Last Edit: February 06, 2022, 03:59:07 PM by phred
Download the latest MusicBee v3.4 patch from here.
Download the latest MusicBee v3.5 beta patch from here.
Unzip into your MusicBee directory and overwrite existing files.

----------
Check out the MusicBee Wiki.
How to post screenshots is here