showing results for - "javascript check if number is hexadecimal"
Sofia
30 Jul 2017
1var re = /[0-9A-Fa-f]{6}/g;
2var inputString = 'AABBCC';
3
4if(re.test(inputString)) {
5    alert('valid hex');
6} else {
7    alert('invalid');
8}
9
10re.lastIndex = 0; // be sure to reset the index after using .text()
11