Refactoring.
Regex for keys: further refactoring, new functionality prepared.
Regex for keys: bugfix.