标签:java on text 字符串 c as tt 正则表达式
String content = “testContent”;
String regex="^[a-zA-Z0-9\u4E00-\u9FA5]+$";
Pattern pattern = Pattern.compile(regex);
Matcher match=pattern.matcher(content);
boolean b=match.matches();
if(b)
{
Toast.makeText(this, "success...", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(this, "fail...", Toast.LENGTH_SHORT).show();
}
java 正则表达式 验证字符串 只包含汉字英文数字,布布扣,bubuko.com
标签:java on text 字符串 c as tt 正则表达式
原文地址:http://www.cnblogs.com/lianghui66/p/3912840.html