Regular Expressions 101

Community Patterns

domain/url

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 - 8 years ago