How can I use a Twig if statement in a View rewrite
You don't need to strip HTML tags. This works for me:
{% if field_tags == &quot;green&quot; %}
   GREEN
{% else %}
   NOT GREEN
{% endif %}

where field_tags is a taxonomy reference field with &quot;Link label to the referenced entity&quot; disabled.