mirror of
https://github.com/Hopiu/djLint.git
synced 2026-04-25 15:34:44 +00:00
9 lines
472 B
Python
9 lines
472 B
Python
import regex as re
|
|
|
|
string = """<span title="{% if eev.status == eev.STATUS_CURRENT %} {% trans 'A' %} {% elif eev.status == eev.STATUS_APPROVED %} {% trans 'B' %} {% elif eev.status == eev.STATUS_EXPIRED %} {% trans 'C' %}{% endif %}" class="asdf {%if a%}b{%endif%} asdf" {%if a%}checked{%endif%}>"""
|
|
|
|
regex = r"""(?<!\n[ ]*?)\K(<span[ ]+?(
|
|
(?:[^\s]+?=(?:\'(?:[^\']*?{%[^}]*?%}[^\']*?)+?\'))
|
|
)\s*?>)"""
|
|
|
|
print(re.findall(regex, string, re.I | re.X))
|