note 74531 deleted from function.preg-replace by bjori
| From: | bjori@php.net | Date: | Tue, 17 Apr 2007 09:33:35 +0000 |
| Subject: | note 74531 deleted from function.preg-replace by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125506@lists.php.net to get a copy of this message | ||
Note Submitter: markschmid at NOSPAM dot gmx dot ch
----
Edit of my previous post:
In my previous post I forgot to consider that
windows and linux, etc. use different line breaks.
To the moderators: Pleas edit my previous post
with the following additions / changes:
// *** Regular Expression Syntax used:
// "\n" = newline character (=line break from Linux)
// "\r\n" = carriage return and newline character (=line break from Windows)
// Select single newline preceded and followed by any
// non-whitespace character:
$patterns[0] = "/(?<=\S)\n(?=\S)/";
// Select single newline preceded by a non-whitespace character
// and one or more spaces, and followed by any non-whitespace
// character:
$patterns[1] = "/(?<=\S)\ +\n(?=\S)/";
// Do the same for Windows style line breaks:
$patterns[2] = "/(?<=\S)\r\n(?=\S)/";
$patterns[3] = "/(?<=\S)\ +\r\n(?=\S)/";
Thanks,
Markie