Throw an error when encountering invalid characters.

This should close out #9

I tried keeping the regex to the bare minimum need to check for characters, and letting the rest of the code check for the validity of the combination of characters.