note 74531 added to function.preg-replace
| From: | markschmid at NOSPAM dot gmx dot ch | Date: | Mon, 16 Apr 2007 09:35:05 +0000 |
| Subject: | note 74531 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125435@lists.php.net to get a copy of this message | ||
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
----
Server IP: 212.124.37.9
Probable Submitter: 80.238.232.154
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/74531
Del: integrated -- https://master.php.net/note/delete/74531/integrated
Del: useless -- https://master.php.net/note/delete/74531/useless
Del: bad code -- https://master.php.net/note/delete/74531/bad+code
Del: spam -- https://master.php.net/note/delete/74531/spam
Del: non-english -- https://master.php.net/note/delete/74531/non-english
Del: in docs -- https://master.php.net/note/delete/74531/in+docs
Del: other reasons-- https://master.php.net/note/delete/74531
Reject -- https://master.php.net/note/reject/74531
Search -- https://master.php.net/manage/user-notes.php