You are here: Re: eregi_replace? « All PHP « IT news, forums, messages
Re: eregi_replace?

Posted by Steve on 11/07/07 23:32

"Pupkin" <spamagnet@dorrk.com> wrote in message
news:MPG.219be6b2d39c0c1f9897e6@news.giganews.com...
> Hi,
>
> I need a case-insensitive replace function to run a string.

<snip>

> From the example I saw it appeared that the two function were
> interchangeble. I guess not.

very much NOT.

> (I realize that it's probably possible to set-up a loop to go through a
> single array of terms and add the "**" where applicable, but I haven't
> gotten to that yet. Right now I just want make sure that no matter how
> the submitter types the words, if they appear in the string they get
> flagged before they come out on the other side.)
>
> Any idea what I'm doing wrong?

you're using eregi_* first of all! see if this helps:

<?
$test = 'THIS STRING IS EMPLOYED TO FLAG REQUIRED LIST OF UNLAWFUL SINGLE
TERMS!';
$test = preg_replace('/\b(employed|law|required|single)\b/i', '$1**',
$test);
echo '<pre>' . print_r($test, true) . '</pre>';
?>

notice 'unlawful' is skipped...as would 'singleton'. the whole word is
considered here.

 

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

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