Fix Java regex syntax for disallowed characters

The dash character needs to be escaped so that it is not treated as regular expression syntax for a range of characters between the colon and underscore (':-_').