Skip to content

Instantly share code, notes, and snippets.

@lae
Created October 4, 2017 02:24
Show Gist options
  • Save lae/b2d6662fc722a554d7842366d7c33f49 to your computer and use it in GitHub Desktop.
Save lae/b2d6662fc722a554d7842366d7c33f49 to your computer and use it in GitHub Desktop.
>>> h = re.search('^(127\.0\.0\.1 (?!hello\.local hello( pvelocalhost)?$)|(?!127\.0\.0\.1)[\w.]*\b(hello\.local|hello)\b.*)', "127.2.0.1 hello.local")
>>> h
>>> h = re.search('^(127\.0\.0\.1 (?!hello\.local hello( pvelocalhost)?$)|(?!127\.0\.0\.1)[\w.]*\s+(hello\.local|hello)\b.*)', "127.2.0.1 hello.local")
>>> h
>>> h = re.search('^(127\.0\.0\.1 (?!hello\.local hello( pvelocalhost)?$)|(?!127\.0\.0\.1)[\w.]*\b(hello\.local|hello)(\s*|\s+.*))', "127.2.0.1 hello.local")
>>> h
>>> h = re.search('^(127\.0\.0\.1 (?!hello\.local hello( pvelocalhost)?$)|(?!127\.0\.0\.1)[\w.]*\s+(hello\.local|hello)(\s*|\s+.*))', "127.2.0.1 hello.local")
>>> h
<_sre.SRE_Match object at 0x7fbe68e30c00>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment