diff --git a/lib/node-libnmap.js b/lib/node-libnmap.js
index <HASH>..<HASH> 100644
--- a/lib/node-libnmap.js
+++ b/lib/node-libnmap.js
@@ -180,7 +180,8 @@ var version = 'v0.0.7'
       }
 
       if (opts.ports) {
-        if (!/(\d+){1,6}|((\d+){1,6}\-(\d+){1,6})/.test(opts.ports))
+        /* http://stackoverflow.com/a/21075138/901697 */
+        if (!/^(?:(?:^|[-,])(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6(?:[0-4][0-9]{3}|5(?:[0-4][0-9]{2}|5(?:[0-2][0-9]|3[0-5])))))+$/.test(opts.ports))
           throw 'Port(s) must match one of the following examples:'+
             '512 (single) | 0-65535 (range) | 22-25,80,443,3306 (multiple)'
       }
setup: verify()

methods:
 setup:
  verify(): Updated regex & comment to verify port ranges