I want to replace content from below string,
I want to replace line The part has been repaired to
upto end p tag.
$text = "<p>701082 Range Control Board from Dacor is a manufacturer approved part. The part has been repaired to Dacor's specifications resulting in the highest performance with superior quality</p>";
preg_replace('/The part has been repaired to.*?<\/p>/U', '</p>', $text);
print_r($text);
I tried above preg_replace function but its not working as expected.
The preg_replace
function returns the value of the string after the pattern has been applied to it. Assign a the result to a variable and print_r
the variable.
$text = "<p>701082 Range Control Board from Dacor is a manufacturer approved part. The part has been repaired to Dacor's specifications resulting in the highest performance with superior quality</p>";
$result = preg_replace('/The part has been repaired to.*?<\/p>/U', '</p>', $text);
print_r($result);