Search
 
SCRIPT & CODE EXAMPLE
 

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']
Comment

PREVIOUS NEXT
Code Example
Python :: python cls statement using os module 
Python :: linux python installation wheel 
Python :: terminal python version 
Python :: index to datetime pandas 
Python :: NameError: name ‘np’ is not defined 
Python :: jinja2 datetime format 
Python :: python nested functions get variables from function scope 
Python :: s3fs download file python 
Python :: how to convert datetime to jdatetime 
Python :: python flask sample application 
Python :: make string numeric pandas 
Python :: django reset database 
Python :: python number of cpus 
Python :: index in zip python 
Python :: pandas shuffle rows 
Python :: python write to json with indent 
Python :: how to set the current working directory in python 
Python :: how to install numpy 
Python :: Calculate median with pyspark 
Python :: python choose random element from list 
Python :: json file to dict python 
Python :: python program to shutdown computer when user is not present 
Python :: Create MySQL table from Python 
Python :: dataframe from two series 
Python :: create an array from 1 to n python 
Python :: python how to set the axis ranges in seaborn 
Python :: check if string url python 
Python :: exception get line number python 
Python :: portscan with python 
Python :: arrondi supérieur python 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =