Given a string like #fff443 or #999999
How do I verify that the string has:
- 7 characters, with the first one being a hash
- no symbols in the string besides the hash in the beginning
Given a string like #fff443 or #999999
How do I verify that the string has:
 
    
     
    
    It seems that you are matching against a css color:
function isValidColor(str) {
    return str.match(/^#[a-f0-9]{6}$/i) !== null;
}
To elaborate:
^ match beginning
# a hash
[a-f0-9] any letter from a-f and 0-9
{6} the previous group appears exactly 6 times
$ match end
i ignore case
