I have the following String:
\018attribute1=value1\028attribute2=value2\033attribute3=value3
Note: the "\0xx" is a hard string no special character include and "\0xx" is random. I get this string from an api and it contains the “\” character.
I want to extract attribute names and attribute values
how to do it?
You need to escape the
\character twice. Once for Java, and once for regex. This turns it into\\\\. Then you can usePatternandMatcherto build a map of your values: