I need to repeatedly remove certain stop words from articles. Currently I am using the function str_replace to achieve this. As the first argument I use the stop list array
preg_replace
with array
$find = array('/\bth\b/', '/\bthe\b/', '/\bthen\b/');
$replace = array('', '', '');
echo $i = preg_replace($find, $replace, $string);
$find = array('/\bth\b/', '/\bthe\b/', '/\bthen\b/');
echo $i = preg_replace($find, "", $string);
Regex match document: http://www.php.net/manual/en/function.preg-replace.php#89364
\b Match a word boundary