I am trying to write regexp which will help find untranslated texts in html code.
Translated texts mean that they pass a special tag: or through a construction: $ {...}
Ex. Without translation:
<h1>Hello</h1>
Translated texts:
<h1><fmt:message key="hello" /></h1>
<button>${expression}</button>
I wrote the following expression:
\<(\w+[^>])(?:.*)\>([^\s]+?)\</\1\>
It finds the correct lines, for example:
<p>text<p>
Skips right
<a><fmt:message key="common.delete" /></a>
But also catches:
<li><p><fmt:message key="common.delete" /></p></li>
And I can't figure out how to add an exception for the strings $ {...} in this expression Can anyone help me?
source
share