0
我想使用正则表达式过滤掉API调用名称。 问题是我无法从API调用中过滤出不需要的特定字符串。正则表达式:如何排除行内的特定字符串
在以下示例中,我需要从包含字符串“sg-”(如果存在)的API调用中过滤/剪切包含字符串本身以及其他字符串未触及的字符串。
这里是例子:
GET /api/cloudsecuritygroup/sg-91f988f7/history - 443
GET /api/cloudsecuritygroup/sg-30333554 - 443
GET /api/cloudaccounts/secret - 443
GET /api/audit/event-types - 443
GET /api/user/me/iam-safe/devices - 443
结果应该是这样的:
cloudsecuritygroup
cloudsecuritygroup
cloudaccounts/secret
audit/event-types
user/me/iam-safe/devices
你只是想检查一个与你的正则表达式的链接吗? – cansik
我想要做的是使用正则表达式获取API调用的名称。 – DuduSaharov
好吧,但是例如'audit/event-types'不包含'sg-'。那为什么它也是结果呢?或者你可以给出更多关于应该如何工作的规范?你到目前为止做了什么? – cansik