I have looked at multiple posts about this, and am still having issues.
I am attempting to write a regex query that finds the names of S3 buckets that do not follow the naming scheme we want. The scheme we want is as follows:
test-bucket-logs**-us-east-1**
The bolded part is optional. Meaning, the following two are valid bucket names:
- test-bucket-logs
- test-bucket-logs-us-east-1
Now, what I want to do is negate this. So I want to catch all buckets that do not follow the scheme above. I have successfully formed a query that will match for the naming scheme, but am having issues forming one that negates it. The regex is below:
^(.*-bucket-logs)(-[a-z]{2}-[a-z]{4,}-\d)?$
So some more valid bucket names:
- example-bucket-logs-ap-northeast-1
- something-bucket-logs-eu-central-1
Invalid bucket names (we want to match these):
- Iscrewedthepooch
- test-bucket-logs-us-ee
- bucket-logs-us-east-1
Thank you for the help.