Community Patterns

Community Library Entry

2

Regular Expression
Created·2022-02-02 23:27
Flavor·Python

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

Description

Extract parts of a URL on Python

Submitted by dixanms