how to check if a string is a valid 4 digit hexadecimal in javascript code example
Example: javascript check if number is hexadecimal
var re = /[0-9A-Fa-f]{6}/g;
var inputString = 'AABBCC';
if(re.test(inputString)) {
alert('valid hex');
} else {
alert('invalid');
}
re.lastIndex = 0; // be sure to reset the index after using .text()