Converting #99FF99 to a number

Does anyone have a function that checks whether a value is in the format “#99FF99” and if so, returns a decimal number??