note 85883 added to function.preg-replace
| From: | Sheri at osu1 dot php dot net | Date: | Mon, 22 Sep 2008 21:32:37 +0000 |
| Subject: | note 85883 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144628@lists.php.net to get a copy of this message | ||
The situation described below by dyer85 at gmail on 28-Aug-2008 at 08:41 can be addressed (since
PCRE version 7.3) by including "(*ANYCRLF)" at the start of the pattern. Then linebreaks
will be detected for line endings typical of unix, mac and PC texts.
When included in the pattern for the example cited, all expected replacements are made.
<?php
$s = "Testing, testing.\r\n"
. "Another testing line.\r\n"
. "Testing almost done.";
echo preg_replace('/(*ANYCRLF)\.$/m', '.@', $s);
?>
----
Server IP: 209.41.74.194
Probable Submitter: 67.166.173.111
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/85883
Del: integrated -- https://master.php.net/note/delete/85883/integrated
Del: useless -- https://master.php.net/note/delete/85883/useless
Del: bad code -- https://master.php.net/note/delete/85883/bad+code
Del: spam -- https://master.php.net/note/delete/85883/spam
Del: non-english -- https://master.php.net/note/delete/85883/non-english
Del: in docs -- https://master.php.net/note/delete/85883/in+docs
Del: other reasons-- https://master.php.net/note/delete/85883
Reject -- https://master.php.net/note/reject/85883
Search -- https://master.php.net/manage/user-notes.php