What is the proper way to escape this String 0x\w+:0x\w+[^][]*\K\[(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)\] to be used as a Java String variable.
IntelliJ escapes this automatically into (when pasted):
String pattern = "0x\\w+:0x\\w+[^][]*\\K\\[(\\-?\\d+(\\.\\d+)?),\\s*(\\-?\\d+(\\.\\d+)?)\\]";
However, this is causing compiler error:
java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 18
[]looks a bit weird. I'm fairly confident that's an error in your regex (it's also "near index 18"), but I'm intrigued to know if it's actually doing something.\K