diff --git a/lib/dns-sync.js b/lib/dns-sync.js index d0574cb..21f7b57 100644 --- a/lib/dns-sync.js +++ b/lib/dns-sync.js @@ -3,10 +3,11 @@ var util = require('util'), path = require('path'), shell = require('shelljs'), + RE2 = require('re2'), debug = require('debug')('dns-sync'); //source - http://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address -var ValidHostnameRegex = new RegExp("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"); +var ValidHostnameRegex = new RE2("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"); // https://nodejs.org/api/dns.html#dns_dns_resolve_hostname_rrtype_callback var RRecordTypes = [ diff --git a/package.json b/package.json index 8c82466..8f00f16 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "readmeFilename": "README.md", "dependencies": { "debug": "^4", + "re2": "^1.15.4", "shelljs": "~0.8" }, "devDependencies": {