[ActiveRecord::validations] check CNAME or Empty

Hi I wanna check in my model if the field is conform to a CNAME OR is empty

I've put something like this in my model :

  validates_format_of :cname, :with => /^[a-z0-9\-]+$/i,                               :unless => :cname.strip == ''