JavaScript Regular Expression knowledge
Js Regular Expression knowledge Summary
Regular Expression:
1. What is RegExp? RegExp is the abbreviation of a regular expression. The RegExp object is used to specify the content to be retrieved in the text.
2. Define RegExp: var + variable name = new RegExp ();
3. The RegExp object has three methods:
1) test () retrieves the specified value in the string. The returned value is true or false.
var p1=new Reg(e);document.write(Reg.test(welcome to China!));
2) exec ()
var p1=new Reg(e);document.write(Reg.exec(welcome to China!));
3) compile ()
var p1=new Reg(e);document.write(Reg.compile(welcome to China!));
4. Modifier
1) I perform case-insensitive matching.
2) g performs global matching
3) m executes multi-row matching.
5. square brackets (used to find characters in a certain range)
1) [abc] searches for any character between square brackets
2) [^ abc] searches for any characters not in square brackets
3) [0-9] search for any number between 0-9.
4) [a-z] searches for characters between any lowercase letters a-z.
5) [A-Z] Find characters between any capital A-Z
6) [A-z] searches for characters between any uppercase letters, lowercase letters, and lowercase letters.
7) [adgk] searches for any character in a given set
8) [^ adgk] searches for any character outside the given set
9) (red | biue | green) find any given options
6. metacharacters
1) w: Find word characters
2) W: find non-word characters
3) d: Search for numbers
4) D: Search for non-numeric characters
7. quantifiers
N + matches any string containing at least one n.
N * matches any string containing zero or more n.
N? Match any string containing zero or one n.
N {X} matches the string that contains X n sequences.
N {X, Y} matches the string that contains X or Y n sequences.
N {X,} matches strings that contain at least X n sequences.
N $ matches any string ending with n.
^ N matches any string starting with n.
? = N matches any string followed by the specified string n.
?! N matches any string that is not followed by the specified string n.
Exercise Question 1: Check whether the format of the ID card is correct
Enter the ID card number:
:
Exercise Question 2: Check whether the entered email format is correct
Enter your email address:
:
Relatively speaking, regular expressions in js are a very important point. Many places need to work with regular expressions, so our friends must learn this content well.
Reference Source:
Js Regular Expression
Http://www.lai18.com/content/351738.html
Additional reading
Add to favorites a series of technical articles on JavaScript Regular Expressions
1. A good example of learning regular expressions using regular expressions in the forum posting Tool
2JS replace method and Regular Expression
3. javascript replace method and Regular Expression
4. Regular expressions are used to determine whether Chinese characters and full-byte characters exist, and to determine whether a string contains Chinese characters.
5 trim prototype functions look at the performance of js Regular Expressions
6. use regular expressions to dynamically create/Add css style scripts compatible with IE firefox
7. javascript obtains the regular expression in the first slash of The Link file address.
8 Mootools 1.2 Regular Expression
9javascript implementation using array cache Regular Expressions
10 JavaScript learning notes (14) Regular Expression
11. javascript Regular Expressions trigger functions for advanced replacement
12. Write a regular expression that matches any character
13 javascript regular expression (1)
14js various validation text box input formats (regular expressions)
Function of the g parameter in the 15javascript Regular Expression
16js replacement function, solved by regular expression, all js replacement
17. Regular Expression Summary: Regular Expressions in JavaScript
18 JavaScript learning notes (5) Regular Expressions
19Javascript analysis of global matching modes of Regular Expressions
20 PHP matches regular expressions of consecutive numbers or letters
Description of the Regular Expression in 21jquery
22 common JavaScript Regular Expressions
Differences between 23 Javascript Regular Expressions in browsers
24jQuery source code analysis-02 Regular Expression RegExp common Regular Expression
25 javascript advanced Article 1 Regular Expressions, cookie management, userData
26. Obtain the server data using the regular expression that uses JS to remove Spaces
27js Regular Expression
28javascript learning notes (11) Regular Expression Introduction
Regular Expression for determining numbers, letters, and Chinese characters in 29js (example)
30js limit text box can only enter numbers (regular expressions)
31 Java Regular Expression learning summary and some small examples
32JavaScript advanced programming (3rd) Study Notes 12 js Regular Expressions
33 introduction to javascript Regular Expressions
34. Practical JS Regular Expressions (mobile phone number/IP address Regular Expression/zip code Regular Expression/phone number)
35js replace regular expression case study
36 Regular Expressions with JavaScript to easily process json text
Getting started with regular expressions in 3730
38 how to format XML content using a Javascript Regular Expression
Usage of 39js Regular Expressions
40 Jquery Validate Regular Expression Practical Verification Code
41jquery common Regular Expressions
42 jquery macth Regular Expression example
43jQuery Regular Expressions
44JQuery Regular Expression For numeric type verification
Summary of regular expressions used to verify the time format in 45jQuery
Compilation of trim () Functions and regular expressions in 46js
Summary of common 47JS Regular Expressions
How to convert a string to a regular expression in 48js
49JS Regular Expressions (detailed and practical)
How to obtain group content using a 50JS Regular Expression
51js uses regular expressions to verify the form (relatively complete resources)
52javascipt: Regular Expression for matching single-row and multi-row comments
53 Replace the image address img tag with a regular expression
54 common JavaScript verification Regular Expression Aggregation
55 Summary of special symbols and regular expressions in regular expressions (replace, test, search)
Regular Expression in 56JavaScript
57js verifies the phone number and mobile phone support + 86 Regular Expressions
58 use js regular expression to verify the mobile phone number, email address, and zip code
59JS Regular Expression Verification Code
Differences between the test, exec, and match methods in the 60js Regular Expression
61 use regular expressions to verify whether the form is Chinese
Two Methods for dynamic splicing of Regular Expressions in 62js
63JavaScript uses regular expressions to Verify phone numbers.
64JavaScript form verifies the phone number through regular expression
Summary of regular expressions in 65JavaScript
66JS uses the replace () method and regular expression to search and replace strings.
Example of common Regular Expressions in 67javascript
Obtain Code instances of all links on the webpage using a regular expression of 68node. js
69JavaScript removes-
70 Delete the regular expression of the comment statement in javascript
71JavaScript uses regular expressions to remove "-" from a date
Guide to Using 72javascript Regular Expression parameters/g and/I and/gi
Case-insensitive conversion using regular expressions in 73JS
74javascript learning notes (8) Regular Expressions
75 examples of Regular Expressions in javascript
76javascript regular expression test
77 use js + regular expressions to add links to keywords
78 regular expressions applied in JavaScript
79 use regular expressions and javascript to fully verify the form
80 instance analysis js and C # use regular expressions to match a tag
81Js Regular Expression knowledge Summary
82javascript uses regular expressions to detect IP addresses
83 use regular expressions to format and highlight json strings
84jQuery replaces regular expressions with dom operations
Example of search () usage using 85javascript Regular Expressions
How to replace a mobile phone number with replace () in a 86javascript Regular Expression
87jquery uses regular expressions to verify the email address
88 problems encountered in regular expressions in JavaScript debugging
89javascript uses regular expressions to remove characters After Spaces
Guide to Using Regular Expressions in 90javascript
91 Add a thousands separator to a number using a Javascript Regular Expression
92 [JavaScript] use a regular expression to check whether the input box is a URL
93jQuery: Get the regular expression of the name of the uploaded file
94 usage of Regular Expressions in JavaScript
Details on the use of ignoreCase attributes in 95JavaScript Regular Expressions
96 explain how to use the global attribute in a JavaScript Regular Expression
97 use the exec () method in the Regular Expression of JavaScript
98 briefly describe the use of the test () method in the Regular Expression of JavaScript
Application of multiline attribute of 99JavaScript Regular Expression