我们如何在 re2 中进行多重匹配?
下面是我想应用正则表达式的网址
https://c43545332542.us-east-1.amazonaws.com/new_stage
下面是我的代码
value = "${replace(aws_api_gateway_deployment.deployment.invoke_url,"/(?i)https:///","")}"
我可以更换
https://
跟
">
我还需要摆脱
/new_stage
如何在单行中实现两者
尝试以下正则表达式:
value = "${replace(aws_api_gateway_deployment.deployment.invoke_url,"/(?i)https://([^/]+).*/*/","$1")}"
这应该可以帮助您匹配和更换所需的零件。