From 78c25f8b6dc8c841c2200bab6bfcbf2071f2f3c1 Mon Sep 17 00:00:00 2001 From: elhoim Date: Mon, 31 Aug 2026 00:02:06 +0000 Subject: [PATCH] Allow underscores in domain/hostname label regex looks_like_domain() excluded underscores from its label character class, so DMARC/DKIM-style hostnames like _dmarc.example.com were never recognised as domains and no guess was offered for them. Add '_' to the label regex character class. --- bin/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cli.py b/bin/cli.py index 92267b1..0d04e0f 100644 --- a/bin/cli.py +++ b/bin/cli.py @@ -156,7 +156,7 @@ def looks_like_domain(value: str) -> bool: labels = value.split(".") if len(labels) < 2: return False - label_re = re.compile(r"^[A-Za-z0-9-]{1,63}$") + label_re = re.compile(r"^[A-Za-z0-9_-]{1,63}$") return all( label_re.match(label) and not label.startswith("-") and not label.endswith("-") for label in labels