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
Comments
Post a Comment