如何从 Lua 中的 url 中提取子域名?
例如。如果我有一个网址https://foo.bar.com/path1,我需要像下面这样
https://foo.bar.com/path1
get_subdomain("https://foo.bar.com/path1") should return "foo"
如果可能的话,我想要一个可以同时使用http和httpsurl 的解决方案。谢谢
http
https
我尝试使用正则表达式,但 Lua 不支持 POSIX 兼容的正则表达式。
lua nginx
lua ×1
nginx ×1