JavaScript cek apakah nomor 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()
Different Dolphin