My String is "T1/T2\/T3/T4\\/T5\\"
My Expected output is "T1","T2/T3","T4\", "T5\"(split using /). if / is prefixed by \ then that / is treated as string character not a separator.
I am following the below code, `
String pattern = "((?!/)(\\/|[^/])+(?=/)?)+";
Pattern r = Pattern.compile(pattern);
String path = {getting from request}; //Raw type T1/T2\/T3/T4\\/T5\\
Matcher m = r.matcher(path);
while (m.find()) {
System.out.println(m.group(0));
}`
my result is "T1/T2/T3/T4\/T5\" it is not an expected output.
How I can change my regular expression so that it will give expected result?
in backend my string will change since I am sending ?