I have a regular expression pattern, which validates for a three digit number
/^\\d{3}$/.test(\"123\") // true /^\\d{3}$/.test(\"123.\") // false <
/^\\d{3}$/.test(\"123\") // true /^\\d{3}$/.test(\"123.\") // false
According to your last edit, this should work:
/^#[a-fA-F0-9]{0,6}$/