Can it be true that PHP does not implement the beginning and end of word
syntax of regular expressions?

In builing a bad word filter, I find this...

  $outstring = eregi_replace("badword$","goodword",$stringtocheck);

will find an occurance of the 'badword' at the end of the string and
replace it.

Similarly,

  $outstring = eregi_replace("^badword","goodword",$stringtocheck);

will find an occurance of the 'badword' at the beginning of the string
and replace it.

Also,

  $outstring = eregi_replace("badword","goodword",$stringtocheck);

will find all occurances of 'badword' even if they are part of a longer
not so bad word like 'badwordage' and replace it.

Then,

  $outstring = eregi_replace(" badword ","goodword",$stringtocheck);

will help me isolate just the actual bad word, but not those at the
beginning and end of a string or that end in a period or comma.

So I could make a rule for each possible placement of badword in a string
and then do this for each vulger term I try to filter.  Or I could just
do... 

  $outstring = eregi_replace("/<badword/>","goodword",$stringtocheck);

Which should find any occurance of 'badword' and nothing more anywhere in
the string.  It works in grep.  It works in bash.  It does not seem to
work in PHP.

Anybody know what I might be doing wrong?

**************************************

John Huggins
VANet

[EMAIL PROTECTED]
http://www.va.net/

**************************************


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

Reply via email to