I am trying to construct a regex to extract a domain given a url.
for:
http://www.abc.google.com/ http://abc.google.com/ https://www.abc.google.com/
you may be able to use the domain_name gem for this kind of work. From the README:
require "domain_name" host = DomainName("a.b.example.co.uk") host.domain #=> "example.co.uk"