fork download
  1. import re
  2. config=r"""terminal width 120
  3. hostname IGN-HSHST-HSH-01-P
  4. domain-name sample.com"""
  5. REGEX_HOSTNAME = re.compile('^hostname\s(?P<hostname>(\w|\W)+?)(-p|-P|-s|-S)?$\n',re.MULTILINE)
  6. hostname = REGEX_HOSTNAME.search(config).group('hostname').lower().strip()
  7. print(hostname)
Success #stdin #stdout 0.03s 9368KB
stdin
Standard input is empty
stdout
ign-hshst-hsh-01