I am trying to make a regex that matches tags like this (so I can substitute them with blanks):
{# This is a comment #}
{% if cows > pandas %}
{{ my_variable }}
However if the first word in the tags is includes or extends then it must not match the tag (it will always be paired with {% %} tokens fyi).
e.g.
{% include 'foo.html' %}
{% extends 'foo/bar/baz.html' %}
I have the following python regex
{[{#%]\s*.*?(?!include|extends)[}#%]}
However the negative assertion is not working (i.e include and exclude are matched below):
{# match this #}
{% match this %}
{{ match this }}
asdf
{% foo 'match this' %} asdf {% foo 'match this' %} asdf
{% include 'not this' %}
{% extends 'not this' %}
asdf
Note: Yes this is to do with Django templating if you are interested!