Creating a regex for mongoose URI -
I am trying to figure out how to fix the peanut urine with regex. My current rezux is:
^ (mongodb: \ / 2}) (\ w *?): {0,1} (\ W *?) @ {0,1} (\ w +?): (\ D +) \ / (\ w +?)
I should know that enter the username and password has been, ie
mongodb: username: password @ Sthaniyhost: 27107 / mydatabasename
so I required in the case are invalid:
mongodb: // username: Sthaniyhost: 27107 / adfaeadf mongodb: // username: @ Loklh Trust: 27107 / adfaeadf mongodb: //: password @ localhost: 27107 / adfaeadf
But these cases are valid:
mongodb: // localhost: 27107 / mydatabasename mongodb: // @ localhost: 27107 / mydatabasename mongodb: // localhost: 27107 / mydatabasename mongodb: username: password @ Sthaniyhost: 27107 / mydatabasename
Any help would be appreciated
^ (MongoDB: (: \ / {2}?)) ((\ W +?): (\ W +?) @ | ???? @) (\ W +): (\ d +) \ / (\ w +) $
for clarification
for your final link, "mongodb : "Should be after" // "? Regex will match it in any way.
Comments
Post a Comment