0

I'm a bit stucked with this regex problem, I need to check if url has at start mongodb:// and at the end of a string - port with numbers :27017 and also if there is no slash / .

For example:

/myRegexForThis/.test('mongodb://testUrl:port') => true
/myRegexForThis/.test('mongodb://testUrl:port/') => false
/myRegexForThis/.test('mongo://testUrl') => false
/myRegexForThis/.test('mongodb://testUrl:port') => false

currently I have only start part: ^(mongodb:\/\/)

Kosmetika
  • 20,774
  • 37
  • 108
  • 172

0 Answers0