You are here: Re: [PHP] Weird search and replace « PHP « IT news, forums, messages
Re: [PHP] Weird search and replace

Posted by Jason Wong on 01/06/05 10:56

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация