Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python regex for a url

import re

url = '<p>Hello World</p><a href="http://example.com">More Examples</a><a href="http://example2.com">Even More Examples</a>'

urls = re.findall('https?://(?:[-w.]|(?:%[da-fA-F]{2}))+', url)

>>> print urls
['http://example.com', 'http://example2.com']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #regex #url
ADD COMMENT
Topic
Name
3+2 =