fixes bug, and passes all tests now.

please note that it's very exact, so in the regex are now \A and \z which means that they take the string as a whole, and if the string does not exactly match the pattern is declared invalid.