Regex for url domain
How do i match from these urls:

    http://foo.bar.com  
    http://bar.com

`foo.bar` from the first link and  `bar` from the second link using one single regex?




Regex for url domain
===

How do i match from these urls:

    http://foo.bar.com  
    http://bar.com

`foo.bar` from the first link and  `bar` from the second link using one single regex?



