Hi I use a regular expression to validate the username and password.
It looks like this:
java.util.regex.Pattern p = java.util.regex.Pattern.compile("[0-9a-zA-Z.@_-]{6,50}");
Now I also want to allow the user to use the characters '�', '�', '�', '�', '�', '�'. I have tried to add the character as below, but it does not work?
java.util.regex.Pattern p = java.util.regex.Pattern.compile("[0-9a-zA-Z.@_-������]{6,50}");
Instead of trying to enumerate all accented letters, you should use character classes like "\p{L}". See the javadocs of java.util.regex.Pattern for more details.
Also, a minus sign must be the last character in your regex if it is taken to be a literal minus sign. You got that right in the first regex, but wrong in the second one.