Answers for "javascript check if string is valid hex color"

-1

javascript check if string is valid hex color

// Match exactly 3 characters 1 or 2 times
var reg=/^#([0-9a-f]{3}){1,2}$/i;
console.log(reg.test('#ABC')); //true
console.log(reg.test('#AABBCC')); //true
Posted by: Guest on March-23-2022

Code answers related to "javascript check if string is valid hex color"

Code answers related to "Javascript"

Browse Popular Code Answers by Language