Forum Moderators: coopster
I'md getting this error:
Warning: Delimiter must not be alphanumeric or backslash in /home/lybp/public_html/members/inc/matching.inc.php on line 80
Here is the code block (line 80 in the preg_replace line)
if ($_POST['remove'] == "1") {
// $find = strtolower($_POST['find']);
$find = explode("\n", trim($negative));foreach($find as $v) {
$v = quotemeta($v);
$v = "/([^\n]*$v.*)\n/Ui";
}
//$pattern = $find;
//$pattern = "/([^\n]*\b$find\b.*)\n/Ui";
// $pattern = "/([^\n]*$find.*)\n/Ui";
//preg_match_all($pattern, $keywords . "\n", $matches);
//print_r($matches[1]);
// $output = implode("\n", $matches[1]);$pattern = $find;
//Remove peeled terms from list.
$REPLACEMENTS = "";
$keywords = preg_replace($pattern, $REPLACEMENTS, $keywords . "\n");
}
I have never seen this error before. Can anyone tell me what I am doing wrong?
Thanks!
Could it be something elso or is this an error in the manual?
If you can't infact use an array - how can I accomplish the above task otherwise? (check replace array af patterns in string)
[edited by: erikcw at 5:04 pm (utc) on June 23, 2005]
The first argument you pass to the preg functions is the regular expression pattern. This is what you're searching for.
Patterns need to be put in-between (delimited by) two special characters. Traditionally, theses have been forward slashes
/stuff to search for/ But can be a variety of non-alphanumeric not-backslash characters
{foo}
¦bar¦
^hi there^ For some reason, the preg function can't figure out what your delimiters are.
What's inside the $pattern variable when preg_replace runs?
$find = explode("\n", trim($negative));foreach($find as $v) {
$v = quotemeta($v);
$v = "/([^\n]*$v.*)\n/Ui";
}
The foreach loop should be adding the /blah/ to each of the valuse in the array. (note this pattern does work when not used in array form, I barrowed it from another script of mine...)
I realize that isn't helpful but
maybe look at the input after each step to see if you can see what is happening
foreach($find as $v) {
echo '<p>orig: ',$v;
$v = quotemeta($v);
echo '<br>after qm: ',$v;
$v = "/([^\n]*$v.*)\n/Ui";
echo '<br>end: ',$v;
}
that might give you a hint