How Do I Extract URLs from Emails and Open in Selected Browser?

Hi there,

I'm an extreme noob to Keyboard Maestro. In fact, I haven't even downloaded the demo of the app yet, and before I do, I'd like to know that it will help me achieve my goal.

I frequently receive emails from and that often contain some interesting links to stories that I'd like to read, however, they links don't open in Safari. So to that end, I'd like to be able to strip the tracking crap from the email, just leaving the link to the original article, and have it open in a different browser, like Brave. I'm not exactly sure which trigger I'd like to use, as it's my understanding that KM doesn't have the ability to create a Service that I could access from a right/Command + click on the URL.
As I look at this email, there is no displayed URL, as it's only displayed when I roll over the text or the image. Looking at the email raw source, this is what I see:

So to that end, is this something that I can achieve with KM?


Hi and welcome, yes should be easy to implement.

I have this dumb regex that I use from time to time:

it's my understanding that KM doesn't have the ability to create a Service that I could access from a right/Command + click on the URL.

You can copy the URL to your clipboard and then run the command

EDIT: there's a forum thread about stripping/cleaning URLs here:

It looks like the URL was encoded twice:

@hello - Thanks for info. I'll have a dig through the Google stuff, and get a better understanding of. RegEx is awesome, and the fact the redirect_url is included, makes it a lot easier to search for.

The link that I've taken from Pocket, on the other hand ... not so much. They've encoded it in some way, so I'll have to do some digging to determine what they're doing. Any ideas?

Looking further at this, it looks like the site is being loaded into a page on Pocket, and there is no redirect.


But this is confusing, when I mouse over the image.

There are very few automation use cases that KM can't do, especially when combined with its ability to use just about any type of scripting.

KM is the best workflow automation tool for the Mac.

Even if, for some bizzare reason, KM cannot automate the task you have outlined here, there are so many workflows that you use daily that KM can automate that it will quickly be very useful to you.

For some good examples of what KM can do, see:
KM Forum Best Macro List

So, I'd suggest you go ahead and download the trial (fully functional) version of KM, good for 30 days. Then you can test some simple prototypes of your desired workflow to quickly determine if it will work.

In the future, please give your Topic Title one that is descriptive, but simple, of your issue. I have revised it for your this time.


@TallTrees, welcome to Keyboard Maestro (KM) and its Forum.
KM is one of the best Mac automation tools available, its Forum is one of the best and friendliest forums on the Internet. Whenever you reach a tough stumbling block trying to use KM, please feel free to post your question/problem here for help.

You will also find this helpful:
Tip: How Do I Get The Best Answer in the Shortest Time?

Getting Started with Keyboard Maestro

For more help, see Getting Started with Keyboard Maestro and the Forum .