Use a simple conditional rather than short circuit with next
Avoid a new hash allocation
Make code simpler to read by using a case statement
Cache regexp source on format validation to avoid allocating new objects

Example:

    >> r = /some-regexp/
    => /some-regexp/
    >> r.source.object_id == r.source.object_id
    => false