Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
r"
(?P<dialect>[^+:]+) (?: \+ (?P<driver>[^:]+) )? :// (?P<username>[^:@]+) (?: : (?P<password>[^@]+) )? @ (?P<host>[^:/]+) (?: : (?P<port>\S+) )? / (?P<database>.*)
"
x
Unit Tests
dialect+driver://username:password@host:…
→ regex does match
postgresql+psycopg2://scott:tiger@localh…
→ regex does match
postgresql://dbuser@localhost/dbname
→ regex does match
xyz
→ regex does not match