note 47548 rejected from function.preg-replace by sean
| From: | sean@php.net | Date: | Fri, 19 Nov 2004 19:19:21 +0000 |
| Subject: | note 47548 rejected from function.preg-replace by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-80776@lists.php.net to get a copy of this message | ||
Note Submitter: ryu at starmedia dot com
----
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>