JavaScript Regular Expression Knowledge Summary

Source: Internet
Author: User

Js Regular Expression Knowledge Summary

Regular Expressions:

1. What is RegExp? RegExp is the abbreviation for regular expressions. The RegExp object is used to specify what is retrieved in the text.

2, define Regexp:var + variable name =new RegExp ();

3. The RegExp object has 3 methods:

1) test () retrieves the specified value in the string, and the return value is true or false.

var p1=new Reg ("E");d Ocument.write (Reg.test ("Welcome to china!"));

2) EXEC ()

var p1=new Reg ("E");d Ocument.write (Reg.exec ("Welcome to china!"));

3) Compile ()

var p1=new Reg ("E");d Ocument.write (Reg.compile ("Welcome to china!"));

4. Modifier

1) I perform a match on case insensitive

2) G performs a global match

3) m performs multi-line matching

5. Square brackets (used to find characters in a range)

1) [ABC] find any character between square brackets

2) [^ABC] find any characters that are not in square brackets

3) [0-9] Find the number between any 0-9

4) [A-z] to find characters between any lowercase a-Z

5) [A-z] find any uppercase-A-Z characters

6) [A-z] find any characters between uppercase-lowercase Z

7) [ADGK] find any character within a given set

8) [^ADGK] find any character outside the given set

9) (Red|biue|green) find any given option

6, Meta-character

1) \w: Find word characters

2) \w: Find non-word characters

3) \d: Find numbers

4) \d: Find non-numeric characters

7. quantifier

n+ matches any string that contains at least one n.

n matches any string that contains 0 or more N.

n matches any string that contains 0 or one n.

N{x} matches a string containing a sequence of X N.

N{x,y} matches a string containing a sequence of X or Y N.

N{x,} matches a string that contains at least X N of a sequence.

n$ matches any string that ends with N.

^n matches any string that begins with N.

=n matches any string immediately following the specified string n.

?! n matches any string that does not follow the specified string n immediately thereafter.

"Exercise 1" to determine whether the input ID card format is correct

<body><label> Enter your ID number: </label><input name= "" type= "text" id= "Shenfen"/><input name= "" Type= "Submit" id= "Textfi" value= "Submit 1" onclick= "Test ()"/><!--submit button, trigger function--></body>




"Exercise 2" Determines whether the mailbox you entered is the correct format

<body><label> Please enter your e-mail: </label><input name= "" type= "text" id= "Youxiang"/><input name= "" Type= "Submit" value= "Commit 2" onclick= "Y ()"/></body>





Relatively speaking, JS is a very important point of expression, many places need to cooperate with the regular, so the small partners must learn this piece of content.

Reference Source:
Js Regular Expression
Http://www.lai18.com/content/351738.html

Extended Reading

JavaScript Regular Expression Series technical articles organize collections

1 A good example of regular expression learning regular expressions used in the Forum repost tool

2JS Replace method and regular expression in combination with application

3javascript Replace method and regular expression

4 Regular expressions determine if Chinese and full-width characters are present and determine the length of the string containing the Chinese character

The performance of JS regular expression in 5trim prototype function

6 using regular expressions to dynamically create/Add CSS style script-compatible IE Firefox

7javascript gets the regular expression within the first slash in the address of the linked file

8Mootools 1.2 Tutorial Regular expressions

Implementation of regular expressions using array caches under 9javascript

10JavaScript Learning Notes (14) Regular expressions

11javascript Regular expression trigger function for advanced substitution

12 notation of regular expressions matching any character

13javascript Regular Expression (i)

14js Various validation text box input format (regular expression)

function of parameter G (global) in 15javascript regular expressions

16js Replace function function, solve with regular expression, JS Replace All

17 Regular Summary: Regular expressions in JavaScript

18javascript Learning Notes (v) Regular expressions

The global matching pattern analysis of the 19Javascript Express expression

20PHP regular expression that matches consecutive numbers or letters

Description of regular Expressions in 21jquery

22 Common JavaScript Regular expressions

23JavaScript Regular Expression Browser differences

24jQuery Source Code Analysis-02 Regular Expressions RegExp Common regular expressions

