Regular Expression (including Hong Kong, Macao and Taiwan) and jQuery Regular Expression for verifying mobile phone number email ID card
I have never used the regular expression verification system. I made a demo this time and used it all at once. I will take it directly next time.
The following code uses JQuery for verification on the page, and is also used for
Java e-commerce common regular expression mobile phone number email ID verification code, etc.Package cn.java.com;Import Java.util.regex.Pattern;/*** Account-related attribute verification tool**/public class Verifyutil {/*** Regular expression: Verify user name*/public static final String regex_username = "^[a-za-z]\\w{5,20}$"; /*** Regular expression: Verify pa
In the project, we are validating the user's input, the simplest way is to use regular expression, iOS system also provides a very convenient way, so that we can easily verify the user name, password, id good, mobile phone number, etc.Here is a validation method for the regular expression I used in my project,Due to the more commonly used, it is best to encapsula
Regular expressions (regular expression) are an object that describes the character pattern. Use regular expressions to perform powerful pattern matching and text retrieval and replacement functions. ID Card Regular: Identity card Regular expression (15-bit) isidcard1=/^[1-9]\d{7} ((0\d) | ( 1[0-2]) (([0|1|2]\d) |3[0-1]) \d{3}$/;//ID Regular expression (18-bit) isidcard2=/^[1-9]\d{5}[1-9]\d{3} ((0\d) | ( 1[
This article mainly introduces PHP with asterisks to hide some of the user name, ID, IP, mobile phone number and other examples, the need for friends can refer to the following A, imitation Taobao comments purchase records hidden part of the user name, the following code is available. nbsp; nbsp; Code as follows: function Cut_str ($string, $sublen, $start = 0,
JS mobile phone number, zip code, area code, ID card Verification program
Mobile phone Number Inquiryfunction Checkmobile () {var smobile = Document.mobileform.mobile.valueif (!) ( /^13[0-9]d{4,8}$/.test (Smobile))) {Alert ("Please enter your mobile
JS Regular verification Mobile phone numbervar // Get Phone number var telreg =!! Tel.match (/^ (\d{11}) |^ ((\d{7,8}) | ( \D{4}|\D{3})-(\d{7,8}) | (\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}) | (\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})) $) $/); if false { alert ("Please fill in the telephone information correctly");}JS Regular verification 15,18 is a so
In php, replace the characters at the specified position in the string with asterisks. our function can be used to implement substr, preg_replace, substr_replace, and so on. I will respectively assign these three functions
In php, replace the characters at the specified position in the string with asterisks. our function can be used to implement substr, preg_replace, substr_replace, and so on. below we will introduce one instance for the three functions respectively, we mainly talk about the
In php, replace the characters at the specified position in the string with asterisks. Our function can be used to implement substr, preg_replace, substr_replace, and so on. Below we will introduce one instance for the three functions respectively, we mainly talk about the phone number and ID card.
Replace the phone
Function checkform1 (){
If (form1.username. value = ""){Alert ("name cannot be blank! ");Return false;}If (! Iscardname (form1.username. Value )){Alert ("name error! ");Return false;}If (form1.usercode. value = ""){Alert ("ID card number cannot be blank! ");Return false;}If (! Isidcard (form1.usercode. Value )){Alert ("Incorrect ID card
Ask to avoid the problem that the xls file phone number exported by phpexcel and the ID card are displayed in scientific notation! Phpexcel is used for export in recent projects, which is relatively good, but there are several headaches, that is, when exporting data columns, data of the type 013434342333, 053482371284, and 42221312312312312312213 is automatically
Replace the phone number string with the asterisk code: The code is as follows:Copy code $ Str = "15832818835 ";Echo substr ($ str,). '*****'. substr ($ str, 8, strlen ($ str); // retain the first and last three digits?>Or use regular expressions.$ S = 'manager Wang of www .111cn.net: 13999312365 manager Li: 13588958741 ';$ S = preg_replace ('# (d {3}) d {5} (d {3 })#',
A character in a string specified in PHP is replaced with an asterisk we have a function that can be implemented such as Substr,preg_replace,substr_replace and so on, I give these three functions respectively to introduce an example, mainly talk about telephone, ID card.
Replace the phone number string with the asterisk code:
The code is as follows
Regular expressions (regular expression) are an object that describes the character pattern. Use regular expressions to perform powerful pattern matching and text retrieval and replacement functions.ID Card Regular://身份证正则表达式(15位)isIDCard1=/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$/;//身份证正则表达式(18位)isIDCard2=/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/;身份证正则合并:(^\d{15}$)|(^\d{17}([0-9]|X)$)The latest mobile phone
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.