Instead of a Pattern argument can't define an interface that has a function to match an individual character? something like?

boolean isValidCharacter(char c)

that can be called by the loop and the exception thrown if it return false.