@rayk Do you have to use a regex to do this? It would be quite easy with a JXA action and NSURL.
Typing this from memory, so hopefully I’ve got it right (I’ll clean it up later if not, once I am back on my Mac)...
(() => {
'use strict'
const
yourURL = Application('Keyboard Maestro Engine').getvariable('YourURL'),
url = $.NSURL.URLWithString(yourURL),
domain = url.host.js
return domain
})();
Put that in an Execute JavaScript for Automation
action (changing the YourURL
variable name as appropriate) and it should get you what you want.
NSURL has the ability to pull out other components from a URL as well.