regex - CloudFormation 参数动态正则表达式

标签 regex amazon-web-services aws-cloudformation

我有一个带有 2 个参数的 CloudFormation 模板。我想为第二个参数设置一个AllowedPattern 值,以便根据第一个参数的值动态生成其正则表达式。像这样的事情:

CloudFormation 参数

WebsiteDomain:
  Type: String
EmailAddress:
  Type: String
  AllowedPattern: !Sub '.*@${WebsiteDomain}'

允许输入

WebsiteDomain: google.com
EmailAddress: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="acd8c9dfd8eccbc3c3cbc0c982cfc3c1" rel="noreferrer noopener nofollow">[email protected]</a>

不允许的输入

WebsiteDomain: google.com
EmailAddress: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0f7b6a7c7b4f766e676060216c6062" rel="noreferrer noopener nofollow">[email protected]</a>

有什么办法可以实现这一点吗?

最佳答案

您必须使用 CloudFormation macro用于在实际部署之前对模板进行预处理。否则,你就不能做你不想做的事。

关于regex - CloudFormation 参数动态正则表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68642538/

相关文章:

c++ - 如何检测两个正则表达式在它们可以匹配的字符串中是否重叠?

amazon-web-services - AWS SageMaker RL 与 ray : ray. tune.error.TuneError:未指定可训练项

amazon-web-services - Cloudformation - 将多个堆栈连接在一起

amazon-web-services - 在 CloudFormation 中的多个 LoadBalancer 后面添加实例?

C# 正则表达式在字符串匹配后查找并删除文本

regex - 如何 : Searching for a string in a file from the Windows command line?

python - pandas:列格式问题导致合并问题

ios - 如何更新 IOS 推送通知中的角标(Badge)编号?

amazon-web-services - 无法运行 AWS -Nuke

amazon-web-services - 如何向 AWS API Gateway 自定义授权方提供 Lambda 权限?