Capture the domain till the ending characters $, \\?, /, :. I need a regex that captures domian.com in all of these.
$, \\?, /, :
domian.com
domain.com:3000 do
A new challenger has appeared. According to node docs, you can also use
var url = new URL(urlString); console.log(url.hostname);
https://nodejs.org/api/url.html#url_the_whatwg_url_api
This seems to be a more current way.