Possible Duplicate:
how to extract domain name from URL
I want to extract the website from an URL, i.e. console.aws.amazon.com
from the following URL.
>>> ts
'https://console.aws.amazon.com/ec2/home?region=us-east-1#s=Instances,EC2 Management Console,12/3/2012 4:34:57 PM,11,0,,25806'
>>> re.match(ts,'(")?http(s)?://(.*?)/').group(0)
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
re.match(ts,'(")?http(s)?://(.*?)/').group(0)
AttributeError: 'NoneType' object has no attribute 'group'
I tried this regular expression in JS and it worked. Any idea why this matches in JS, but it doesn't work in Python?