The code is as follows
function Funcmtel ($STR)//mobile number Regular expression test
{
Return (Preg_match ("/(?: 13d{1}|15[03689]) d{8}$/", $str))? True:false;
}
Test
18678785887
Return to
False
Cause analysis, see the discovery that the above is only validated with 13, 15, the beginning of the natural 18 is not available
After modification
The code
protected void Button1_Click (object sender, EventArgs e){if (Regex.IsMatch (TextBox1.Text.Trim (), @ "^\d{7,11}$")){String num = TextBox1.Text.Trim (). Substring (0, 7);DataRow dr = DAL.oledb.ExecuteDataRow ("Db.mdb", "SELECT * from list where num =?", num);if (dr! = null){Response.Write (TextBox1.Text.Trim () + "}}}ASP. NET implementation of mobile phone number attribution to query, the
Recently, I was busy with the business Assistant of the company. I found some problems with mobile phone number verification. When I fixed the bug myself, my colleagues used the system to write some functions. I looked at the prototype of the function. Although simple, I still stayed to learn or use it whenever.
Function GetMobileType (mobile: string): integer; //-1 error, PHS, mobile
Note: According to the Android security mechanism, when using Telephonymanager, you must add the Androidmanifest.xml in theName= "Read_phone_state"/> cannot obtain permission from the system.
Android development platform, you can get the local number through Telephonymanager.
Cases
The code is as follows
Copy Code
Private String Get
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.