Tuesday, 6 August 2013

how to use preg_replace to remove all following style tag/pattern occurrences in a string?

how to use preg_replace to remove all following style tag/pattern
occurrences in a string?

I am trying to find a regex to match the following:
<style type="text/css"> .article-content{ position: relative;
padding-bottom: 140px;} .pane.pane-newsletter-contextual{ display: block;
bottom: 32px; position: absolute; left: 0px; margin-left: 0px; } </style>
I need the regex in order to pass it to preg_replace and remove it from a
string. I have basic knowledge of regex and tried this after reviewing the
basic on http://www.regular-expressions.info/examples.html
preg_replace("/<style\b[^>]*>(.*?)</style>/", "", $body);
However this line is giving the following error Unknown modifier 't' in ...
Also, I tried searching before positing the question and could not find
any that is similar.

No comments:

Post a Comment