note 41081 added to function.preg-replace
| From: | php-general at lists dot php dot net | Date: | Mon, 29 Mar 2004 19:46:33 +0000 |
| Subject: | note 41081 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67338@lists.php.net to get a copy of this message | ||
<Quote>
Peter
01-Nov-2003 03:00
Suppose you want to match '\n' (that's backslash-n, not newline). The pattern you
want is not /\\n/ but /\\\\n/. The reason for this is that before the regex engine can interpret the
\\ into \, PHP interprets it. Thus, if you write the first, the regex engine sees \n, which is reads
as newline. Thus, you have to escape your backslashes twice: once for PHP, and once for the regex
engine.
</Quote>
Well Peter seems to have solved this, I hope you all realise it, as this little \" disaster in
my flash -> php work is now solved with this little resolve as well.
Thanks Peter,
Rick - chatdev.com
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41081
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41081&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41081&report=yes
Search -- http://master.php.net/manage/user-notes.php