I have a .txt file that holds a lot of forbidden words in a forum, with the expression like:
//filterwords.txt
 
XXX
YYY
ZZZ
and then, I would like to use preg_match to check incoming text $str with these words; if those forbidden words are not included, we can do something; otherwise, we do another thing... I am not sure about the expression, and I just know:-
$filter_word = file("filterwords.txt")
for ($i=0; $i< count($filter_word);$i++)
{
  if(!preg_match($filter_word[$i],$str))
  {
    echo "not ok!";
    exit;
  }
  else
  {
    echo "ok!!";
    exit;
  }
}
Could experts teach me how to write the preg_match part? thankyou.
 
    