Re: Weird search and replace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 06 January 2005 14:24, Liam Gibbs wrote:

Please fix your mail client so that in word wraps properly!

> Here's what I need. I have a string such as this:
>
> "Yadda yadda yadda yadda '32'(l) yadda yadda yadda '2'(l) yadda '419'(l)."
> (#2)
>
> I need to find the strings like '32'(l), '2'(l), and '419'(l), including
> the single quotes. Basically a '[0-9]*'(l). This is #1.
>
> Take that string, look up a record in an SQL table based on the number in
> the single quotes. Take a field in the record (#3) and replace #1 with it.
> So basically, we have:
>
> "Yadda yadda yadda yadda supplanted-string yadda yadda yadda
> supplanted-string yadda supplanted-string." (#2)

It seems preg_replace_callback() would be ideal for this job.

-- 
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
------------------------------------------
New Year Resolution: Ignore top posted posts

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux