我想验证AWS accessKey和secretKey。发现了一个AWS博客张贴这表明一个正则表达式来验证ACCESSKEY和秘密密钥 https://blogs.aws.amazon.com/security/post/Tx1XG3FX6VMU6O5/A-safer-way-to-distribute-AWS-credentials-to-EC2Javascript中的等效正则表达式
但他们提出的正则表达式包括负回顾后,我们知道Java的脚本不支持负回顾后的正则表达式。所以任何人都可以在JavaScript中建议一个等效的正则表达式。
AccessKey: (?<![A-Z0-9])[A-Z0-9]{20}(?![A-Z0-9])
This means find me 20-character, uppercase, alphanumeric strings that don’t have any uppercase, alphanumeric characters immediately before or after.
SecretKey: (?<![A-Za-z0-9/+=])[A-Za-z0-9/+=]{40}(?![A-Za-z0-9/+=])
This means find me 40-character, base-64 strings that don’t have any base 64 characters immediately before or after.
样品字符串:https://regex101.com/r/wn7t9D/3
任何帮助/建议真的赞赏。
感谢 鲁曼
请张贴*串*你想在这里相匹配,而不是发布一个链接 – choz
不好意思忘了缩进正则表达式行说明,编辑一职。谢谢 –
你可以扭转一个字符串,并申请积极的前瞻... –