Idea is to provide a working implementation for extractVariablesFrom(str)
js function.
Basically, this function is intended to extract variable names from a string, considering that variable name should
be surrounded with double or triple braces (mixing not allowed) and name should not contain any space.
Obviously, variable may appear anywhere in the string (at the start/end typically, or "glued" to another variable).
Background : I translate an application into many languages. A translation can either be a raw string or a
handlebar template string.
In latter case, I give to my translator the raw template string (with some handlebar variables embedded into it)
and I expect them to NOT alter this template string (typically, don't remove braces nor translate variable names).
I'm going to use the extractVariablesFrom(str)
function to compare the variables I have in the message to translate
with the variable I have in the translated message : if I detect differences, then I want to raise a red flag to the translator.
Working solution :