I know this probably isn't the answer you are looking for, but if your design has users deciding your schema names, but you don't trust your users, you really need to do a re-design. Having your users decide on a schema name is akin to asking users to decide on class and function names.
If you really, really want to do this, I would use a regular expression to limit to something like 16 alphanumeric characters only, starting with an alphabetic character, after being forced lowercase (/^[a-z][a-z0-9]{1,15}$/). You will also need to explicitly filter out "public" as a schema name, information_schema (if you allow underscores as well), and other built-in schema names.
Again, I'll be willing to bet that you really don't want to do this, and that there's a better way to solve your underlying problem.