Hello,

I want to replace parts of a string but get an error :-(

The code:

String reSiezedURL = "foo";

reSiezedURL = reSiezedURL.replaceAll("(?w=[0-9]+)",
String.format("?w=%d", this.reqWidth));
reSiezedURL = reSiezedURL.replaceAll("(&w=[0-9]+)",
String.format("&w=%d", this.reqWidth));
reSiezedURL = reSiezedURL.replaceAll("(?h=[0-9]+)",
String.format("?h=%d", this.reqHeight));
reSiezedURL = reSiezedURL.replaceAll("(&h=[0-9]+)",
String.format("&h=%d", this.reqHeight));

The error:

Caused by: java.util.regex.PatternSyntaxException: Invalid value for
match mode flags near index 4:
(?w=[0-9]+)
    ^
    at java.util.regex.Pattern.compileImpl(Native Method)
    java.util.regex.Pattern.compile(Pattern.java:407)
    at java.util.regex.Pattern.<init>(Pattern.java:390)
    at java.util.regex.Pattern.compile(Pattern.java:381)
    at java.lang.String.replaceAll(String.java:1774)

The question:

What is wrong with my regular expression?


Regards, Ralph

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to