Skip to content

Tag Archives: regex

JavaScript: get domain from url with JS regex

07-Nov-18

It's as simple as url.match(/\/\/(.[^/]+)/)[1]. Requires the double slash before the domain part, but not a slash after it.