The following regex picks up most mail server names of the form mail.example.com
([a-zA-Z0-9-]+\.{1,}[a-zA-Z0-9-]+\.[a-zA-Z0-9-]{2,})
as shown here.
How do we expand it such that it matches domains with one (or more) additional subdomains e.g.
b-app05-06.boldchat.com
ns126a.ba1.enops.net
NHQSDFEXCHUB01.nam.coair.com
ncsmcexchub01.nam.coair.com


You can enclose the last subpattern into a non-capturing group and set a
+quantifier:EXPLANATION:
\b- Word boundary[\w-]+- A character class that matches an alphanumeric or a hyphen(?:\.[\w-]+){2,}- a non-capturing group that matches 2 or more sequences of a literal dot and 1 or more alphanumeric characters or hyphen\b- Word boundarySee demo