Node.js examples for Regular expression:Validation
Validate Hex value using regex
Validator.validateHexvalue = function(hexValue) { var exp = /^#?([a-f0-9]{6}|[a-f0-9]{3})$/; if (hexValue.match(exp)) { return true; } else {/*from w w w . j ava2 s .c o m*/ return false; } };