All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Low Replace Regex PHP Error

Bryan 28 Oct 2011 18:41 problem, complete

Hi,

I'm using the exact code from your example page "Regex with backspace" to clean up any links that may have been added to an entry description that is being posted in a meta tag. Problem is that when I try this all I'm getting is a PHP error.

Here's my code:
<meta property="og:description" content="{exp:low_replace find='<a[^>]*href=QUOTE(.+)QUOTE[^>]*>(.*)</a>' replace='$2 ($1)' regex='yes'}{entry_desc}{/exp:low_replace}" />

And here are the errors I'm receiving:

A PHP Error was encountered



Severity: Warning

Message: preg_replace() [function.preg-replace]: Unknown modifier 'a'

Filename: low_replace/pi.low_replace.php

Line Number: 101

A PHP Error was encountered



Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/llocke4/public_html/quincylist.com/cms/codeigniter/system/core/Exceptions.php:170)

Filename: core/Common.php

Line Number: 405

Replies

  1. Low 1 Nov 2011 11:41

    Hi, try adding a backslash in front of the forward slash in the closing a tag, like this:

    <a[^>]*href=QUOTE(.+)QUOTE[^>]*>(.*)<\/a>

  2. Bryan 1 Nov 2011 19:20

    That was it. Thank you!

  3. Low 7 Nov 2011 11:31

    You're welcome. :)