Tuesday, 6 August 2019

RegEx for string containing AWS Key and MongoDB ObjectID

I realize that this is not a RegEx subreddit, but I'm posting it here because I'm asking about MongoDB and AWS in the same question.I'm looking to validate a string of the following type:access-type-keyaccess can be public or privatetype can be any word with no digits or special characters.key will be of the following format: users/[ObjectID]/path/to/image.jpgSo, all together I might have:public-avatar-users/[ObjectID]/profile/avatar/avatar_orginal.jpgI came up with the following Regular Expression and I wanted to ask whether you think it is correct with regards to validating the string.^(public|private)-([a-z]+)-([\w\/]+).([a-z]+)$Thank you.

Submitted August 07, 2019 at 01:36AM by JamieCorkhill

No comments:

Post a Comment