Forum Moderators: coopster
I'm tring to do the following:
Perform a preg_replace on a list of items seperated by \n ($_POST['html_textarea']) with another list of items ($_POST['textarea_replace']).
$html_textarea = "item a
item b
product d
something e
something f";
$textarea_replace = "a
b";
The pattern I've used before is:
$find = "blah";
/[^\n]*$find.*)\n/Ui
$output = preg_replace("$textarea_replace", $replacement, $html_textarea);
End Result:
$output="product d
something e
something f";
So how do I get this to work? The pattern above works great if there is just one item to match in $textarea_replace, but since I need to work with a list, it is messing everything up. I tried using an array of patterns, but can't seem to get it working.
What should I do to make this thing work?
Thanks so much for your help! This is driving me nuts!