25javascript Advanced article 1 regular expressions, cookie management, UserData

26 get the data from the server regular expressions for using JS to remove spaces

27JS Regular Expressions

28javascript Learning Notes (11) Introduction to Regular expressions

29JS Regular Expressions for judging the number \ Letter \ Chinese (instance)

30js Limit text box to enter only numbers (regular expressions)

31Java Regular Expression Learning summary and some small examples

32JavaScript Advanced Programming (3rd Edition) Learning Note JS Regular expression

33javascript Regular expression correlation should be introduced

34 Useful JS Regular Expressions (mobile phone number/IP regular/ZIP/phone, etc.)

35js Replace Regular expression application case explanation

36 Regular expression with JS easy to handle JSON text convenient and old ancient

3,730-minute Introductory Regular Expression Basics tutorial

38 How to use JavaScript regular expressions to format XML content

Use of 39JS Regular expressions

40Jquery Validate Regular Expression Practical validation code Daquan

Regular expressions commonly seen in 41jquery

42jquery MACTH Regular Expression instance

Regular expressions commonly used in 43jQuery

44JQuery numeric type validation regular expression

Summary of regular expressions for 45jQuery test time format

46js writing trim () function and the use of regular expressions

47JS Common Regular Expression summary

48js How to convert a string to a regular expression

49JS Regular Expression Daquan (detailed and practical collation)

50JS Regular Expressions Get a detailed description of how to group content

51js validating forms with regular expressions (more complete resources)

52javascipt matching single-line and multiline-comment regular expressions

53 Replace the image address with the regular expression img tag

54 common JavaScript Validation Regular expression rollup

55 Summary of several methods of special symbols and regular expressions in regular expressions (Replace,test,search)

Regular Expressions in 56JavaScript

57JS Verify phone number and phone support +86 regular expression

58 using JS Regular expression to verify the phone number, email address, zip code

59JS Regular expression Validation numeric code

Description of the difference between Test,exec,match methods in 60js regular expressions

61 implementing form validation with regular expressions is Chinese

Two methods of 62js dynamic splicing regular expression

63JavaScript implementing form validation phone numbers with regular expressions

64JavaScript Forms verify phone numbers with regular expressions

Concise summary of regular expressions in 65JavaScript

66JS searching and replacing instances of strings using the Replace () method and regular expressions

Examples of regular expressions commonly used in 67javascript

68node.js Regular Expressions get code instances for all links in a Web page

69JavaScript using regular expressions to remove dates from-

70 Delete a regular expression for comment statements in JavaScript

71JavaScript using regular expressions to remove "-" from a date

72javascript Regular expression parameter/g usage guide for/I and/GI

73JS Apply Regular Expression conversion case example

74javascript Learning Notes (eight) regular expressions

75 several instances of regular expressions in JavaScript

76javascript Regular Expression validation

77 using js+ Regular expressions to add links to keywords

78 Regular Expressions in JavaScript applications

79 full validation of forms with regular expressions and JavaScript

80 example Analysis JS and C # use regular expressions to match a label

81Js Regular Expression Knowledge Summary

82javascript using regular expressions to detect IP addresses

83 using regular expressions to format and highlight JSON strings

Replacing regular expressions with DOM operations in 84jQuery

Example of search () usage for 85javascript regular expressions

86javascript Regular Expressions replace phone numbers with replace ()

87jquery How to use regular expressions to verify an e-mail address

88 debugging JavaScript problems encountered in a regular expression

89javascript using regular expressions to implement characters that are removed after a space

Guidelines for using regular expressions in 90javascript

91Javascript Regular expressions implement to add thousands separators to numbers

92 "JavaScript" uses regular expressions to check if the input box is a URL

93jQuery regular expression to get the name of the uploaded file

94 A brief introduction to the use of regular expressions in JavaScript

IgnoreCase properties in 95JavaScript regular expressions use detailed

96 in-depth use of the global property in JavaScript regular expressions

97 using the Exec () method in a regular expression in JavaScript

98 Introduction to the use of the test () method in a regular expression of javascript

Application of the Multiline attribute of 99JavaScript regular expression

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

JavaScript Regular Expression Knowledge Summary

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.