Refactor reference regexes and identity scopes
What does this MR do?
This MR makes some changes to the
Identity model and
Mentionable::ReferenceRegexes to make it easier to extend this code in EE. This is necessary for https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/8198 as otherwise we can not move
prepend to the end of the file, which in turn means we can't reduce the chance of running into merge conflicts for these files.