Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
Python

r"
^((?P<scheme>[^:/?#]+):(?=//))?(//)?(((?P<login>[^:]+)(?::(?P<password>[^@]+)?)?@)?(?P<host>[^@/?#:]*)(?::(?P<port>\d+)?)?)?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?
"
gm

Description

Extract parts of a URL on Python

Submitted by dixanms - 3 years ago