How to check for an HTML element in a rich text field? I want to do something special in my template if there's an HTML table in the rich text field. I tried this:

{% if "&lt;/table&gt;" in entry.richTextFieldHandle %}


but it doesn't work. How can I do this? Or can you think of a better way?

Thanks.
You can get this to work if you first escape your string using Twig escape filter. Not exactly sure what's going on, but it'll only work for me if I make Twig double escape the string like so:

{% set strategy = 'html' %}
{% set doubleEscapedString = entry.richTextFieldHandle|escape(strategy) %}
{% set hasTable = '&amp;lt;/table&amp;gt;' in doubleEscapedString %}

&lt;div class="{{ hasTable ? 'hasTable' : 'hasNoTable' }}"&gt;
    {{ entry.richTextFieldHandle }}
&lt;/div&gt;