In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how php uses regular line breaks". In daily operation, I believe many people have doubts about how php uses regular line breaks. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to use regular line breaks in php". Next, please follow the editor to study!
1. Create a sample PHP file.
2. You can replace the line character by "preg_replace ('/ / sprinter str,'', $line character);".
Preg_replace (string | array $pattern, string | array $replacement, string | array $subject, int $limit =-1, int & $count = null): string | array | null
Search for parts of subject that match pattern and replace them with replacement.
Parameters:
Pattern
The pattern to search for. You can make a string or an array of strings.
You can use some PCRE modifiers.
Replacement
The string or array of strings used to replace. If this parameter is a string and pattern is an array, then all patterns are replaced with this string. If both pattern and replacement are arrays, each pattern is replaced with the corresponding element in replacement. If there are fewer elements in replacement than in pattern, the extra pattern is replaced with an empty string.
Replacement can contain backward references\ n or $n, which is syntactically preferred. Each such reference is replaced by the text captured by the nth capture subgroup to which it is matched. N can be 0-99, and\ 0 and $0 represent the complete pattern matching text. The sequence number of the capture subgroup is counted as follows: the left parenthesis representing the capture subgroup is counted from left to right, starting with 1. If you want to use backslashes in replacement, you must use four ("\", translation note: because this is the first string of PHP, after escape, it is two, and then after the regular expression engine is considered to be an original backslash).
When working in replacement mode and the backward reference needs to be followed by another number (for example, adding an original number immediately after a matching pattern), the syntax\ 1 cannot be used to describe the backward reference. For example,\ 11 will make it impossible for preg_replace () to understand whether you want a\ 1 backward reference followed by an original text 1 or a\ 11 backward reference followed by nothing. The solution in this case is to use ${1} 1. This creates a separate $1 backward reference, a separate original text 1.
When the deprecated e modifier is used, this function escapes some characters (that is,', ",\, and NULL) and then performs backward reference substitution. When this is done, make sure that there are no syntax errors caused by single or double quotes (for example: 'strlen (\' $1\') + strlen ('$2)') after backward quote parsing. Make sure that it conforms to PHP's string syntax and conforms to eval syntax. Because after the replacement is completed, the engine evaluates the resulting string as PHP code using eval and returns the value as the string that ultimately participates in the replacement.
Subject
The string or array of strings to search for and replace.
If subject is an array, the search and replacement will take place on each element of subject, and the return value will also be an array.
Limit
The maximum number of times each mode is replaced on each subject. The default is-1 (infinite).
Count
If specified, it will be populated with the number of completed replacements.
At this point, the study of "how to replace regular newline characters with php" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.