Noob question: How to extract entire domain from URL?

Hi team, could someone please guide me to have a node for this:

I have a list of address on $json.monitors.url:

https://domain1.com
http://www.domain2.com/test
https://domain3.com/

I would like to have only the domain, removing the protocol and the path, like this:

domain1.com
www.domain2.com
domain3.com

I noticed the extractDomain() and extractUrl() functions, I am ignorant with programming, was unable to use it on a expression or on a code note to make this working

Please, could someone help me?

Thanks a lot

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Found it, just using

{{ $json.monitors.url.extractDomain() }}

o/

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.