python regex for a url

import re

url = '

Hello World

More ExamplesEven More Examples' urls = re.findall('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', url) >>> print urls ['http://example.com', 'http://example2.com']

Here is what the above code is Doing:
1. We’re using the findall() method from the re module to search for all URLs in the string.
2. The first part of our regular expression, https?://, matches the string http:// or https://.
3. The next part, (?:[-\w.]|(?:%[\da-fA-F]{2})), matches any character that’s not a period or dash, or a percent sign followed by two hexadecimal digits.
4. The + at the end of the regular expression means that the previous character can be matched one or more times.
5. The result of the regular expression search is a list of all the matched URLs.