OK, I managed to test this and your regex patterns are incorrect. Pattern a accepts any alphabetic character followed by any alphanumeric character repeated a number of times. Pattern b accepts any alphanumeric character repeated between 8 and 41 times. So they basically accept most strings that you pass in. You need to make them more restrictive, see
Pattern (Java Platform SE 7 )[
^].