Category:Regular Expression

  • Regular expression u modifier (supports UTF-16 encoding)

    Time:2019-8-24

    Regular expression u modifier: This modifier identifier correctly handles Unicode characters larger than FFFFFF.That is to say, four bytes of UTF-16 encoding will be handled correctly.This modifier is a new addition to ES2015. More new features of regular expressions can be found in the chapter on new features of regular expressions in ES2015.More regular expression […]

  • Introduction to the Use of Regular Expressionsw Metacharacters

    Time:2019-8-23

    Regular expressionw metacharacter: \ The w-ary character is used to match word characters, which is equivalent to “[a-zA-Z0-9].Grammatical structure: Constructor mode: new RegExp(“\\w”) Object Direct Quantity Method: /\w/ Browser support:IE browser supports this metacharacter.Firefox supports this metacharacter.Google Browser supports this metacharacter. Example code: Example 1: var str=”antzone<12>love”; var reg=new RegExp(“\\w”,”g”); console.log(str.match(reg)); The above code matches […]

  • Regular expressionW meta-character usage

    Time:2019-8-22

    Regular expressionW metacharacter:\ W (capitalization) is used to match non-word characters, which is equivalent to “[^ a-zA-Z0-9_]”. Grammatical structure: Constructor mode: new RegExp(“\\W”) Object Direct Quantity Method: /\W/ Browser support:IE browser supports this metacharacter.Firefox supports this metacharacter.Google Browser supports this metacharacter. Example code: Example 1: var str=”antzone<12>love”; var reg=new RegExp(“\\W”,”g”); console.log(str.match(reg)) The above code matches […]

  • Regular expressions. Symbol characters (except carriage return r and newline \n)

    Time:2019-8-21

    Regular expressions. Symbol characters:The dot (.) metacharacter can match any character except the carriage return ( r) and line break (\ n). Grammatical structure:Constructor mode: new RegExp(“.”) Object Direct Quantity Method:[JavaScript] Pure Text View Copy Code Running Code /./ Browser support:IE browser supports this metacharacter.Firefox supports this metacharacter.Google Browser supports this metacharacter. Be careful: In […]

  • Regular expressiond metacharacter (relative to the number 0-9)

    Time:2019-8-20

    Regular expressiond metacharacter:\ The d-ary character can match the numeric character, which is equivalent to “[0-9]. Grammatical structure: Constructor mode: new RegExp(\\d) Object Direct Quantity Method: /\d/ Browser support: IE browser supports this metacharacter.Firefox supports this metacharacter.Google Browser supports this metacharacter. Example code: Example 1: var str=”I love antzone \n and you 360″; var reg=new […]

  • Detailed Explanation of Grouping Examples of Regular Expressions

    Time:2019-8-19

    Regular expression grouping:If you want to match three numbers, regular expressions can be written as follows: \d{3} The above code can match three digits with repeated quantifiers.However, in practical applications, it is often necessary to repeat multiple characters, for example, I want to repeat AB two characters. It is not appropriate to use the following […]

  • Regular expression character class deepens understanding

    Time:2019-8-18

    Regular expression character classes deepen understanding: I. Basic concepts:Character classes are relatively simple, but there may also be some misunderstandings due to lack of in-depth understanding or carelessness. Here’s another introduction.The character class [] can match any one of a series of characters contained in parentheses, but the result of matching can only be one […]

  • Regular expressions match IP expressions (recommended)

    Time:2019-8-17

    Here we will give you a detailed description of a regular expression matching IP addresses. Knowledge of regularity will be mentioned in a detailed explanation. Before explaining, I would like to introduce to you the rules of IP address generation. IP address is composed of 32 digit binary to four decimal strings. How to transform? […]

  • Basic Regular Expressions in Linux

    Time:2019-8-16

    Character matching: Matching any single character []: Matches any single character within the specified range; [^]: Match any single character [: digit:] lower upper alpha alnum space outside the specified range Matching Number: Used after the character to specify the number of occurrences, to limit the number of occurrences of the previous character. * Match […]

  • Regular expression inert matching pattern (?)

    Time:2019-8-15

    Regular expression lazy matching pattern:In the chapter of greedy matching pattern, we have already said that human nature is greedy, hoping to get more money, status and even beautiful women, but there are also many people who have no desire, as long as they meet the basic needs of life, there are also such matching […]

  • Regular expression scripts (processing input)

    Time:2019-8-14

    The small script implements extracting the content of Src in the < img > tag from the input box content, then replacing the content in the original location, and then removing the HTML tags, spaces and other operations in the input content. <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> <title></title> <script> window.onload = function () […]

  • Java regular expression matching patterns (greedy, reluctant, possessive)

    Time:2019-8-13

    Greediness: Maximum Matching X?, X*, X+, X {n,} are the largest matches. For example, if you want to match “a < tr > aava </tr > abb” with “<. +>”, maybe you want to match “tr >”, but the actual result will match “tr > aava </tr>”. In Greediness mode, the matching will be as […]