Badword Seach in String or Variable
Moderator: General Moderators
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
now another question i have this: (its different from the goal of previous codes)
And i get
Code: Select all
<?php
$text = 'I have a badword here';
$badwords = array();
$badwords[] = array(' badword', ' *!* ');
$badwords[] = array(' \@\$\$ ', ' *!* ');
$badwords[] = array(' a\$\$ ', ' *!* ');
foreach ($badwords as $badword) {
$text = eregi_replace($badword[0],$badword[1],$text);
}
return trim($text);
?>that. What wrong?Warning: eregi_replace() [function.eregi-replace]: REG_EPAREN in /home/Include Content/Badword.php on line 286
- aerodromoi
- Forum Contributor
- Posts: 230
- Joined: Sun May 07, 2006 5:21 am
It's telling you to watch out for special characterstecktalkcm0391 wrote:now another question i have this: (its different from the goal of previous codes)
And i getCode: Select all
<?php $text = 'I have a badword here'; $badwords = array(); $badwords[] = array(' badword', ' *!* '); $badwords[] = array(' \@\$\$ ', ' *!* '); $badwords[] = array(' a\$\$ ', ' *!* '); foreach ($badwords as $badword) { $text = eregi_replace($badword[0],$badword[1],$text); } return trim($text); ?>that. What wrong?Warning: eregi_replace() [function.eregi-replace]: REG_EPAREN in /home/Include Content/Badword.php on line 286
cy,
Marc
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
aerodromoi wrote:It's telling you to watch out for special characterstecktalkcm0391 wrote:now another question i have this: (its different from the goal of previous codes)
And i getCode: Select all
<?php $text = 'I have a badword here'; $badwords = array(); $badwords[] = array(' badword', ' *!* '); $badwords[] = array(' \@\$\$ ', ' *!* '); $badwords[] = array(' a\$\$ ', ' *!* '); foreach ($badwords as $badword) { $text = eregi_replace($badword[0],$badword[1],$text); } return trim($text); ?>that. What wrong?Warning: eregi_replace() [function.eregi-replace]: REG_EPAREN in /home/Include Content/Badword.php on line 286
cy,
Marc
What should I do then a stripslashes(); or something?
Why isn't is a legitamate pattern... and nothing is wrong with str_ireplace now, it was giveing me an error beforfe.Jcart wrote:you arn't supplying a legitamate pattern.. and what is wrong with str_ireplace()?
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
-
Robert Plank
- Forum Contributor
- Posts: 110
- Joined: Sun Dec 26, 2004 9:04 pm
- Contact:
Yeah,tecktalkcm0391 wrote:another question, can I trim and array... would I do an array_map?
Code: Select all
$array = array_map("trim", $array);