PHP RegEx for removing a Blockquote -


i'm using preg replace remove twitter embeded tweet string looks

<blockquote class="twitter-tweet" lang="en"><p>frank lampard challenges ball... <a href="https://twitter.com/search?q=%23cfc&amp;src=hash">#cfc</a> <a href="http://t.co/calsjzx2fu">pic.twitter.com/calsjzx2fu</a></p>&mdash; chelsea fc (@chelseafc) <a href="https://twitter.com/chelseafc/statuses/384596498110877696">september 30, 2013</a></blockquote> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> 

its coming error

warning: preg_replace() [function.preg-replace]: unknown modifier 'b' in /inc/functions_custom.php on line 261 

here php regex - not sure whats wrong.

$string = preg_replace('/([\s\s]*)(<blockquote>)([\s\s]*)(</blockquote>)([\s\s]*)/', "", $string);  

use this

/(<blockquote)(.*)(<\/blockquote>)/ 

you have closed blockquote tag in regex. whereas in search string, blockquote tag has attributes

(<blockquote>) has (<blockquote)

and

(</blockquote>) has (<\/blockquote>)


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -