Verification of mobile phone number email

Source: Internet
Author: User
<span id="Label3"></p><p><p>Package com.hengxin.qianee.utils;</p></p><p><p>Import java.net.InetAddress;</p></p><p>public class Regexutils {<br><br>/**<br>* User Name Conformance specification (^[\u4e00-\u9fa5a-za-z0-9_]+$)<br>* @return<br>*/<br>public static Boolean IsValidUserName (String Username) {<br>If (username==null | | Username.trim () = = "") {<br>Return false;<br>}<br><br>return username.matches ("^[\u4e00-\u9fa5a-za-z0-9_]{2,10}$");<br>}<br><br>/**<br>* Password Conformance Specification ([a-za-z\d]{6,20})<br>* @return<br>*/<br>public static Boolean Isvalidpassword (String Password) {<br>if (null = = Password) {<br>Return false;<br>}<br><br>return password.matches ("^ ([^\\s ' ']{6,20})");<br>}<br>public static Boolean Isvalidpassword (String Password) {<br>if (null = = Password) {<br>Return false;<br>//}<br>//<br>return password.matches ("[a-za-z\\d]{6,20}");<br>//}<br>/**<br>* is a valid mobile phone number<br>* @param mobilenum<br>* @return<br>*/<br>public static Boolean Ismobilenum (String Mobilenum) {<br>if (null = = Mobilenum) {<br>Return false;<br>}<br><br>return mobilenum.matches ("^ (13[0-9]) | ( 14[4,7]) | (15[^4,\\d]) | (17[6-8]) | (18[0-9])) (\\d{8}) $ ");<br>}<br><br>/**<br>* is a valid mailbox<br>* @param Email<br>* @return<br>*/<br>public static Boolean Isemail (String Email) {<br>if (null = = Email) {<br>Return false;<br>}<br><br>return email.matches ("^ ([a-za-z0-9]) + ([a-za-z0-9_.-]) [email protected] ([a-za-z0-9_-]) + ((\\.[ A-za-z0-9_-]{2,3}) ($ ");<br>}<br><br>/**<br>* Whether it is QQ mailbox<br>*/<br>public static Boolean Isqqemail (String Email) {<br>if (null = = Email)<br>Return false;<br><br>return email.matches ("^[\\s\\s]* @qq. com$");<br>}<br><br>/**<br>* Whether numbers (decimals | | Integer<br>* @param number<br>* @return<br>*/<br>public static Boolean Isnumber (String Number) {<br>if (null = = Number) {<br>Return false;<br>}<br><br>Return number.matches ("^[+-]?" ( ([1-9]{1}\\d*) | ([0]{1})) (\\. (\\d) +)? $ ");<br>}<br><br>/**<br>* Whether integer<br>* @param number<br>* @return<br>*/<br>public static Boolean Isint (String Number) {<br>if (null = = Number) {<br>Return false;<br>}<br><br>Return number.matches ("^[+-]?" ( ([1-9]{1}\\d*) | ([0]{1})) $");<br>}<br><br>/**<br>* Whether positive integers<br>* @param number<br>* @return<br>*/<br>public static Boolean Ispositiveint (String Number) {<br>if (null = = Number) {<br>Return false;<br>}<br><br>Return number.matches ("^[+-]?" ( ([1-9]{1}\\d*) | ([0]{1})) $");<br>}<br><br>/**<br>* Whether the date yyyy-mm-dd (yyyy/mm/dd)<br>* @param date<br>* @return<br>*/<br>public static Boolean isDate (String Date) {<br>if (null = = Date) {<br>Return false;<br>}<br>return date.matches ("^ ([1-2]\\d{3}) [\\/|\\-] (0?[ 1-9]|10|11|12) [\\/|\\-] ([1-2]?[ 0-9]|0[1-9]|30|31) $ ");<br>}<br><br>/**<br>* comma-delimited Regular expressions<br>* @param str<br>* @return<br>*/<br>public static string Getcommasparatedregex (string Str) {<br>if (str = = Null) {<br>Return null;<br>}<br><br>return "^ (" +str+ ") | ([\\s\\s]*, "+str+") | ("+str+", [\\s\\s]*) | ([\\s\\s]*, "+str+", [\\s\\s]*) $ ";<br>}<br><br>/**<br>* String contains<br>* @return<br>*/<br>public static Boolean contains (string str, string Regex) {<br>if (str = = NULL | | regex = = Null) {<br>Return false;<br>}<br><br>return str.matches (regex);<br>}<br><br>/**<br>* is 16,19 or 22-digit bank account number<br>* @param bankAccount<br>* @return<br>*/<br>public static Boolean Isbankaccount (String BankAccount) {<br>if (null = = BankAccount) {<br>Return false;<br>}<br> <br>return bankaccount.matches ("^ (\\d{19}|\\d{16}|\\d{22}) $");<br>}<br><br>/**<br>* Get the native IP<br>* @return<br>*/<br>public static String GetIP () {<br><br>InetAddress ia=null;<br>try {<br>Ia=ia.getlocalhost ();<br><br>String localip=ia.gethostaddress ();<br>String Localname=ia.gethostname ();<br>System.out.println ("machine name:" + localname);<br>System.out.println ("ip of this machine:" +localip);<br><br>Return localip;<br>} catch (Exception E) {<br>E.printstacktrace ();<br>}<br><br>Return "127.0.0.1";<br>}<br><br>}</p><p><p>Verification of mobile phone number email</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.