Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

3D " pattern and " pattern

can you have this pattern work for both
<div class=3D"gmail_quote">
<div class="gmail_quote">

$body='
Give me advance warning so I can ta=
ke the day off.<br><br><div class=3D"gmail_quote">On Mon, Jan 2, 2012 at 12=
:39 AM
';


$body='
Give me advance warning so I can ta=
ke the day off.<br><br><div class="gmail_quote">On Mon, Jan 2, 2012 at 12=
:39 AM
';


$string = '<div class=3D"gmail_quote">';
$pattern = preg_quote($string, "#"); #escape special characters, and the # character for use as the delimiter
$new_body = preg_replace("#^(.*?){$pattern}.*#s", "$1", $body);

print $new_body;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Terry Woods
Terry Woods
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

thanks for code and explanation about the characters that do not need to be escaped