Skip to content

Full Toolkit for Next-Level Domain Analysis

Allow leading underscores in domains ✅

Felix Wotschofskyd1adddda03f8
diff --git a/lib/utils.ts b/lib/utils.ts
index 9a63f0f..feaa14f 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -36,8 +36,8 @@ export const isValidDomain = (domain: string) => {
// Check total length (maximum 253 characters)
if (domain.length > 253 || domain.length === 0) return false;
- // Remove wildcard prefix & trailing dot (if fully qualified domain name)
- const cleanedDomain = domain.replace(/^\*\./, '').replace(/\.$/, '');
+ // Remove wildcard prefix or leading underscore, trailing dot (if fully qualified domain name)
+ const cleanedDomain = domain.replace(/^(\*\.)|_/, '').replace(/\.$/, '');
// Split domain into labels
const labels = cleanedDomain.split('.');