title: preg_match in twig
body: <p>First of all, I know that the logic should be in the controller and not in the view and I keep it that way.</p>
  
  <p>But in this particular situation I need to use preg_match within a ternary operation to set the css class of a div.</p>
  
  <p>Example:</p>
  
  <pre><code>{% for list in lists %}
      &lt;div class="{{ (preg_match(list.a, b))&gt;0 ? something : else }}"...&gt;...&lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>How can I achieve the <b>(preg_match(list.a,b))>0</b> condition in twig?</p>
  
  <p>Thanks in advance</p>