Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
Comment

PREVIOUS NEXT
Code Example
Javascript :: regex for company name 
Javascript :: zoom out browser javascript 
Javascript :: iterata a array in js 
Javascript :: nextjs localstorage 
Javascript :: extract words from string js 
Javascript :: is_int js 
Javascript :: auto closing parenthese not working on vscode 
Javascript :: hide a div when user clicks outside of it 
Javascript :: how to make a 2 value after point javascript 
Javascript :: js for in object 
Javascript :: kendo clear selection 
Javascript :: toast in react native 
Javascript :: JAVASCRIPT KEYDOWN AROW 
Javascript :: javascript insert before 
Javascript :: click outside javascript 
Javascript :: Handle an input with React hooks 
Javascript :: javascript truncate array 
Javascript :: do while loop 
Javascript :: find element by two attributes jquery 
Javascript :: compare two arrays and make sure there are no duplicates js 
Javascript :: search text in div jquery 
Javascript :: refresh page and run function after javascript 
Javascript :: hide component on click vue 
Javascript :: get all entries in object as array hjs 
Javascript :: angular production vs development mode 
Javascript :: react router dom install 
Javascript :: error while connecting mongodb MongoParseError: option usefindandmodify is not supported 
Javascript :: remove event listener jquery 
Javascript :: kb to mb js 
Javascript :: read a file nodejs 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =