i found the String.matches must match the whole string,could not match part of string
http://stackoverflow.com/questions/4771447/java-string-matches-regex-with-or-pipe
this is a trap
package ZZZZ;
import java.util.regex.PatternSyntaxException;
public class cc {
public static void main(String[] args) {
String subjectString="我__";
// TODO Auto-generated method stub
try {
String regex="[^a-zA-Z0-9]*$";
boolean foundMatch = subjectString.matches(regex);
System.out.println(foundMatch);
} catch (PatternSyntaxException ex) {
// Syntax error in the regular expression
System.out.println(ex.toString());
}
}
}