Home  >  Article  >  Backend Development  >  PHP and editplus regular expression to remove blank lines, editplus regular expression_PHP tutorial

PHP and editplus regular expression to remove blank lines, editplus regular expression_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:56:55857browse

php and editplus regular expressions remove blank lines, editplus regular expressions

remove blank lines inside the string:
Copy code The code is as follows:
$str = preg_replace("/(s*?r?ns*?) /","n",$str);

Remove all blank lines, including internal and trailing lines:
Copy code The code is as follows:
$str = preg_replace('/($s*$)|(^s*^)/m', '',$str);

Regular expression to replace blank lines in editplus:

Regular expression: ^[tn]*n

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/985271.htmlTechArticlephp and editplus regular expressions remove blank lines, and editplus regular expressions remove blank lines inside the string: Copy code The code is as follows: $str = preg_replace("/(s*rns*) /","n",$str)...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn