输入以下内容:
https://api.example.net:443/v1/domain/action
https://api.exmaple.net:443/v2/domain/action?tag=test
https://api.example.net:443/v3/domain/action/test
Grok正则表达式可以将以上所有内容分解为:
{
"request_endpoint": [
[
"https://api.example.net:443"
]
],"request_version": [
[
"v3"
]
],"request_domain": [
[
"domain"
]
],"request_api": [
[
"action"
]
]
}
这是我能够获得的最接近的数字,但是如果传递了第一个示例,则会出现一个/n
:
/(?<request_endpoint>[^/]+)+/(?<request_version>[^/]+)+/(?<request_domain>[^/]+)/(?<request_api>[^/!\?]+)
进行测试