note 110213 added to function.preg-replace
| From: | andreob at gmail dot com | Date: | Mon, 01 Oct 2012 15:54:46 +0000 |
| Subject: | note 110213 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191090@lists.php.net to get a copy of this message | ||
I'm reading a string from a file: '\tfirst\n\tsecond\n'.
The string has 19 characters, \n are two characters, \t are two characters.
I want to transform the two chars "\n" in one char "\n", the two "\t"
in one "\t", and any char followed by \ in one char "\ANY_CHAR", using the
preg_replace as following:
preg_replace("/\\\\([\w])/", "\\\\\\1", $string);
But it's not working.
Somebody can help me?
----
Server IP: 69.147.83.199
Probable Submitter: 200.137.65.105
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/110213
Del: integrated -- https://master.php.net/note/delete/110213/integrated
Del: useless -- https://master.php.net/note/delete/110213/useless
Del: bad code -- https://master.php.net/note/delete/110213/bad+code
Del: spam -- https://master.php.net/note/delete/110213/spam
Del: non-english -- https://master.php.net/note/delete/110213/non-english
Del: in docs -- https://master.php.net/note/delete/110213/in+docs
Del: other reasons-- https://master.php.net/note/delete/110213
Reject -- https://master.php.net/note/reject/110213
Search -- https://master.php.net/manage/user-notes.php