lua-users home
lua-l archive

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


It work, many thanks :)

------- Original Message -------
Il martedì 27 dicembre 2022 11:38 AM, Hartmut Henkel <hartmut_henkel@gmx.de> ha scritto:


> 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