I have run into a strange situation where a Backward Slash \ is being added to the end of each sentence in the search excerpt field just before each period. For example:

Lorem ipsum dolor sit amet, consectetur adipiscing elit\. Vivamus et sodales nunc\. Aenean sit amet massa at ante porttitor euismod a sit amet ante\. Morbi vitae est eu ante rutrum cursus sit amet nec nunc\. Aliquam erat volutpat\. Curabitur eget odio arcu, vel fermentum felis\. Sed pellentesque lorem ac nibh…

It happens no matter what type of field I have set as the excerpt (RTE or Textarea).

The search results template is fairly straightforward:

<div class="content group">
        <h1>Resultados de la búsqueda</h1>

        <div class="article primary d-all">

        <p>You searched for <strong>{exp:search:keywords}</strong> 
        and got {exp:search:total_results}{total_results}{/exp:search:total_results} result{if "{exp:search:total_results}" != 1}s{/if}.</p>
            <li><a href="{site_url}{auto_path}">{title}</a> {excerpt}</li>

The slash is not being displayed within the entry template, just in the search results template.

Any thoughts would be appreciated.


Updated to show text with slashes. It was removed by the SE template for some reason.

  • There don't appear to be any backslashes or forward slashes in your example text. Can you correct it so that it appears as you're seeing it? Dec 27, 2012 at 2:13
  • The slashes were removed by the SE template. I have fixed it. Thanks for bringing that to my attention. You can also go here: fuentelatina.org and do a search for Iran to see it in action. Dec 27, 2012 at 2:44
  • Do you have any non-core extensions installed? Also, are there any template tags around this tag or is this at the root of the template? Is this in an embed, snippet, stash, or morsel perhaps? Dec 27, 2012 at 4:06
  • I have the following extensions installed: CE Image - AWS, Channel Files Extension, Playa and VZ URL. The above code is at the root of the template. Dec 27, 2012 at 14:20

1 Answer 1


This is a bug (see bug report #19102). It's because the excerpt is being filtered through PHP's preg_quote(). You can either remove the preg_quote() from line 1507 of mod.search.php for now and just leave it as $excerpt and hope you don't have anything that looks like a replacement pattern in your search excerpts, or just show the custom fields themselves in the template and limit the text with a character-limiter plugin.

  • Awesome. Thanks for the insight. I decided to use the custom fields themselves. Worked like a charm. Dec 27, 2012 at 17:35
  • 1
    Brad - please remember to accept Kevin's answer as correct. Kevin - can you post a link to the relevant bug report so folks can track this issue? Dec 27, 2012 at 19:43
  • 3
    Sure here you go, I submitted the bug after I posted the answer. support.ellislab.com/bugs/detail/19102
    – Kevin Cupp
    Dec 27, 2012 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.