Hello,
I've got a problem with the regular expression api. To illustrate the
problem i've made a little example:
Matcher m=Pattern.compile("test").matcher("this is a test not");
System.out.println(m.replaceAll("\\$_POST[]"));
Works fine, prints:
this is a $_POST[] not
Another example:
String str=readFromSource(); //contents of str is: \$_POST[]
Matcher m=Pattern.compile("test").matcher("this is a test not");
System.out.println(m.replaceAll(str));
This prints:
this is a \$_POST[] not
That's not good, cause the slash before the dollar sign shouldn't be
there.
I try:
String str=readFromSource(); //contents of str is: $_POST[]
Matcher m=Pattern.compile("test").matcher("this is a test not");
System.out.println(m.replaceAll(str));
That gives me a:
java.lang.IllegalArgumentException : Illegal group reference
How can i get output the following output?
this is a $_POST[] not
Best regards,