Answer the question
In order to leave comments, you need to log in
How to write regexp correctly?
In general, I need to find all the localization strings in the template, where it happens, I use different quotes, I wrote a script, but here's the problem
import re
text = """<input value="0" >{{ _('Root') }}
<input value="1" >{{ _("Test's") }}
<input value="{{ _('Move') }}" name="submit">"""
regx = re.compile(r"""_\((["'])([^\1]*)\1\)""")
regx.findall(text)
regx = re.compile(r"""_\((["'])([^'"]*)\1\)""")
regx.findall(text)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question