Skip to content

Instantly share code, notes, and snippets.

@masudak
Created March 5, 2015 06:50
Show Gist options
  • Save masudak/4e4b29f3129d78d4d955 to your computer and use it in GitHub Desktop.
Save masudak/4e4b29f3129d78d4d955 to your computer and use it in GitHub Desktop.
正規表現
def extract_hostname(fqdn):
    __pattern = r'([^\\.]+).+'
    regex = re.compile(__pattern, re.MULTILINE)
    for match in regex.finditer(fqdn):
        return match.group(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment