|
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]
|