Regular Expressions 101

Community Patterns

MongoDB connection string has username and password

0

Regular Expression
ECMAScript (JavaScript)

/
^mongodb:\/\/[^\/\,]+:{1}[^\/\,]*@{1}.*$
/
mg

Description

Test if a mongo db connection string has a username and password declared in it. Doesn't work with with multi host ATM

Submitted by Gecko Pico - 3 years ago