In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How do I use pattern modifiers in regular expressions? In response to this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more small partners who want to solve this problem find a simpler and easier way.
What is a pattern modifier?
1, pattern modifiers are several letters, we can use one at a time in each regular expression, or we can use multiple ones in succession, each with a certain meaning.
2. Pattern modifier is used to optimize the whole regular expression, which can also be said to be an extension of the regular expression function.
Remember the formula for regular expressions? '/atom and metacharacter/pattern modifier', where forward slashes are boundary characters.
Composition of pattern modifier
Pattern modifiers are letters, but these have special meanings in the application of pattern modifiers. Let me see what pattern modifiers are available. See the following table:
pattern modifier specification i indicates matching in case insensitive with pattern m treats pattern as multiple lines, using ^and $indicates that any line can start or end with a regular expression s If this pattern modifier symbol is not used,". "Default does not represent newline symbols, treats strings as a single line x represents white space in patterns ignore e Regular expressions must be used in preg_replace string function (see this function later)A starts with pattern string, equivalent to metacharacter ^Z ends with pattern string, equivalent to metacharacter $U Regular expressions are characterized by comparison with" greed,"using this pattern modifier to cancel greedy patterns
Since i means match is case-insensitive, we won't demonstrate it in the following example, but we'll look at examples of other pattern modifiers.
1, mode modifier m.
The copy code is as follows:
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
© 2024 shulou.com SLNews company. All rights reserved.