--- scanner.module 2009-03-05 12:34:32.000000000 -0700 +++ scanner.module 2009-03-15 02:22:08.000000000 -0700 @@ -872,12 +872,21 @@ * REPLACE * + check to see if already processed */ else if (!isset($processed[$field][$row->nid])) { $hits = 0; + if ( version_compare( PHP_VERSION, '5.1.0', '<' ) ) { + // PHP < 5.1.0's preg_replace doesn't have the ability to count the matches. + // So we do this beforehand with a preg_match_all, and then do the replacement. + // (This is really a hack) + $hits = preg_match_all("/$search_php/$flag", $content, $matches); + $newcontent = preg_replace("/$search_php/$flag", $replace, $content, -1); + } else { $newcontent = preg_replace("/$search_php/$flag", $replace, $content, -1, $hits); - + } $thenode = node_load(array('nid' => $row->nid)); //see if we're dealing with a CCK text field and therefore need to strip the // "_value" off the end: preg_match('/(.+)_value$/', $field, $matches);