>>> myString = "This is a link http://www.google.com" >>> print re.search("(?P<url>https?://[^\s]+)", myString).group("url") http://www.google.com