Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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()
Source by www.sitepoint.com #
 
PREVIOUS NEXT
Tagged: #javascript #check #number #hexadecimal
ADD COMMENT
Topic
Name
3+5 =