note 33155 added to function.preg-replace
| From: | david at turningminds dot com | Date: | Tue, 17 Jun 2003 22:08:34 +0000 |
| Subject: | note 33155 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-50535@lists.php.net to get a copy of this message | ||
I just spent a good half hour debugging an unusual problem with preg_replace... the task was to
insert text from a textarea into a template and send it along in an email. If the user put a $
anywhere in the textarea, the output would be hosed. Anywhere they had $ followed by a price, it
would replace it with 0.
My best guess at this is that it interprets the prices as matched values (ie $0, $1, etc). My only
solution was to NOT use a regexp and just use str_replace, since I didn't NEED regular
expressions.
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33155
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33155&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33155&report=yes