Re: Preg Replace
| From: | Jason Wong | Date: | Tue, 06 Jan 2004 05:27:25 +0000 |
| Subject: | Re: Preg Replace | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173823@lists.php.net to get a copy of this message | ||
On Tuesday 06 January 2004 12:35, Aaron Axelsen wrote:
> I am fighting replacing items in the following hunk of code. This code is
> pulled from a database, and then I want to replace items like <<name>> with
> the contents of a variable $name.
>
> I have tried code like:
> preg_replace("/\<\<\?.*?\>\>/",$name,$paypal);
The angle brackets have no special meaning so there's no need to escape them.
Something like:
preg_replace('/(<<.*>>)/U', $name, $paypal);
should work.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Time is an illusion, lunchtime doubly so.
-- The Hitchhiker's Guide to the Galaxy
*/