Regular Expressions 101

Community Patterns

S3 Bucket Info Extractor

0

Regular Expression
ECMAScript (JavaScript)

/
((https|http):\/?\/?)?(?<bucket>[a-z\-]*)(\.s3\.)(?<server>[a-z\-\d]*)(\.amazonaws\.com\/)(?<key>[^?\s]*)(\?)?(?<extra>\??.*)
/
gi

Description

This one gets from a S3 Bucket URL the bucket name, the zone, and the key

Submitted by anonymous - 4 years ago