Tag:regular expression

  • A brief tutorial on regular expressions!


    Introduction and examples A regular expression describes a string matching pattern (pattern), which can be used to extract a specific format substring contained in a large string. A regular expression is a text pattern composed of ordinary characters and special characters. 1. Extract the digital part # Extract the number part from the string “abc123def” […]

  • A Brief Introduction to Regular Expressions


    1. Definition When using the constructor to create a regular object, the normal character escaping rules are required (preceded by a backslash \) /* For example, the following two definitions are equivalent */ // constructor method const reg = new RegExp(“\\w+”); // Literal method const reg = /\w+/; 2. Modifiers Used to perform case-sensitive and […]

  • Quickly master regular expressions in the shell in 5 minutes


    This article was first published inThousands of miles – Quickly master regular expressions in the shell in 5 minutes I often use the command linegrepThe etc. command handles some text lookup issues. When using regular expressions, we often encounter some confusing problems. For example, the same regular expression can be used in one command, but […]

  • Python library performance test re and lxml efficiency comparison


    foreword I have nothing to do, I remembered that the article I posted in Jianshu before has not been moved here, and I was about to move an article about the efficiency comparison between lxml and re, but found that the code was gone, so I simply rewrote it once. First the results: Only doing […]

  • Application of regular expressions: ID number identification


    Today, I encountered the problem of ID number identification in the project. I need to identify 15 or 18-digit resident ID cards. I checked it online and found it very interesting. Here I would like to share with you my understanding process, hoping to help you learn better regular expression. 18-digit ID number identification /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/ […]

  • Mobile phone number regular expression


    The development history of regular mobile phone number At that time, considering that the operator will only provide mobile phone numbers of certain number segments, the regular expression looks like this: /^1([38]\d|5[0-35-9]|7[3678])\d{8}$/ It can be seen that it is used to match 13X, 18X, 15X, 17X these numbers. Later, due to insufficient mobile phone numbers, […]

  • Detailed explanation of regular expressions in JavaScript


    1. Regular expressions Regular expressions are syntax for matching strings. In JavaScript, used for the exec and test methods of RegExp, and the match, matchAll, replace, search and split methods of String.Regular expression syntax, look here! 1. Create a regular expression Method 1 is compiled when the script is loaded, and its performance is higher […]

  • Regex only needs to enter numbers



  • JZ-052 – Regular expression matching


    regular expression match topic description Please implement a function to match ‘.’ and ‘‘ regular expression. The character ‘.’ in the pattern represents any character, and the ‘‘Indicates that the character in front of it can appear any number of times (including 0 times). In this question, matching means that all characters of the string […]

  • JZ-053 – strings representing numeric values


    a string representing a value topic description Please implement a function to determine whether a string represents a value (including integers and decimals). For example, the strings “+100”, “5e2”, “-123”, “3.1416” and “-1E-16” all represent numeric values. But “12e”, “1a3.14”, “1.2.3”, “+-5” and “12e+4.3” are not. topic link: a string representing a value the code […]

  • Learn to use six rules of regular expressions


    Table of contents: 1. What is regularization 2. Character understanding 3. Cycle and repeat 4. Position boundary 5. Subexpression 6. Logic processing 1. What is regularization A regular expression is essentially a tool for string pattern matching, which implements the search and replace function of strings. We can see from its name that it is […]

  • Visualize regular expressions with regex-vis.com


    regex-vis.comIt is a tool for learning, writing and verifying regular expressions. It can not only visualize the regularity, but also provide the ability to visually edit the regularity Function introduction can go directlyregex-vis.comto experience its functionality,storehouseThe README also has a simple demo. If you like it, you can order a Star. If you find a […]