How to extract "sub-domain name" from a url presence in a long text containing multiple url
<p>I have a long long text contains multiple url.   <strong>BUT</strong> there is <strong>only one</strong> url which is of blogspot.com    . That url will be like <a href="http://xxxxx.blogspot.com" rel="nofollow">http://xxxxx.blogspot.com</a> . How could i get the value of xxxx and store in a variable.</p>

<p>So if I have the whole text store in <strong>$foo</strong>. Can any one write the code to extract the subdomain out. </p>

<p>I guess it should be of only 1 or 2 line using <strong>preg_match</strong> . But i'am not getting it to work. Rejex are confusing me.</p>

<p>Thank you</p>
