diff --git a/lua/gx/handlers/url.lua b/lua/gx/handlers/url.lua index 5381574..45214c6 100644 --- a/lua/gx/handlers/url.lua +++ b/lua/gx/handlers/url.lua @@ -10,7 +10,7 @@ local M = { -- get url from line (with http/s) function M.handle(mode, line, _) - local pattern = "(https?://[a-zA-Z%d_/%%%-%.~@\\+#=?&:*]+)" + local pattern = "(https?://[a-zA-Z%d_/%%%-%.~@\\+#=?&:*\\(\\)]+)" local url = helper.find(line, mode, pattern) -- match url without http(s) diff --git a/test/spec/gx/handlers/url_spec.lua b/test/spec/gx/handlers/url_spec.lua index 04b321d..1b421c5 100644 --- a/test/spec/gx/handlers/url_spec.lua +++ b/test/spec/gx/handlers/url_spec.lua @@ -48,6 +48,10 @@ describe("url_parser_does_work", function() "https://crontab.guru/#0_3_*_*_*", handler.handle("n", "https://crontab.guru/#0_3_*_*_*") ) + assert.equals( + "https://en.wikipedia.org/wiki/Castle_(shogi)", + handler.handle("n", "https://en.wikipedia.org/wiki/Castle_(shogi)") + ) end) it("urls in python", function()