Prevents trying to find an identity based on an empty regex

Ran into an issue in another application which caused extra identities
to be created, when the value went from nil to a value. Cannot recreate
in this test suite, but this solves the issue in the application
Doesn't look like it: https://github.com/rails/rails/blob/master/activemodel/lib/active_model/dirty.rb