Hi all,
I’m currently using EExcerpt to create short summary views of each entry on my blog. While it does a great job stripping out all the images from each post, oftentimes I will have captions alongside those images that will remain intact.
I am attempting to format the results of my EExcerpt query using Low’s “Find and Replace” plugin along with a custom RegEx to identify the caption code and strip it out as well.
Each one of my captions is formatted via a custom style in Wygwam that wraps them in the following code:
<p class="caption"></p>
...so I have been attempting to use the following RegEx to identify that snippet:
<p[^>]*class\s*=\s*(['\"])caption\1[^>]*>(.*?)</p>
My final code block looks like this:
{exp:md_eexcerpt if_exceeds="50" stop_after="50"}
{exp:replace find="<p[^>]*class\s*=\s*(['\"])caption\1[^>]*>(.*?)</p>" regex="yes"}
{body}
{/exp:replace}
{/exp:md_eexcerpt}
This code gives me the following error:
Warning: preg_replace() [function.preg-replace]: No ending delimiter '/' found in /public_html/system/plugins/pi.replace.php on line 72
I guess my first question would be: do any of you guys have experience with this type of implementation? Am I going about this the wrong way? Part of me is thinking this wouldn’t work regardless, as EExcerpt might strip HTML from the result anyway, so there’d be nothing to match the expression to.
And if that’s not the case, is there any chance someone might be able to point me in the right direction with my RegEx code?
Thanks!
