How can I get only the domain name from the frontend browser

I want to be able to quickly get the domain name of the brower tab i am in.

which browser are you using?
and
how are you getting the full URL in the first place? Is it a list from somewhere?
Some more info please.

I am using firefox and the url links are from search that I do to find articles related to a topic.

I only want the domain name and not the full URL...

Thanks

FF is NOT scriptable, so KM does not have the same access as it does with Safari and Chrome.

To get FF page data, see Get the Browser Page Title & URL for Safari, Chrome, or FireFox .

Given the URL, you can extract the Domain name using RegEx.
Since URL's can vary so much, the Regex's can be very complicated.
So, in this case we will use two steps to extract the Domain Name.

Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.

Please let us know if it meets your needs.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.

Please let us know if it meets your needs.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Example Output

MACRO:   Extract Domain Name from FireFox URL [Example]

==UPDATED==: 2020-07-12 17:51 GMT-5

  • Fix Regex to handle "www"
  • ADD Close Address Bar and Move to Page body

-~~~ VER: 1.1    2020-07-12 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Extract Domain Name from FireFox URL [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


thank you, that worked like the way I want it...

it works on some domain and not thee other, by the way,,,

As I said:

You can do a RegEx search on "extract domain" and see if you can find a better Regex.
You can also post the URLs that failed and we can take a look.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EDIT:

Turns out we have exhaustively addressed this question before.
==There are NO perfect solutions.==

You can take a look at the below thread to see if there is a solution there you like better:
How to trim URL to root domain? .

one of the domains that don't work is

https://www.controldesign.com/industrynews/2020/pepperl-fuchs-announces-first-online-summit/

ok, I got it to work to a point where i am happy with it, thanks for your time.

Just updated my macro and above post to fix.

If you have a better solution, please upload your macro so that others my benefit.

I will check my solution against yours and see which one is better and will post it there. Thanks for all the help.

Here's another solution I just posted:

MACRO: Extract Domain from URL [Example]

Please feel free to test it against your hardest, toughest, URL cases.
If you find any problems, please in the above Macro topic.