Verifying the phone number regular expression
Now the number is too much, everything has, then relax the requirements of the Bai
A combination of 11-digit numbers starting with 1
/** * Verify mobile phone number * @param phonenumber Mobile Number * @return Boolean * /Public static Boolean Checkphonenumber ( String phonenumber) { Pattern pattern=pattern.compile ("^1[0-9]{10}$"); Matcher Matcher=pattern.matcher (phonenumber); return matcher.matches (); }
Verify user names, such as 6-to 12-digit alphanumeric combinations
/** * Verify user name * @param username username * @return Boolean * /public static Boolean Checkusername ( String username) { string regex = "([a-za-z0-9]{6,12})"; Pattern p = pattern.compile (regex); Matcher m = p.matcher (username); return m.matches (); }
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android authentication phone number, user name regular expression