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
![attribute_was activerecord dirty - apidock 2014-12-11 10-48-26](https://cloud.githubusercontent.com/assets/144138/5396850/58829b90-8123-11e4-9614-c30d1770fb55.png)