public void onClick(View v) {
// TODO Auto-generated method stub
final String name = et_register_username.getText().toString().trim();
final String pwd=et_register_userpwd.getText().toString().trim();
final String email=et_register_email.getText().toString().trim();
switch (v.getId()) {
case R.id.btn_register_sure:
String c,b;
// c=name.charAt(0);
c=(String) name.subSequence(0, 1);
b=(String) pwd.subSequence(0, 1);
System.out.println(c);
System.out.println(b);
if(c.matches("^[a-zA-Z]*")||c.matches("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$")||c.equals("_")&&name.length()<=10){
if(b.matches("^[a-zA-Z]*")||b.matches("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$")||b.equals("_")&&pwd.length()<=10){
registerThred();
}else{
Toast.makeText(this, "必须以字母下划线开头,最长10位", Toast.LENGTH_SHORT).show();
} }
break;
限制的格式:用户名密码只能以字母下划线为开头