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