我们如何在re2中进行多重比赛?
以下是我要在
上应用正则表达式的网址https://c43545332542.us-east-1.amazonaws.com/new_stage
下面是我的代码
value = "${replace(aws_api_gateway_deployment.deployment.invoke_url,"/(?i)https:///","")}"
我可以替换
https://
与
“”
我还需要摆脱
/ new_stage
我如何在单行中同时实现这两者
答案 0 :(得分:1)
Try the following regular expression:
value = "${replace(aws_api_gateway_deployment.deployment.invoke_url,"/(?i)https://([^/]+).*/*/","$1")}"
This should help you match and replace the parts that you need.