Not that I'm a Regex guru, but could you just condense this down to:

`\A\b[0-9a-fA-F]{6}\b\Z`

and make the if statement more terse?