Im in the middle of creating a simple blog system using a wysiwyg editor and when i submit a post a want to remove the background-color: rgb(235, 235, 235); from inside the style="" but leave everything else thats inside the style alone. So say i have: <div style="font-size: 15px; background-color: rgb(235, 235, 235);">Random text</div> Code (markup): It would end up as this after being submitted: <div style="font-size: 15px;">Random text</div> Code (markup): Thanks.
EDIT: Figured it out: $post = preg_replace("/style=\"(.*?)background-color: rgb\((.*?),(.*?),(.*?)\);(.*?)\"/", "style=\"$1 $5\"", $post); Code (markup):