javascript check if number is hexadecimal

JavaScript
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()

Source

Also in JavaScript: