Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^(mongodb(?:\+srv)?(\:)(?:\/{2}){1})(?:\w+\:\w+\@)?(\w+?(?:\.\w+?)*)(\:)(\d+(?:\/){0,1})(?:\/\w+?)?(?:\?\w+?\=\w+?(?:\&\w+?\=\w+?)*)?$
/
gm

Description

A regEx to validate a mongoDb connection string like the following: mongodb+srv://user:pass@subdomain.domain.com:27107/fDb/?replicaSet=myRepl&ssl=true

Submitted by F2BEAR - 3 years ago (Last modified 3 years ago)