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

Support archive

Low Search - Find and Replace - "&" and "#" symbols

LemontMcMillan 14 Feb 2013 16:34 problem, complete

When I try and use Low Search's Find and Replace using things like "&" or "#" it shows no results, but when I put in other search results..I see those items. How do I find and replace those?

Seems my client site is covered in code that didn't get converted so I need to mass replace these since I don't know which entries have been infected. Thoughts?

Replies

  1. Low 14 Feb 2013 16:42

    Ah, it seems there is a bug when doing a Find & Replace for a '#'.

    To fix, open up helpers/low_search_helper, and look up line #25. On that line, change this:

    preg_quote($needle)


    to this:

    preg_quote($needle, '#')


    Do the exact same thing on line #88.

    As for seeing what entries have been infected -- you can see each entry affected by a F&R action in the Find & Replace Log.

  2. LemontMcMillan 14 Feb 2013 16:53

    Still didn't work, but maybe I replace the wrong thing. I changed line "27" to

    [code]if (preg_match_all('#'.preg_quote($needle, '#').'#', $haystack, $matches))[/code]

    and line 88 to:

    [code]return preg_replace('#('.preg_quote($needle, '#').')#', '$1', $haystack);[/code]

    Is that right?

  3. Low 14 Feb 2013 16:55

    Looks right.

    What version of Low Search are you using? And are you seeing an error message, or just the message "no matching entries found"?

    What are the fields that are supposed to have the #'s in them? What is their field type?

  4. LemontMcMillan 14 Feb 2013 16:57

    I'm using Low Search 2.2.0 and the fieldtype with the issue is a WYGWAM fieldtype.

    I'm seeing that "No matching entries found."

  5. Low 14 Feb 2013 16:59

    Can I take a look myself to see what's happening? You can send superadmin login credentials to hi at gotolow dot com.

  6. LemontMcMillan 14 Feb 2013 17:12

    I just sent you an email with the login information and an example search.

  7. Low 20 Feb 2013 09:24

    I fixed it by applying the changes mentioned in the first reply (they weren't in the file when I checked).

    The fix will be added to the next version.