Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Python

r"
(?:http(?:s?)://)?(?:[\w]+\.)+[a-zA-Z]+(?::\d{1,5})?
"
gm

Description

Finda a domain or a url, with ot without a port in a string. Includes http and https

Submitted by Shmuel Blitz - 9 years ago