Networkingflags: g

JDBC Connection URL

Match JDBC connection URLs in the standard `jdbc:driver://host[:port][/database]` form.

Try it in RegexPro →

Available in

Pattern

regexengine-agnostic
jdbc:[a-z0-9]+:\/\/[^\/?\s]+(?:\/[\w\-]+)?(?:\?\S*)?   (flags: g)

Raw source: jdbc:[a-z0-9]+:\/\/[^\/?\s]+(?:\/[\w\-]+)?(?:\?\S*)?

How it works

jdbc: matches the literal scheme prefix. [a-z0-9]+ captures the driver name (mysql, postgresql, oracle, sqlserver, h2, etc.). :\/\/ matches the separator. [^\/?\s]+ captures the host[:port]. (?:\/[\w\-]+)? optionally matches a database name. (?:\?\S*)? optionally matches query parameters.

Examples

Input

url=jdbc:postgresql://db.internal:5432/main

Matches

  • jdbc:postgresql://db.internal:5432/main

Input

jdbc:mysql://localhost:3306/test?useSSL=false

Matches

  • jdbc:mysql://localhost:3306/test?useSSL=false

Input

no jdbc url here

No match

Common use cases

  • Java / JVM application config validation
  • Spring Boot properties auditing
  • Migrating between database drivers
  • Detecting committed credentials in JDBC URLs

Related patterns