Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocsChangelog
Database
#mongodb
#database
#connection-string
#uri

MongoDB Connection URI

Validates MongoDB connection strings, supporting both standard 'mongodb://' and DNS-seedlist 'mongodb+srv://' protocols.

✓ App config validation✓ Database connector forms✓ DevOps orchestration tools
/
/
Safe
Test String
3 matches
mm— 'm' — literal character
oo— 'o' — literal character
nn— 'n' — literal character
gg— 'g' — literal character
oo— 'o' — literal character
dd— 'd' — literal character
bb— 'b' — literal character
(?:…)?Non-capturing group— Non-capturing group — groups without capturing (no index assigned) — repeated zero or one time (optional) · ? — zero or one time (optional)
\+\+— \+ — escaped character '+'
ss— 's' — literal character
rr— 'r' — literal character
vv— 'v' — literal character
::— ':' — literal character
\/\/— \/ — escaped character '/'
\/\/— \/ — escaped character '/'
(?:…)?Non-capturing group— Non-capturing group — groups without capturing (no index assigned) — repeated zero or one time (optional) · ? — zero or one time (optional)
[…]+Character class […]— Matches any single character listed in this set — repeated one or more times (greedy) · + — one or more times (greedy)
::— ':' — literal character
[…]+Character class […]— Matches any single character listed in this set — repeated one or more times (greedy) · + — one or more times (greedy)
@@— '@' — literal character
[…]+Character class […]— Matches any single character listed in this set — repeated one or more times (greedy) · + — one or more times (greedy)
a-za-z— a-z — range from 'a' to 'z'
A-ZA-Z— A-Z — range from 'A' to 'Z'
0-90-9— 0-9 — range from '0' to '9'
..— '.' — literal character
--— '-' — literal character
(?:…)?Non-capturing group— Non-capturing group — groups without capturing (no index assigned) — repeated zero or one time (optional) · ? — zero or one time (optional)
::— ':' — literal character
\d+digit— \d — digit (0–9) — repeated one or more times (greedy) · + — one or more times (greedy)
(?:…)?Non-capturing group— Non-capturing group — groups without capturing (no index assigned) — repeated zero or one time (optional) · ? — zero or one time (optional)
\/\/— \/ — escaped character '/'
[…]+Character class […]— Matches any single character listed in this set — repeated one or more times (greedy) · + — one or more times (greedy)
(?:…)?Non-capturing group— Non-capturing group — groups without capturing (no index assigned) — repeated zero or one time (optional) · ? — zero or one time (optional)
\?\?— \? — escaped character '?'
.+.— . — matches any character except newline (unless 's' flag is set) — repeated one or more times (greedy) · + — one or more times (greedy)
Pattern: 110 charsInput: 138 chars
100% client-side · private

✓ Valid Examples

  • mongodb://localhost:27017
  • mongodb+srv://user:pass@cluster.mongodb.net/dbname?retryWrites=true
  • mongodb://admin:secret@127.0.0.1:27017/admin

✗ Invalid Examples

  • mysql://localhost:3306
  • mongodb://
  • mongodb+srv://user@pass@cluster.mongodb.net
  • mongodb:/localhost

Usage & Integration

Validate MongoDB Connection URI natively in your backend or frontend without copying regex strings.

Node / Edge

import { validate } from '@regexto/validators';

validate('mongodb-uri', '...');

Python

from regexto_validators import validate

validate("mongodb-uri", "...")

Go

import "github.com/regex-to/validators-go"

valid, err := validators.Validate("mongodb-uri", "...")

PHP

use RegexTo\Validators\Validator;

Validator::validate('mongodb-uri', '...');

Rust

use regexto_validators::validate;

let is_valid = validate("mongodb-uri", "...").unwrap();