note 47548 added to function.preg-replace
| From: | ryu at starmedia dot com | Date: | Fri, 19 Nov 2004 19:11:26 +0000 |
| Subject: | note 47548 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-80775@lists.php.net to get a copy of this message | ||
Why this does not work:
$patterns = "/(\[sql\])(.[^(\[\/sql\])]+)(\[\/sql\])/ims";
$replaces = '<code>$2</code>';
I have:
[sql]
select * from table
[/sql]
content
[sql]
select * from ANOTHER table
[/sql]
the result goes to:
<code>
select * from table
content
select * from ANOTHER table
</code>
And i expect it as
<code>
select * from table
</code>
content
<code>
select * from ANOTHER table
</code>
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47548
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47548&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47548&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47548&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47548&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47548&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47548&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47548&report=yes
Search -- http://master.php.net/manage/user-notes.php