Closed deepalics0044 closed 3 years ago
Closing in favor of PR #53.
pattern [^-_.a-z0-9] match characters that are not listed in the range .
So condition should be if (reg.test(bucketKey))
var reg = new RegExp(/[^-_.a-z0-9]/g);
if (reg.test(bucketKey)) { alert('Wrong Bucketkey format!'); return; }
Hi Deepali, I'm not sure I understand. Is the new code broken?
The regular expression I'm using is /^[\-_.a-z0-9]{3,128}$/g
. The ^
symbol is before the []
group, not inside, and it's meant to represent the "beginning of string".
I'm not sure if that code is correct. It sounds like it actually throws an alert when the bucket name is valid.
Shouldn't it be something like this instead?