In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Xiaobian to share with you how to use pattern modifiers in regular expressions, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article. Let's learn about it!
I (PCRE_CASELESS)
If this modifier is set, the letters in the pattern will match case insensitively.
M (PCRE_MULTILINE)
By default, PCRE thinks that the target string is made up of single-line characters (although in fact it may contain multiple lines), the "line beginning" metacharacter (^) matches only the beginning of the string, and the "end of line" metacharacter ($) matches only the end of the string, or the last newline character (unless the D modifier is set). This behavior is the same as perl. When this modifier is set, the beginning of the line and the end of the line match before or after any newline character in the target string, as well as the beginning and end of the target string, respectively. This is equivalent to the / m modifier of perl. If there is no "\ n" character in the target string, or if ^ or $does not appear in the pattern, setting this modifier has no effect.
S (PCRE_DOTALL)
If this modifier is set, the dot metacharacters in the pattern match all characters, including newline characters. Without this modifier, the period does not match the newline character. This modifier is equivalent to the / s modifier in perl. An inverse character class such as [^ a] always matches a newline character and does not depend on the setting of this modifier.
X (PCRE_EXTENDED)
If this modifier is set, white space data characters in the pattern that are not escaped or are not in the character class are always ignored, and characters between the # character and the next newline character outside an unescaped character class are also ignored. This modifier is equivalent to the / x modifier in perl so that comments can be included in the compiled mode. Note: this is for data characters only. White space characters still cannot appear in the special character sequence of the pattern, such as the sequence (? A conditional subgroup has been introduced. (translation note: the occurrence of white space characters in a sequence of special characters defined by this syntax will result in a compilation error. Such as (? It will lead to errors.
E (PREG_REPLACE_EVAL)
Warning
This feature has been obsolete since PHP 5.5.0. It is strongly recommended not to use this feature.
If this deprecated modifier is set, preg_replace (), after performing a backward reference replacement of the replacement string, executes the replaced string as a php code evaluation (eval function) and uses the execution result as the string that actually participates in the replacement. Single quotation marks, double quotation marks, backslashes (\), and NULL characters are escaped with backslashes when they are replaced by backward references.
Caution
The addslashes () function is run on each matched backreference before the substitution takes place. As such, when the backreference is used as a quoted string, escaped characters will be converted to literals. However, characters which are escaped, which would normally not be converted, will retain their slashes. This makes use of this modifier very complicated.
Caution
Make sure that the replacement parameter consists of a legal php code string, otherwise php will generate an interpretation error on the line of the preg_replace () call.
Caution
Use of this modifier is discouraged, as it can easily introduce security vulnerabilites:
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.