mirror of
https://github.com/Nezumi-2711/cloudflare-gateway-pihole-scripts.git
synced 2026-09-22 13:38:37 +00:00
Merge pull request #51 from hlqviet/fix/domain-regex-pattern
Fix domain validation
This commit is contained in:
+3
-1
@@ -12,7 +12,9 @@ if (!globalThis.fetch) {
|
||||
* @param {string} value The value to be checked.
|
||||
*/
|
||||
export const isValidDomain = (value) =>
|
||||
/^(?!-)[A-Za-z0-9-]+([\-\.]{1}[a-z0-9]+)*\.[A-Za-z]{2,6}$/.test(value);
|
||||
/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(
|
||||
value
|
||||
);
|
||||
|
||||
/**
|
||||
* Extracts all subdomains from a domain including itself.
|
||||
|
||||
Reference in New Issue
Block a user