String.replaceAll problem processing "value { { {"

From: Peebster_99 (Peebster_99_at_yahoo.com)
Date: 03/05/04


Date: 5 Mar 2004 10:12:07 -0800

I would like to use String.replaceAll() in order to replace substrings
that equal: "value { { {" with this string: "value { {".

When attempting to invoke replaceAll as follows:
  String s = ("value[\\s]{\\s");
  output.replaceAll(s ,"value { {");

The following error result below produced at runtime. Using \\s for
whitespace yields similar results. Can someone point out to me what
I'm doing wrong here?
Thanks,

java.util.regex.PatternSyntaxException: Illegal repetition near index
5
value { { {
     ^
java.util.regex.PatternSyntaxException: Illegal repetition near index
5
value { { {
     ^



Relevant Pages

  • String.replaceAll problem processing "value { { {"
    ... I would like to use String.replaceAllin order to replace substrings ... When attempting to invoke replaceAll as follows: ... whitespace yields similar results. ... java.util.regex.PatternSyntaxException: Illegal repetition near index ...
    (comp.lang.java.programmer)
  • Re: String.replaceAll problem processing "value { { {"
    ... > I would like to use String.replaceAllin order to replace substrings ... > When attempting to invoke replaceAll as follows: ... > java.util.regex.PatternSyntaxException: Illegal repetition near index ... them with two backslashes prepending. ...
    (comp.lang.java.developer)
  • Re: String.replaceAll problem processing "value { { {"
    ... > I would like to use String.replaceAllin order to replace substrings ... > When attempting to invoke replaceAll as follows: ... > java.util.regex.PatternSyntaxException: Illegal repetition near index ... them with two backslashes prepending. ...
    (comp.lang.java.programmer)