In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "what is the learning content of regular expression", which is easy to understand and clear, hoping to help you solve your doubts. Let the editor lead you to study and learn the article "what is the learning content of regular expression".
1 Overview
A regular expression (Regular Expression) is a matching pattern that describes the characteristics of a string of text.
Just as the words "tall" and "sturdy" in natural language are abstracted to describe the characteristics of things, regular expressions are the high abstractions of characters, which are used to describe the characteristics of strings.
Regular expressions (hereinafter referred to as Regex) usually do not exist independently. Various programming languages and tools provide support for regularities as host languages, and tailor or extend them according to the characteristics of their own languages.
The introduction to regularization is easy, and the limited grammar rules are easy to master, but at present, the popularization rate of regularization is not high, mainly because there are many regular schools, and the documents provided by various host languages pay too much attention to some of their own details. and these details are usually not for beginners to pay attention to.
Of course, if you want to have an in-depth understanding of regular expressions, these details must be paid attention to, which is later, let's start with the basis of regular expressions and enter the world of regular expressions.
2 basis of regular expression
2.1 basic concepts
2.1.1 string composition
For the string "A5", it consists of two characters "a", "5" and three positions, which is important for understanding the matching principle of regular expressions.
2.1.2 during the matching process of possessing characters and zero-width regular expressions, if the subexpression matches the character content, not the position, and is saved in the final matching result, then the subexpression is considered to possess the character; if the subexpression matches only the position, or if the matching content is not saved in the final matching result, then the subexpression is considered to be zero-width.
The possession of characters or zero width depends on whether the matching content is saved in the final matching result.
Possession characters are mutually exclusive and zero width is non-mutually exclusive. That is, a character can only be matched by one subexpression at a time, while a position can be matched by multiple zero-width subexpressions at the same time.
2.1.3 regular expressions are made up of two kinds of characters. One is a "metacharacter" with a specific meaning in a regular expression, and the other is an ordinary "text character".
A metacharacter can be a character, such as "^", or a sequence of characters, such as "\ w".
2.2 metacharacters (Meta Character) 2.2.1 […] Character group (Character Classes) character group can match any character contained in []. Although it can be any one, it can only be one.
Character groups support a range represented by a hyphen "-". When the range is formed before and after the "-", the code point of the preceding character is required to be less than that of the following character.
[^...] Exclusive character group. The exclusive character group represents any unlisted character, and it can also be one. Exclusive character groups also support a range represented by a hyphen "-".
Expression.
Description
[abc]
Means "a" or "b" or "c"
[0-9]
Represents any number in 0nine, which is equivalent to [0123456789]
[\ u4e00 -\ u9fa5]
To represent any Chinese character
[^ A1
Negative look around in reverse order, indicating that the left side of the position cannot match Expression
(= Expression)
The order is sure to look around, indicating that the right side of the location can match Expression.
(?! Expression)
The sequence negates the look around, indicating that the right side of the location cannot match Expression
For example:
"(?
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
WebDriver API online API: http://selenium-python.readthedocs.io/waits.html
© 2024 shulou.com SLNews company. All rights reserved.