View Code
String regEx="[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]"; Pattern p = Pattern.compile(regEx); Matcher m = p.matcher(name); if( m.find()){ Toast.makeText(InputRegisterInfoActivity.this, "姓名不允许输入特殊符号!", Toast.LENGTH_LONG).show(); }