in reply to Regex: Extract base URL for a specific domain

How about using URI, and matching the end of the $uri->host or $uri->ihost methods?

--MidLifeXis