How to convert the clipboard (a markdown link) to simple text format

I need to convert the clipboard to simple text format to run a Search System Clipboard Using Regular Expression (ignoring case) on the clipboard

(thank you @RogerB Extract separate subject and URL from selected apple mail email markdown link - Questions & Suggestions - Keyboard Maestro Discourse )

Can you provide an example of what the input might be and what you'd expect the output to be?

1 Like

Hello and thank you for your reply.

example of markdown link

[Keyboard Maestro] How to convert the clipboard (a markdown link) to simple text format 2023-11-26 07:20 Vito kmforum@forum.keyboardmaestro.com

conversion to text format

[[Keyboard Maestro] How to convert the clipboard (a markdown link) to simple text format 2023-11-26 07:20 Vito <kmforum@forum.keyboardmaestro.com>](message://%3Cdiscourse/post/165046@forum.keyboardmaestro.com%3E)

Do you want all of that as text, up to and including the ">" on the email address?

-rob.

1 Like

yes please

This should work:

__ Unmarkdown Macro (v10.2)

__ Unmarkdown.kmmacros (3.6 KB)

It checks to see if the current clipboard starts with [[, and if so, applies a regular expression to chop out all the bits you don't want, leaving just the part you do, and putting that back on the clipboard. The demo macro doesn't have a trigger of any sort, so to test it, just make sure a markdown link is the top item in the clipboard, then run it manually.

It works here in testing, though I only used the one sample string you provided. If there are other Markdown link formats, I'm not sure if my expression would capture them all or not. (I don't use or know much of anything about Markdown, short of using it here in posts in very simple ways.)

-rob.

2 Likes

works perfectly. Thanks very much !

1 Like