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 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/a69fb66dda023a17be72ba2f2655b6b17a60d8e5/url.lua