Update utils.js to add support for multi level domains.

This commit is contained in:
Tweak authored and GitHub committed 2022-09-06 20:31:37 -06:00
1 parent 7d302fde71
commit dfbd82500c
1 file changed
+1 -1
+1 -1
View File
@@ -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);
};