Check scope names for invalid characters

To prevent exceptions when converting the scope name to the class name
the scope is checked against a regex.