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

4x4 Matrix in Python -

python - String indices must be integers and while issue -

python - PyInstaller UAC not working in onefile mode -