Regular Expressions 101

Community Patterns

URL parser

1

Regular Expression
Python

r"
(http|https|ftp)\://([a-zA-Z0-9\-\.]+\.+[a-zA-Z]{2,3})(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~]*)[^\.\,\)\(\s]?
"
g

Description

gets the <protocol>://<host>:<port>/<link> from am url

Submitted by anonymous - 9 years ago