Regex for only allowing letters, numbers, and commas? -


i have label name called "color scheme" , input showing hex colors inputted.

i have limited max length 27 when input hex colors, 222222,000000,999999,ffeb00. default, put commas in myself, want regex automatically input comma end of hex color , allow letters, numbers, , commas.

does regex code this?

if hex values 6 chars long, try this:

^([0-9a-fa-f]{6}(,|$)){4} 

see live demo.


Comments