I have the following pattern that used to match a S3 URL
Pattern.compile("^s3://([^/]+)/(.*?([^/]+))$");
This matches
s3://bucket/path/key
But does not match a directory
s3://bucket/path/directory/
Is there an easy way to change the pattern to match a directory?
There's only the final slash missing in the regex. You might try this:
^s3://([^/]+)/(.*?([^/]+)/?)$
^^
regex101 demo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With