I want to extract the value of id from the following string
.... code=1234random22211, request={ id='randomValue like: aa1a-bb2b-cc3c-ddd4d', event='new' version='1'} ...
I have the made the following pattern:
Pattern p = Pattern.compile("/^.*code=" + currentCode + ", request=\\{([^}]*)");
Matcher m = eventIdPatterns.matcher(logs);
boolean idExists = m.matches();
The pattern evaluates the code successfully: https://regex101.com/r/1kJ5Uo/2 but I don't know how to get rid of the remaining \ in the pattern.
The evaluation is always false because pattern p is seens as: /^.*orderCode=20200409174150852, request=\{([^}]*).
Can somebody indicate me how to get rid of that extra \ from pattern when I perform m.matches() or another pattern to extract the value of id or the content between curly braces