amazon web services - Regex on picking S3 bucket name from S3 URI -


i have been trying regex pattern obtain s3 bucket name s3 uri have no luck.

example: s3://example-bucket/file-name.filetype

closest this: \/\/([^\/].*[^\/])\/ i'm not sure how negate slash result

the part ([^/]+) looking sequence of of characters not slash. keeping close had write //([^/]+)/ same

//([^/]+) 

optional use lookbehind (?<=//) and/or lookahead (?=/)

(?<=//)([^/]+)(?=/) 

(depending on use cases couple of different lookahead expressions possible)

'lookaround' 'lookbehind' not supported in regexp dialects. e.g. not in javascript

debuggex demo


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

python - Error: Unresolved reference 'selenium' What is the reason? -

asp.net ajax - Jquery scroll to element just goes to top of page -