Replacing regexp with is_a? to understand the type of value