Regex - extract word from www.anything.com : <p>I am trying to use Regex to match a word within a www URL. In the event that the www does not exist, I would still like it to match on the '.com'. For example if the following text was present...</p>

<p>www.<strong>anything</strong>.com</p>

<p><strong>anything</strong>.com</p>

<p>It would return "<strong>anything</strong>" as the result. In the event that the 'www' is not present, it could still get it from the word before '.com'. But if the 'www' is present, I would like it to look there first. </p>

<p>Any thoughts?</p>
