I have to read a file with some String values and transform them to Regex. So I am using the class Pattern
of java.util.regex
and I have some problem for some special characters.
For example if I have this String:
*Hello
when I am creating the regex with:
Pattern.compile("*Hello").matcher("*Hello").matches()
the result is false.
So I need to find a way to transform automatically the String in the compile in \\*Hello
. How is it possible?
Thanks in advice.