I want the user to enter a string and if the string does not match my regex expression then I want a message to be outputted and the user to enter a value again.
The pro
The equals methods checks for string equivalence, not for matching regular expressions.
equals
Just replace equals with matches. You should also remove the outer square brackets.
matches
Could it be that your regexp is wrong?
test.matches("[A-Z][a-zA-Z]*,\\s[A-Z][a-zA-Z]*")
works fine for me.