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/mainMatches
jdbc:postgresql://db.internal:5432/main
Input
jdbc:mysql://localhost:3306/test?useSSL=falseMatches
jdbc:mysql://localhost:3306/test?useSSL=false
Input
no jdbc url hereNo 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
Generic Connection String (URL Form)
NetworkingParse generic URL-form connection strings: `protocol://[user[:pass]@]host[:port][/database]`.
Redis Connection URL
NetworkingMatch Redis connection URLs in both `redis://` and `rediss://` (TLS) forms, capturing user, password, host, port, and DB index.
FTP URL
NetworkingMatch FTP and FTPS URLs, capturing optional credentials, host, port, and path.
MongoDB Connection URI
NetworkingMatch MongoDB connection URIs in both standard `mongodb://` and SRV `mongodb+srv://` formats.