check value exists before regexp test