I am VERY rusty with regular expressions and need one to extract a hostname from a fully qualified domain name (FQDN), here’s an example of what I have:
myhostname.somewhere.env.com
myotherhostname.somewhereelse.insomeotherplace.byh.info
and I want to return
myhostname
myotherhostname
Would really appreciate some help
I tried "(.+)\." but it matched the string from the right and produced:
myhostname.somewhere.env.
myotherhostname.somewhereelse.insomeotherplace.byh.
use this regexepression
(.+?)(?=\.)