lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


  I just released org.conman.parsers.url 2.0.1 [1], a module to parse URLs
(as defined in RFC-3986) into an easy to use table.  Some examples:

        url = require "org.conman.parsers.url"
        x = url:match "https://example.com/cgi-bin/search?q=foo%20bar&lang=en#anchor-2";

        x =
        {
          scheme = "https",
          host = "example.com",
          port = 443,
          query = "q=foo%20bar&lang=en",
          fragment = "anchor-2",
          path = "/cgi-bin/search",
        }

        x = url:match "https://fred:password@example.com:4443/one/two/three.html";

        x =
        {
          scheme = "https",
          host = "example.com",
          path = "/one/two/three.html",
          port = 4443,
          user = "fred:password",
        }

  Available via LuaRocks: "luarocks install org.conman.parsers.url".

  -spc (Enjoy)

[1]     Source code:
	https://github.com/spc476/LPeg-Parsers/blob/e9006470a020d0aa3899919617392ba74d332dae/url.lua