lua-users home
lua-l archive

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


On Tue, 27 Dec 2022, vale.gua wrote:

> s = os.getenv("HOSTNAME") to catch the FQDN, therefore the result is:
> vimhost-axzh9a.ch.bwww.com

> Is possible, with LUA, to cut from FQDN:
> vimhost-
> and
> .ch.bwww.com

local s = "vimhost-axzh9a.ch.bwww.com"
local h1, h2, h3 = string.match(s, "([^%-]+)%-([^%.]+)%.(.+)")
print(h1, h2, h3)

Best Regards
Hartmut