// escape all characters that have special meaning in regexps
// (i.e. '.', '[', '{', '*', and others)
var re = host.replace(
- /\*([a-z0-9\\-_\.])|[\.,\-\\\^\$+?*\[\]\(\):!\|{}]/g,
- function(all, sub) {
- if (sub) return '[a-z0-9\\-_]*' + (sub === '-' ? '\\-' : sub);
- return '\\' + all;
- }
- );
+ /\*([a-z0-9\\-_\.])|[\.,\-\\\^\$+?*\[\]\(\):!\|{}]/g,
+ function(all, sub) {
+ if (sub) return '[a-z0-9\\-_]*' + (sub === '-' ? '\\-' : sub);
+ return '\\' + all;
+ });
return new RegExp('^' + re + '$', 'i');
}
}
return valid;
-};
+}
exports.checkServerIdentity = checkServerIdentity;