I'm searching for a "color=number,number,number" and get the "number,number,number" part using regex but when I put the regex pattern,
I get: Regular expression '"\bcolor=\b\K\w\d,\d*,\d*"' is malformed: Illegal/unsupported escape sequence*
Here is the code:
Pattern p = Pattern.compile("\\bcolor=\\b\\K\\w\\d*,\\d*,\\d*");
Matcher m = p.matcher(url);
if(m.find()){
return m.group(0);
}
else {
return "0,0,0";
}
I also tried:
"\\bcolor=\\b\\\\K\\w\\d*,\\d*,\\d*"
and:
"\\\\bcolor=\\\\b\\\\K\\\\w\\\\d*,\\\\d*,\\\\d*"
The above compiles but doesn't get the desired result.
How can I fix this? Thanks!
\K?