Use a regular expression to verify whether the input is a number
Sometimes the content entered in the text box must be data. How can we determine whether the content entered by the user is legal? Here I use a regular expression to achieve this effect, two lines of code (C #) done! Haha...
Static bool isnumeric (string Str)
{
System. Text. regularexpressions. RegEx reg1
= New system. Text. regularexp
Verification number: ^ [0-9] * $
Verify the n-digit number: ^ \ D {n} $
Verify at least N digits: ^ \ D {n,} $
Verify M-N digits: ^ \ D {m, n} $
Verify the number starting with zero or
The ID card number is divided into two, the old one is 15 digits, the new one is 18 digits. ID Card 15-bit encoding rule: dddddd yymmdd xx P dddddd: Region code YYMMDD: Date of birth XX: Sequence class code, cannot determine p: sex, odd for male, even for female; ID 18-bit encoding rule: dddddd yy YYMMDD XXX dddddd: Area code yyyymmdd: birth date XXX: Sequence class code, cannot determine, odd number is mal
1. Verify the e-mail addressThis is a regular expression for validating e-mail messages. But it's not an efficient, perfect solution. Not recommended for use here.$email = "[email protected]"; if (Preg_match ('/^[^0-9][a-za-z0-9_]+ ([.] [a-za-z0-9_]+) *[@][a-za-z0-9_]+ ([.] [a-za-z0-9_]+) *[.] [A-za-z] {2,4}$/', $email)) {echo "Your email is ok.";} else {echo "wrong email address format";}For more effective verification of e-mail addresses, we recomme
FunctionvalidateNum (val) {// verify the integer varpatten/^ -? \ D + $/; returnpatten. test (val);} functionvalidateRealNum (val) {// verify the real number varpatten/^ -? \ D + \.? \ D * $/; returnpatten. test (val);} fu
Function validateNum (val) {// verify the integerVar patten =/^ -? \ D + $ /;Return patten. test
If you want to do a cell phone number verification, then we need to know the number of mobile phone number section.//Mobile number Attribution support Segment: 134 135 136 137 138 139 147 151 152 157 158 159 178 183 184 187 188
China Unicom number Attribution Support
Jquery practice case -- verify the mobile phone number and jquery case
If you want to verify the mobile phone number, you need to know the number segment of the mobile phone number.
// Supported mobile phone numbers: 134 135 136
Recent projects with the need to call the real-name authentication interface, real-name authentication interface price is not a few cents higher than the text message, so call the real-names authentication conditions to strictly check, so the use of JS to verify the real title and JS Authentication ID number.Go to the ChaseJS to verify the real name, is to use the Unicode character to match, and the Chinese
= document.getElementById (' Iputcode '). Value; Obtain the verification code that the registered user fills invar yzmtwo = document.getElementById (' Iputcode '). ClassName; Verification code sent by the systemif (Yzm = = "") {Alert ("Verification code cannot be empty");return false;}else if (yzm! = yzmtwo) {Alert ("Verification code error, please re-enter!") ");Eturn false;}return true;}Click Next to verify that the verification code is correct$ (f
Here is the regular expression that the mobile official pulled down:Determine if a string is a mobile phone number0 is the cell phone number 1 is not the 11 digit number 2nd code prefix is incorrectUsed to verify the number of digits in the mobile phone number and check whet
This article brings you the content is about PHP activity how to verify whether the user is concerned about the public number, there is a certain reference value, the need for friends can refer to, I hope to help you.
When we do activities, some activities require users to pay attention to the public number in order to continue activities or send gifts. This re
code example to verify phone number format:In some forms you need to verify the phone format is correct, of course, there are many ways to verify, the following is a common code.The code is as follows:functionIsMobile (MOBILE) {if(mobile.length!=11) {alert (' Please enter a valid mobile phone
In some personnel information system, may ask to fill in the person's identity card number, but how to verify the format of the ID number is legal? We write the validated SQL as a stored procedure to facilitate repeated calls.First of all, we need to understand the composition of our identity number rules:1, 18-digit I
Jquery Regular Expression verification: Verify that the number is 12 bits, jquery Regular Expression
Requirement Description:
The front-end page uses regular expressions to verify that the input data is a 12-digit number.
Code Description:
Only regular expressions are introduced here, and other parts of the Code ar
/*** Convert dates to YYYY-MM format.* Help verify that two times are in the same year of the month* @param datestr*/function Formatyearmonth (b_date) {var b_date_year = B_date.getyear ();var b_date_month = B_date.getmonth () +1;if (B_date_month B_date_month = "0" + b_date_month;}return b_date_year + "" + b_date_month;}function Getdatesub (date_b,date_e) {The following must have, otherwise it will be but a Nanvar b_date = new Date (Date.parse (Date_b.
Provides various official and user-released code examples. For code reference, you are welcome to learn how to verify that the ID card number entered by the user is valid?
Most of the verification methods on the Internet only perform a simple verification of the ID card number format, and do not verify the validity of
Use the js regular expression to verify the mobile phone number, email address, and zip code. If you want to verify your mobile phone number, you can refer to it for reference. (11 digits are entered at the beginning of "13" and "158,159)
The Code is as follows:
Var re;Var ss = document. getElementById ('textbox3 ').
: A numeric value representing the ID number at position i
Wi: Indicates the weighting factor at position I
Wi:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
2. Calculation mode
Y = mod (S, 11)
3. Get the corresponding check code by the module
Y:0 1 2 3 4 5 6 7 8 9 10
Check code: 1 0 X 9 8 7 6 5 4 3 2
To verify the ID number method:
This article explains how to use PHP to
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.