Regular Expressions 101

Community Patterns

Postgresql JDBC URI

0

Regular Expression
Java 8

"
jdbc:postgresql:(?=.)(?:(?:/$)|//(?:(?<user>[^:\n\r]+)(?::(?<pass>[^@\n\r]+))@)?(?<host>[^:/\r\n]+)(?::(?<port>\d+))?/)?(?<db>.+)?
"
gm

Description

Formats

jdbc:postgresql:database jdbc:postgresql:/ jdbc:postgresql://host/database jdbc:postgresql://user:password@host/database jdbc:postgresql://host/ jdbc:postgresql://host:1234/database jdbc:postgresql://host:1234/

Submitted by fantabulum - 2 years ago