找出 Discord webhooks 的正则表达式 link

Figuring out a regex for Discord webhooks link

我是正则表达式的新手,我正在尝试实现一些从 Discord link 获取 Webhook ID 和令牌的代码。示例:

https://discordapp.com/api/webhooks/ID/TOKEN/

到目前为止我已经设法做到了:(我不确定它是否正确)

https:\/\/.+\/api\/webhooks\/

正则表达式应该只找到 IDTOKEN

我是新手,如有任何帮助和建议,我们将不胜感激。

let res = "https://discordapp.com/api/webhooks/ID123/TOKEN123/".match(/discordapp.com\/api\/webhooks\/([^\/]+)\/([^\/]+)/);

console.log(res[1]) // ID
console.log(res[2]) // TOKEN