Hi,
I want to replace in a string a expression like "^1:2" by "^(1/2)":
For example, "V/Hz^1:2" would be converted to "V/Hz^(1/2)".
I tried the following code:
String oldExponent = "[^](\\d+):(\\d+)"; // e.g. ^1:2
String newExponent = "^($1/$2)"; // e.g. ^(1/2)
myString = myString.replaceAll(oldExponent, newExponent);
but the following exception is thrown in the third line:
java.util.regex.PatternSyntaxException: Unclosed character class near index 13
[^](\d+):(\d+)
^
Any idea?
Thanks in advance.