preg_replace
Hey guys
Am trying to use pre_replace to remove the <img> and <a> tags from some content so that I can use it as a meta description.
Individually they work fine:
<meta name="description" content="<?php echo(str_replace(array("<p>","</p>"),"",substr(preg_replace("/<img[^>]+\>/i", " ",$row_BlogRS['BlogContent']),0,250))."..."); ?>">
or
<meta name="description" content="<?php echo(str_replace(array("<p>","</p>"),"",substr(preg_replace("/<a href=\"(.*)\">/i", " ",$row_BlogRS['BlogContent']),0,250))."..."); ?>">
But if I try to combine them the meta description on the resulting page is blank:
<meta name="description" content="<?php echo(str_replace(array("<p>","</p>"),"",substr(preg_replace("/<a href=\"(.*)\">/i", "/<img[^>]+\>/i", " ",$row_BlogRS['BlogContent']),0,250))."..."); ?>">
what am I doing wrong please?
Many thanks
Jamie