I have the following string:
String str = "{% assign foo = values %}.{{ foo[0] }}."
And I'm trying to compile it as a pattern with:
Pattern p = Pattern.compile(StringEscapeUtils.escapeJava(str));
but the compilation fails with the "Illegal repetition" error which I'm guessing is due to the '{' char not being escaped.
How can I escape it properly? Preferably without adding "\\" in front of every character.