From dfbd82500cd9994fba893a59e1121206c928fc63 Mon Sep 17 00:00:00 2001 From: Tweak Date: Tue, 6 Sep 2022 20:31:37 -0600 Subject: [PATCH] Update utils.js to add support for multi level domains. --- utils/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/utils.js b/utils/utils.js index 30a770b..c4b192e 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -7,7 +7,7 @@ module.exports.checkIfValidIP = function(str) { module.exports.checkIfValidFQDN = function(str) { // Regular expression to check if string is a FQDN - const regexExp = /^(?!:\/\/)([a-zA-Z0-9-_]+\.)?[a-zA-Z0-9][a-zA-Z0-9-]+\.[a-zA-Z]{2,63}?$/gi + const regexExp = /(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)/gi return regexExp.test(str); };