diff --git a/lib/network/dotparser.js b/lib/network/dotparser.js index 758c3131fc..90c7417ce3 100644 --- a/lib/network/dotparser.js +++ b/lib/network/dotparser.js @@ -115,15 +115,37 @@ function nextPreview() { return dot.charAt(index + 1); } -var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/; /** - * Test whether given character is alphabetic or numeric + * Test whether given character is alphabetic or numeric ( a-zA-Z_0-9.:# ) * * @param {string} c * @returns {boolean} isAlphaNumeric */ function isAlphaNumeric(c) { - return regexAlphaNumeric.test(c); + var charCode = c.charCodeAt(0); + + if (charCode < 47) { + // #. + return charCode === 35 || charCode === 46; + } + if (charCode < 59) { + // 0-9 and : + return charCode > 47; + } + if (charCode < 91) { + // A-Z + return charCode > 64; + } + if (charCode < 96) { + // _ + return charCode === 95; + } + if (charCode < 123) { + // a-z + return charCode > 96; + } + + return false; } /**