the code looks this:
{% item in example %} {{ item }} {% endfor %}
basically, need 3 things in code. item
, example
, , content of code block. i'm using expression:
^{% (.*?) in (.*?) %}((.*?|\n)+){% endfor %}$
but if have more 1 code in format, matches first opening of for
until last closing of endfor
. screenshot might explaining this:
i have here: https://regex101.com/r/zd1vo9/3
add ?
after +
non-greedy match.
^{% (.*?) in (.*?) %}((.*?|\n)+?){% endfor %}$
or
^{% (.*?) in (.*?) %}([\s\s]+?){% endfor %}$
Comments
Post a Comment