note 54461 deleted from function.preg-replace by tularis
| From: | tularis@php.net | Date: | Sun, 18 Jun 2006 13:27:05 +0000 |
| Subject: | note 54461 deleted from function.preg-replace by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114314@lists.php.net to get a copy of this message | ||
Note Submitter: crosser at hanmail dot net
----
\ (back slash) pattern & replacement bug.
// \a\b\c to -\a-\b-\c
$subject = '\\a\\b\\c';
$pattern = '/\\\[a-z]/'; // why \\\ ?
$replacement = '-\0';
echo preg_replace($pattern, $replacement, $subject);
// abc to \a\b\c
$subject = 'abc';
$pattern = '/[a-z]/';
$replacement = '\\\\\0'; // why \\\\ ?
echo preg_replace($pattern, $replacement, $subject);
I use pattern \x5c and replacement callback function...